From c00ec77737b8c048f32253e4c60e7392693bcd4c Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 8 Apr 2020 05:57:36 +0300 Subject: [PATCH] tests: fix compilation of parser_test.v --- cmd/tools/vtest-fixed.v | 2 +- vlib/v/parser/parser_test.v | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/tools/vtest-fixed.v b/cmd/tools/vtest-fixed.v index 4a84049928..0cb35d3110 100644 --- a/cmd/tools/vtest-fixed.v +++ b/cmd/tools/vtest-fixed.v @@ -41,7 +41,7 @@ const ( 'vlib/regex/regex_test.v', 'vlib/sqlite/sqlite_test.v', // Linux only 'vlib/strconv/ftoa/f32_f64_to_string_test.v', - 'vlib/v/parser/parser_test.v', + //'vlib/v/parser/parser_test.v', // exits early, but it should compile 'vlib/v/tests/array_to_string_test.v', 'vlib/v/tests/asm_test.v', // Linux only 'vlib/v/tests/backtrace_test.v', // TCC only diff --git a/vlib/v/parser/parser_test.v b/vlib/v/parser/parser_test.v index 0cd42c8161..b12ad13ea5 100644 --- a/vlib/v/parser/parser_test.v +++ b/vlib/v/parser/parser_test.v @@ -79,7 +79,8 @@ x := 10 ' table := &table.Table{} vpref := &pref.Preferences{} - prog := parse_file(s, table, .skip_comments, vpref) + gscope := &ast.Scope{ parent: 0 } + prog := parse_file(s, table, .skip_comments, vpref, gscope) mut checker := checker.new_checker(table, vpref) checker.check(prog) res := gen.cgen([prog], table, vpref) @@ -111,6 +112,7 @@ fn test_one() { program := ast.File{ stmts: e scope: scope + global_scope: scope } mut checker := checker.new_checker(table, vpref) checker.check(program) @@ -209,6 +211,7 @@ fn test_parse_expr() { program := ast.File{ stmts: e scope: scope + global_scope: scope } checker.check(program) res := gen.cgen([program], table, vpref).after('#endif')