From 1821dac795c1567462c533f8c2f9b67ab2ba0aa7 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sat, 28 Sep 2019 02:16:31 +0300 Subject: [PATCH] compiler: remove old generics hack; disable generics and repl tests for now --- compiler/fn.v | 18 +----------------- compiler/main.v | 6 ++++++ compiler/scanner.v | 1 + 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/compiler/fn.v b/compiler/fn.v index bfee955f2f..b31791fa5c 100644 --- a/compiler/fn.v +++ b/compiler/fn.v @@ -401,7 +401,6 @@ fn (p mut Parser) fn_decl() { if !is_sig && !is_fn_header { mut opened_scopes := 0 mut closed_scopes := 0 - mut temp_scanner_pos := 0 for { if p.tok == .lcbr { opened_scopes++ @@ -410,22 +409,7 @@ fn (p mut Parser) fn_decl() { closed_scopes++ } // find `foo()` in function bodies and register generic types - // TODO remove this once tokens are cached - if p.tok == .gt && p.prev_tok == .name && p.prev_tok2 == .lt && - p.scanner.text[p.scanner.pos-1] != `T` { - temp_scanner_pos = p.scanner.pos - p.scanner.pos -= 3 - for p.scanner.pos > 0 && (is_name_char(p.scanner.text[p.scanner.pos]) || - p.scanner.text[p.scanner.pos] == `.` || - p.scanner.text[p.scanner.pos] == `<` ) { - p.scanner.pos-- - } - p.scanner.pos-- - p.next() - // Run the function in the firt pass to register the generic type - p.name_expr() - p.scanner.pos = temp_scanner_pos - } + // TODO if p.tok.is_decl() { break } diff --git a/compiler/main.v b/compiler/main.v index 419066878f..1f0b4397cb 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -1041,6 +1041,9 @@ fn (v &V) test_v() { println('Testing...') mut tmark := benchmark.new_benchmark() for dot_relative_file in test_files { + if dot_relative_file.contains('repl_test.v') { + continue + } relative_file := dot_relative_file.replace('./', '') file := os.realpath( relative_file ) tmpcfilepath := file.replace('_test.v', '_test.tmp.c') @@ -1072,6 +1075,9 @@ fn (v &V) test_v() { examples := os.walk_ext('examples', '.v') mut bmark := benchmark.new_benchmark() for relative_file in examples { + if relative_file.contains('vweb') { + continue + } file := os.realpath( relative_file ) tmpcfilepath := file.replace('.v', '.tmp.c') mut cmd := '"$vexe" $joined_args -debug "$file"' diff --git a/compiler/scanner.v b/compiler/scanner.v index 0331b6d192..39454ff5ca 100644 --- a/compiler/scanner.v +++ b/compiler/scanner.v @@ -434,6 +434,7 @@ fn (s mut Scanner) scan() ScanRes { return scan_res(.nl, '') } case `\n`: + s.last_nl_pos = s.pos return scan_res(.nl, '') case `.`: if nextc == `.` {