File tree Expand file tree Collapse file tree
rusty_linter/src/pre_linter Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,3 +32,9 @@ impl Position {
3232 self . col
3333 }
3434}
35+
36+ impl Default for Position {
37+ fn default ( ) -> Self {
38+ Self :: start ( )
39+ }
40+ }
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ use rusty_parser::*;
99// TYPE ... END TYPE -> stored in user_defined_types depends on CONST for resolving string length (AS STRING * some_const)
1010// FUNCTION/SUB -> depends on resolver for resolving bare names and on user_defined_types to ensure types exist
1111
12+ #[ derive( Default ) ]
1213struct MainContext {
1314 resolver : TypeResolverImpl ,
1415 user_defined_types : UserDefinedTypes ,
@@ -19,14 +20,7 @@ struct MainContext {
1920}
2021
2122pub fn pre_lint_program ( program : & Program ) -> Result < PreLinterResult , LintErrorPos > {
22- let mut ctx = MainContext {
23- resolver : TypeResolverImpl :: new ( ) ,
24- user_defined_types : Default :: default ( ) ,
25- functions : SubprogramContext :: new ( ) ,
26- subs : SubprogramContext :: new ( ) ,
27- global_constants : Default :: default ( ) ,
28- declaration_pos : Position :: start ( ) ,
29- } ;
23+ let mut ctx = MainContext :: default ( ) ;
3024 <MainContext as Visitor < Program > >:: visit ( & mut ctx, program) ?;
3125 ctx. post_visit_functions ( ) ?;
3226 ctx. post_visit_subs ( ) ?;
Original file line number Diff line number Diff line change @@ -109,10 +109,6 @@ impl Implementations {
109109}
110110
111111impl SubprogramContext {
112- pub fn new ( ) -> Self {
113- Self :: default ( )
114- }
115-
116112 pub fn add_declaration (
117113 & mut self ,
118114 bare_name : BareName ,
You can’t perform that action at this time.
0 commit comments