Update c_src to handle default closures.
[nit.git] / c_src / syntax._sep.c
1 /* This C file is generated by NIT to compile module syntax. */
2 #include "syntax._sep.h"
3 val_t syntax___SrcModuleLoader___file_type(val_t self) {
4 struct trace_t trace = {NULL, NULL, 31, LOCATE_syntax___SrcModuleLoader___file_type};
5 val_t variable[3];
6 void **closurevariable = NULL;
7 trace.prev = tracehead; tracehead = &trace;
8 trace.file = LOCATE_syntax;
9 variable[0] = self;
10 variable[2] = NEW_String_string___String___with_native(BOX_NativeString("nit"), TAG_Int(3)); /*new String*/
11 variable[1] = variable[2];
12 goto return_label0;
13 return_label0: while(false);
14 tracehead = trace.prev;
15 return variable[1];
16 }
17 val_t syntax___SrcModuleLoader___parse_file(val_t self, val_t param0, val_t param1, val_t param2, val_t param3, val_t param4) {
18 struct trace_t trace = {NULL, NULL, 33, LOCATE_syntax___SrcModuleLoader___parse_file};
19 val_t variable[22];
20 void **closurevariable = NULL;
21 trace.prev = tracehead; tracehead = &trace;
22 trace.file = LOCATE_syntax;
23 variable[0] = self;
24 variable[1] = param0;
25 variable[2] = param1;
26 variable[3] = param2;
27 variable[4] = param3;
28 variable[5] = param4;
29 variable[8] = NEW_Lexer_lexer___Lexer___init( variable[2] /*file*/, variable[3] /*filename*/); /*new Lexer*/
30 variable[7] = variable[8];
31 variable[9] = NEW_Parser_parser___Parser___init( variable[7] /*lexer*/); /*new Parser*/
32 variable[8] = variable[9];
33 variable[10] = ((parser___Parser___parse_t)CALL( variable[8] /*parser*/,COLOR_parser___Parser___parse))( variable[8] /*parser*/) /*Parser::parse*/;
34 variable[9] = variable[10];
35 variable[10] = ((parser_nodes___Start___n_base_t)CALL( variable[9] /*node_tree*/,COLOR_parser_nodes___Start___n_base))( variable[9] /*node_tree*/) /*Start::n_base*/;
36 variable[10] = TAG_Bool((variable[10] == NIT_NULL /*null*/) || ((variable[10] != NIT_NULL) && ((((kernel___Object_____eqeq_t)CALL(variable[10],COLOR_kernel___Object_____eqeq))==kernel___Object_____eqeq)?(IS_EQUAL_NN(variable[10], NIT_NULL /*null*/)):(UNTAG_Bool(((kernel___Object_____eqeq_t)CALL(variable[10],COLOR_kernel___Object_____eqeq))(variable[10], NIT_NULL /*null*/) /*Object::==*/)))));
37 if (UNTAG_Bool(variable[10])) { /*if*/
38 variable[11] = ((parser_nodes___Start___n_eof_t)CALL( variable[9] /*node_tree*/,COLOR_parser_nodes___Start___n_eof))( variable[9] /*node_tree*/) /*Start::n_eof*/;
39 variable[10] = variable[11];
40 variable[11] = TAG_Bool(( variable[10] /*err*/==NIT_NULL) || VAL_ISA( variable[10] /*err*/, COLOR_PError, ID_PError)) /*cast PError*/;
41 if (!UNTAG_Bool(variable[11])) { fprintf(stderr, "Assert%s failed", ""); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_syntax___SrcModuleLoader___parse_file, LOCATE_syntax, 40); nit_exit(1);}
42 variable[11] = NEW_String_string___String___init(); /*new String*/
43 variable[12] = NEW_String_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
44 variable[13] = variable[12];
45 ((string___String___append_t)CALL(variable[11],COLOR_abstract_collection___IndexedCollection___append))(variable[11], variable[13]) /*String::append*/;
46 variable[14] = ((parser_prod___Token___locate_t)CALL( variable[10] /*err*/,COLOR_parser_prod___PNode___locate))( variable[10] /*err*/) /*Token::locate*/;
47 variable[15] = variable[14];
48 ((string___String___append_t)CALL(variable[11],COLOR_abstract_collection___IndexedCollection___append))(variable[11], variable[15]) /*String::append*/;
49 variable[16] = NEW_String_string___String___with_native(BOX_NativeString(": "), TAG_Int(2)); /*new String*/
50 variable[17] = variable[16];
51 ((string___String___append_t)CALL(variable[11],COLOR_abstract_collection___IndexedCollection___append))(variable[11], variable[17]) /*String::append*/;
52 variable[18] = ((lexer___PError___message_t)CALL( variable[10] /*err*/,COLOR_lexer___PError___message))( variable[10] /*err*/) /*PError::message*/;
53 variable[19] = variable[18];
54 ((string___String___append_t)CALL(variable[11],COLOR_abstract_collection___IndexedCollection___append))(variable[11], variable[19]) /*String::append*/;
55 variable[20] = NEW_String_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
56 variable[21] = variable[20];
57 ((string___String___append_t)CALL(variable[11],COLOR_abstract_collection___IndexedCollection___append))(variable[11], variable[21]) /*String::append*/;
58 ((mmloader___ToolContext___error_t)CALL( variable[1] /*context*/,COLOR_mmloader___ToolContext___error))( variable[1] /*context*/, variable[11]) /*ToolContext::error*/;
59 variable[11] = variable[0];
60 exit(UNTAG_Int( TAG_Int(1)));
61 }
62 variable[11] = ((parser_nodes___Start___n_base_t)CALL( variable[9] /*node_tree*/,COLOR_parser_nodes___Start___n_base))( variable[9] /*node_tree*/) /*Start::n_base*/;
63 variable[10] = variable[11];
64 variable[11] = TAG_Bool(( variable[10] /*node_module*/==NIT_NULL) || VAL_ISA( variable[10] /*node_module*/, COLOR_AModule, ID_AModule)) /*cast AModule*/;
65 if (!UNTAG_Bool(variable[11])) { fprintf(stderr, "Assert%s failed", ""); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_syntax___SrcModuleLoader___parse_file, LOCATE_syntax, 45); nit_exit(1);}
66 variable[12] = NEW_MMSrcModule_syntax_base___MMSrcModule___init( variable[1] /*context*/, variable[10] /*node_module*/, variable[5] /*dir*/, variable[4] /*name*/); /*new MMSrcModule*/
67 variable[11] = variable[12];
68 variable[6] = variable[11] /*module*/;
69 goto return_label1;
70 return_label1: while(false);
71 tracehead = trace.prev;
72 return variable[6];
73 }
74 void syntax___SrcModuleLoader___process_metamodel(val_t self, val_t param0, val_t param1) {
75 struct trace_t trace = {NULL, NULL, 52, LOCATE_syntax___SrcModuleLoader___process_metamodel};
76 val_t variable[4];
77 void **closurevariable = NULL;
78 trace.prev = tracehead; tracehead = &trace;
79 trace.file = LOCATE_syntax;
80 variable[0] = self;
81 variable[1] = param0;
82 variable[2] = param1;
83 ((syntax___MMSrcModule___process_supermodules_t)CALL( variable[2] /*module*/,COLOR_syntax___MMSrcModule___process_supermodules))( variable[2] /*module*/, variable[1] /*context*/) /*MMSrcModule::process_supermodules*/;
84 ((syntax___MMSrcModule___process_syntax_t)CALL( variable[2] /*module*/,COLOR_syntax___MMSrcModule___process_syntax))( variable[2] /*module*/, variable[1] /*context*/) /*MMSrcModule::process_syntax*/;
85 return_label2: while(false);
86 tracehead = trace.prev;
87 return;
88 }
89 void syntax___SrcModuleLoader___init(val_t self, int* init_table) {
90 struct trace_t trace = {NULL, NULL, 58, LOCATE_syntax___SrcModuleLoader___init};
91 val_t variable[2];
92 void **closurevariable = NULL;
93 trace.prev = tracehead; tracehead = &trace;
94 trace.file = LOCATE_syntax;
95 variable[0] = self;
96 if (init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_SrcModuleLoader].i]) return;
97 return_label3: while(false);
98 init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_SrcModuleLoader].i] = 1;
99 tracehead = trace.prev;
100 return;
101 }
102 void syntax___MMSrcModule___process_supermodules(val_t self, val_t param0) {
103 struct trace_t trace = {NULL, NULL, 62, LOCATE_syntax___MMSrcModule___process_supermodules};
104 val_t variable[5];
105 void **closurevariable = NULL;
106 trace.prev = tracehead; tracehead = &trace;
107 trace.file = LOCATE_syntax;
108 variable[0] = self;
109 variable[1] = param0;
110 variable[3] = variable[0];
111 variable[3] = ((syntax_base___MMSrcModule___node_t)CALL(variable[3],COLOR_syntax_base___MMSrcModule___node))(variable[3]) /*MMSrcModule::node*/;
112 variable[4] = variable[0];
113 ((mmbuilder___AModule___import_super_modules_t)CALL(variable[3],COLOR_mmbuilder___AModule___import_super_modules))(variable[3], variable[1] /*tc*/, variable[4]) /*AModule::import_super_modules*/;
114 return_label4: while(false);
115 tracehead = trace.prev;
116 return;
117 }
118 void syntax___MMSrcModule___process_syntax(val_t self, val_t param0) {
119 struct trace_t trace = {NULL, NULL, 69, LOCATE_syntax___MMSrcModule___process_syntax};
120 val_t variable[4];
121 void **closurevariable = NULL;
122 trace.prev = tracehead; tracehead = &trace;
123 trace.file = LOCATE_syntax;
124 variable[0] = self;
125 variable[1] = param0;
126 variable[3] = variable[0];
127 ((mmbuilder___MMSrcModule___do_mmbuilder_t)CALL(variable[3],COLOR_mmbuilder___MMSrcModule___do_mmbuilder))(variable[3], variable[1] /*tc*/) /*MMSrcModule::do_mmbuilder*/;
128 variable[3] = ((mmloader___ToolContext___error_count_t)CALL( variable[1] /*tc*/,COLOR_mmloader___ToolContext___error_count))( variable[1] /*tc*/) /*ToolContext::error_count*/;
129 variable[3] = TAG_Bool(UNTAG_Int(variable[3])>UNTAG_Int( TAG_Int(0)));
130 if (UNTAG_Bool(variable[3])) { /*if*/
131 variable[3] = variable[0];
132 exit(UNTAG_Int( TAG_Int(1)));
133 }
134 variable[3] = variable[0];
135 ((typing___MMSrcModule___do_typing_t)CALL(variable[3],COLOR_typing___MMSrcModule___do_typing))(variable[3], variable[1] /*tc*/) /*MMSrcModule::do_typing*/;
136 variable[3] = ((mmloader___ToolContext___error_count_t)CALL( variable[1] /*tc*/,COLOR_mmloader___ToolContext___error_count))( variable[1] /*tc*/) /*ToolContext::error_count*/;
137 variable[3] = TAG_Bool(UNTAG_Int(variable[3])>UNTAG_Int( TAG_Int(0)));
138 if (UNTAG_Bool(variable[3])) { /*if*/
139 variable[3] = variable[0];
140 exit(UNTAG_Int( TAG_Int(1)));
141 }
142 variable[3] = variable[0];
143 ((control_flow___MMSrcModule___do_control_flow_t)CALL(variable[3],COLOR_control_flow___MMSrcModule___do_control_flow))(variable[3], variable[1] /*tc*/) /*MMSrcModule::do_control_flow*/;
144 variable[3] = ((mmloader___ToolContext___error_count_t)CALL( variable[1] /*tc*/,COLOR_mmloader___ToolContext___error_count))( variable[1] /*tc*/) /*ToolContext::error_count*/;
145 variable[3] = TAG_Bool(UNTAG_Int(variable[3])>UNTAG_Int( TAG_Int(0)));
146 if (UNTAG_Bool(variable[3])) { /*if*/
147 variable[3] = variable[0];
148 exit(UNTAG_Int( TAG_Int(1)));
149 }
150 return_label5: while(false);
151 tracehead = trace.prev;
152 return;
153 }