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