@@ -48,8 +48,10 @@ void language_filest::show_parse(std::ostream &out)
48
48
file.second .language ->show_parse (out);
49
49
}
50
50
51
- bool language_filest::parse ()
51
+ bool language_filest::parse (message_handlert &message_handler )
52
52
{
53
+ messaget log (message_handler);
54
+
53
55
for (auto &file : file_map)
54
56
{
55
57
// open file
@@ -58,7 +60,7 @@ bool language_filest::parse()
58
60
59
61
if (!infile)
60
62
{
61
- error () << " Failed to open " << file.first << eom;
63
+ log . error () << " Failed to open " << file.first << messaget:: eom;
62
64
return true ;
63
65
}
64
66
@@ -68,7 +70,7 @@ bool language_filest::parse()
68
70
69
71
if (language.parse (infile, file.first ))
70
72
{
71
- error () << " Parsing of " << file.first << " failed" << eom;
73
+ log . error () << " Parsing of " << file.first << " failed" << messaget:: eom;
72
74
return true ;
73
75
}
74
76
@@ -82,7 +84,8 @@ bool language_filest::parse()
82
84
83
85
bool language_filest::typecheck (
84
86
symbol_table_baset &symbol_table,
85
- const bool keep_file_local)
87
+ const bool keep_file_local,
88
+ message_handlert &message_handler)
86
89
{
87
90
// typecheck interfaces
88
91
@@ -153,7 +156,8 @@ bool language_filest::typecheck(
153
156
154
157
for (auto &module : module_map)
155
158
{
156
- if (typecheck_module (symbol_table, module.second , keep_file_local))
159
+ if (typecheck_module (
160
+ symbol_table, module.second , keep_file_local, message_handler))
157
161
return true ;
158
162
}
159
163
@@ -203,36 +207,43 @@ bool language_filest::interfaces(symbol_table_baset &symbol_table)
203
207
bool language_filest::typecheck_module (
204
208
symbol_table_baset &symbol_table,
205
209
const std::string &module,
206
- const bool keep_file_local)
210
+ const bool keep_file_local,
211
+ message_handlert &message_handler)
207
212
{
208
213
// check module map
209
214
210
215
module_mapt::iterator it=module_map.find (module);
211
216
212
217
if (it==module_map.end ())
213
218
{
214
- error () << " found no file that provides module " << module << eom;
219
+ messaget log (message_handler);
220
+ log .error () << " found no file that provides module " << module
221
+ << messaget::eom;
215
222
return true ;
216
223
}
217
224
218
- return typecheck_module (symbol_table, it->second , keep_file_local);
225
+ return typecheck_module (
226
+ symbol_table, it->second , keep_file_local, message_handler);
219
227
}
220
228
221
229
bool language_filest::typecheck_module (
222
230
symbol_table_baset &symbol_table,
223
231
language_modulet &module,
224
- const bool keep_file_local)
232
+ const bool keep_file_local,
233
+ message_handlert &message_handler)
225
234
{
226
235
// already typechecked?
227
236
228
237
if (module.type_checked )
229
238
return false ;
230
239
240
+ messaget log (message_handler);
241
+
231
242
// already in progress?
232
243
233
244
if (module.in_progress )
234
245
{
235
- error () << " circular dependency in " << module.name << eom;
246
+ log . error () << " circular dependency in " << module.name << messaget:: eom;
236
247
return true ;
237
248
}
238
249
@@ -249,14 +260,15 @@ bool language_filest::typecheck_module(
249
260
it!=dependency_set.end ();
250
261
it++)
251
262
{
252
- module.in_progress = !typecheck_module (symbol_table, *it, keep_file_local);
263
+ module.in_progress =
264
+ !typecheck_module (symbol_table, *it, keep_file_local, message_handler);
253
265
if (module.in_progress == false )
254
266
return true ;
255
267
}
256
268
257
269
// type check it
258
270
259
- status () << " Type-checking " << module.name << eom;
271
+ log . status () << " Type-checking " << module.name << messaget:: eom;
260
272
261
273
if (module.file ->language ->can_keep_file_local ())
262
274
{
0 commit comments