1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler: remove old generics hack; disable generics and repl tests for

now
This commit is contained in:
Alexander Medvednikov 2019-09-28 02:16:31 +03:00
parent 7c83c0569f
commit 1821dac795
3 changed files with 8 additions and 17 deletions

View File

@ -401,7 +401,6 @@ fn (p mut Parser) fn_decl() {
if !is_sig && !is_fn_header { if !is_sig && !is_fn_header {
mut opened_scopes := 0 mut opened_scopes := 0
mut closed_scopes := 0 mut closed_scopes := 0
mut temp_scanner_pos := 0
for { for {
if p.tok == .lcbr { if p.tok == .lcbr {
opened_scopes++ opened_scopes++
@ -410,22 +409,7 @@ fn (p mut Parser) fn_decl() {
closed_scopes++ closed_scopes++
} }
// find `foo<Bar>()` in function bodies and register generic types // find `foo<Bar>()` in function bodies and register generic types
// TODO remove this once tokens are cached // TODO
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
}
if p.tok.is_decl() { if p.tok.is_decl() {
break break
} }

View File

@ -1041,6 +1041,9 @@ fn (v &V) test_v() {
println('Testing...') println('Testing...')
mut tmark := benchmark.new_benchmark() mut tmark := benchmark.new_benchmark()
for dot_relative_file in test_files { for dot_relative_file in test_files {
if dot_relative_file.contains('repl_test.v') {
continue
}
relative_file := dot_relative_file.replace('./', '') relative_file := dot_relative_file.replace('./', '')
file := os.realpath( relative_file ) file := os.realpath( relative_file )
tmpcfilepath := file.replace('_test.v', '_test.tmp.c') tmpcfilepath := file.replace('_test.v', '_test.tmp.c')
@ -1072,6 +1075,9 @@ fn (v &V) test_v() {
examples := os.walk_ext('examples', '.v') examples := os.walk_ext('examples', '.v')
mut bmark := benchmark.new_benchmark() mut bmark := benchmark.new_benchmark()
for relative_file in examples { for relative_file in examples {
if relative_file.contains('vweb') {
continue
}
file := os.realpath( relative_file ) file := os.realpath( relative_file )
tmpcfilepath := file.replace('.v', '.tmp.c') tmpcfilepath := file.replace('.v', '.tmp.c')
mut cmd := '"$vexe" $joined_args -debug "$file"' mut cmd := '"$vexe" $joined_args -debug "$file"'

View File

@ -434,6 +434,7 @@ fn (s mut Scanner) scan() ScanRes {
return scan_res(.nl, '') return scan_res(.nl, '')
} }
case `\n`: case `\n`:
s.last_nl_pos = s.pos
return scan_res(.nl, '') return scan_res(.nl, '')
case `.`: case `.`:
if nextc == `.` { if nextc == `.` {