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

now
pull/2141/head
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 {
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<Bar>()` 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
}

View File

@ -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"'

View File

@ -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 == `.` {