ast: vfmt ast.v

pull/4945/head
Alexander Medvednikov 2020-05-18 18:06:09 +02:00
parent 07a78b2843
commit 5c0c418818
1 changed files with 41 additions and 61 deletions

View File

@ -510,7 +510,6 @@ pub:
pos token.Position pos token.Position
} }
*/ */
// #include etc // #include etc
pub struct HashStmt { pub struct HashStmt {
pub: pub:
@ -878,47 +877,30 @@ pub fn (expr Expr) position() token.Position {
pub fn (stmt Stmt) position() token.Position { pub fn (stmt Stmt) position() token.Position {
match mut stmt { match mut stmt {
AssertStmt { AssertStmt { return it.pos }
return it.pos AssignStmt { return it.pos }
} /*
AssignStmt {
return it.pos
}
// Attr { // Attr {
// } // }
// Block { // Block {
// } // }
// BranchStmt { // BranchStmt {
// } // }
Comment { */
return it.pos Comment { return it.pos }
} CompIf { return it.pos }
CompIf { ConstDecl { return it.pos }
return it.pos /*
}
ConstDecl {
return it.pos
}
// DeferStmt { // DeferStmt {
// } // }
EnumDecl { */
return it.pos EnumDecl { return it.pos }
} ExprStmt { return it.pos }
ExprStmt { FnDecl { return it.pos }
return it.pos ForCStmt { return it.pos }
} ForInStmt { return it.pos }
FnDecl { ForStmt { return it.pos }
return it.pos /*
}
ForCStmt {
return it.pos
}
ForInStmt {
return it.pos
}
ForStmt {
return it.pos
}
// GlobalDecl { // GlobalDecl {
// } // }
// GoStmt { // GoStmt {
@ -929,26 +911,23 @@ pub fn (stmt Stmt) position() token.Position {
// } // }
// HashStmt { // HashStmt {
// } // }
Import { */
return it.pos Import { return it.pos }
} /*
// InterfaceDecl { // InterfaceDecl {
// } // }
// Module { // Module {
// } // }
Return { */
return it.pos Return { return it.pos }
} StructDecl { return it.pos }
StructDecl { /*
return it.pos
}
// TypeDecl { // TypeDecl {
// } // }
// UnsafeStmt { // UnsafeStmt {
// } // }
else { */
return token.Position{} else { return token.Position{} }
}
} }
} }
@ -962,6 +941,7 @@ pub fn fe2ex(x table.FExpr) Expr {
C.memcpy(&res, &x, sizeof(Expr)) C.memcpy(&res, &x, sizeof(Expr))
return res return res
} }
pub fn ex2fe(x Expr) table.FExpr { pub fn ex2fe(x Expr) table.FExpr {
res := table.FExpr{} res := table.FExpr{}
C.memcpy(&res, &x, sizeof(table.FExpr)) C.memcpy(&res, &x, sizeof(table.FExpr))