@@ -333,10 +333,7 @@ pub fn (mut p Parser) parse() &ast.File {
333
333
p.pref)
334
334
}
335
335
336
- $if trace_parse_file_path_and_mod ? {
337
- eprintln ('>> ast.File, mname: ${module_decl.name:20} , sname: ${module_decl.short_name:11} , path: ${p.file_display_path} ' )
338
- }
339
- return & ast.File{
336
+ ast_file := & ast.File{
340
337
path: p.file_path
341
338
path_base: p.file_base
342
339
is_test: p.inside_test_file
@@ -359,69 +356,17 @@ pub fn (mut p Parser) parse() &ast.File {
359
356
template_paths: p.template_paths
360
357
unique_prefix: p.unique_prefix
361
358
}
362
- }
363
-
364
- /*
365
- struct Queue {
366
- mut:
367
- idx int
368
- mu &sync.Mutex = sync.new_mutex()
369
- mu2 &sync.Mutex = sync.new_mutex()
370
- paths []string
371
- table &ast.Table = unsafe { nil }
372
- parsed_ast_files []&ast.File
373
- pref &pref.Preferences = unsafe { nil }
374
- global_scope &ast.Scope = unsafe { nil }
375
- }
376
-
377
- fn (mut q Queue) run() {
378
- for {
379
- q.mu.lock()
380
- idx := q.idx
381
- if idx >= q.paths.len {
382
- q.mu.unlock()
383
- return
384
- }
385
- q.idx++
386
- q.mu.unlock()
387
- println('run(idx=$idx)')
388
- path := q.paths[idx]
389
- file := parse_file(path, q.table, .skip_comments, q.pref, q.global_scope)
390
- q.mu2.lock()
391
- q.parsed_ast_files << file
392
- q.mu2.unlock()
393
- println('run done(idx=$idx)')
359
+ $if trace_parse_file_path_and_mod ? {
360
+ eprintln ('>> ast.File, tokens: ${ast_file.nr_tokens:5} , mname: ${ast_file.mod.name:20} , sname: ${ast_file.mod.short_name:11} , path: ${p.file_display_path} ' )
394
361
}
362
+ return ast_file
395
363
}
396
- */
364
+
397
365
pub fn parse_files (paths []string , mut table ast.Table, pref_ & pref.Preferences) []& ast.File {
398
366
mut timers := util.new_timers (should_print: false , label: 'parse_files: ${paths} ' )
399
367
$if time_parsing ? {
400
368
timers.should_print = true
401
369
}
402
- $if macos {
403
- /*
404
- if !pref.no_parallel && paths[0].contains('/array.v') {
405
- println('\n\n\nparse_files() nr_files=$paths.len')
406
- println(paths)
407
- nr_cpus := runtime.nr_cpus()
408
- mut q := &Queue{
409
- paths: paths
410
- table: table
411
- pref: pref
412
- global_scope: global_scope
413
- mu: sync.new_mutex()
414
- mu2: sync.new_mutex()
415
- }
416
- for _ in 0 .. nr_cpus - 1 {
417
- go q.run()
418
- }
419
- time.sleep(time.second)
420
- println('all done')
421
- return q.parsed_ast_files
422
- }
423
- */
424
- }
425
370
unsafe {
426
371
mut files := []& ast.File{cap: paths.len}
427
372
for path in paths {
0 commit comments