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

x64 fixes

This commit is contained in:
Alexander Medvednikov
2020-01-01 22:34:46 +01:00
parent 807c16dd1b
commit b1d6021875
8 changed files with 74 additions and 128 deletions

View File

@@ -93,6 +93,7 @@ pub fn parse_file(path string, table &table.Table) ast.File {
pub fn parse_files(paths []string, table &table.Table) []ast.File {
mut files := []ast.File
for path in paths {
println('parse file "$path"')
mut stmts := []ast.Stmt
text := os.read_file(path) or {
panic(err)
@@ -437,6 +438,24 @@ pub fn (p mut Parser) expr(rbp int) (ast.Expr,types.Type) {
fn (p mut Parser) for_statement() ast.ForStmt {
p.check(.key_for)
// `for i in start .. end`
if p.peek_tok.kind == .key_in {
var := p.check_name()
p.check(.key_in)
start := p.tok.lit.int()
p.check(.number)
p.check(.dotdot)
end := p.tok.lit.int()
// println('for start=$start $end')
p.check(.number)
stmts := p.parse_block()
// println('nr stmts=$stmts.len')
return ast.ForStmt{
stmts: stmts
is_in: true
}
}
// `for cond {`
cond,typ := p.expr(0)
if !types.check(types.bool_type, typ) {
p.error('non-bool used as for condition')