2020-07-03 16:16:20 +02:00
|
|
|
module ast
|
|
|
|
|
2022-01-26 11:36:28 +01:00
|
|
|
pub fn (stmt Stmt) pos() Pos {
|
2020-07-03 16:16:20 +02:00
|
|
|
match stmt {
|
|
|
|
AssertStmt { return stmt.pos }
|
|
|
|
AssignStmt { return stmt.pos }
|
|
|
|
/*
|
|
|
|
// Attr {
|
|
|
|
// }
|
|
|
|
// Block {
|
|
|
|
// }
|
|
|
|
// BranchStmt {
|
|
|
|
// }
|
|
|
|
*/
|
|
|
|
Comment { return stmt.pos }
|
|
|
|
ConstDecl { return stmt.pos }
|
|
|
|
/*
|
|
|
|
// DeferStmt {
|
|
|
|
// }
|
|
|
|
*/
|
|
|
|
EnumDecl { return stmt.pos }
|
|
|
|
ExprStmt { return stmt.pos }
|
|
|
|
FnDecl { return stmt.pos }
|
|
|
|
ForCStmt { return stmt.pos }
|
|
|
|
ForInStmt { return stmt.pos }
|
|
|
|
ForStmt { return stmt.pos }
|
|
|
|
/*
|
|
|
|
// GlobalDecl {
|
|
|
|
// }
|
|
|
|
// GoStmt {
|
|
|
|
// }
|
|
|
|
// GotoLabel {
|
|
|
|
// }
|
|
|
|
// GotoStmt {
|
|
|
|
// }
|
|
|
|
// HashStmt {
|
|
|
|
// }
|
|
|
|
*/
|
|
|
|
Import { return stmt.pos }
|
|
|
|
/*
|
|
|
|
// InterfaceDecl {
|
|
|
|
// }
|
|
|
|
// Module {
|
|
|
|
// }
|
|
|
|
*/
|
|
|
|
Return { return stmt.pos }
|
|
|
|
StructDecl { return stmt.pos }
|
|
|
|
/*
|
|
|
|
// TypeDecl {
|
|
|
|
// }
|
|
|
|
// UnsafeStmt {
|
|
|
|
// }
|
|
|
|
*/
|
|
|
|
//
|
2022-01-26 11:36:28 +01:00
|
|
|
else { return Pos{} }
|
2020-07-03 16:16:20 +02:00
|
|
|
}
|
|
|
|
}
|