@@ -117,7 +117,13 @@ pub type Stmt = AsmStmt
117117 | StructDecl
118118 | TypeDecl
119119
120- pub type ScopeObject = AsmRegister | ConstField | GlobalField | Var
120+ pub struct EmptyScopeObject {
121+ pub mut :
122+ name string
123+ typ Type
124+ }
125+
126+ pub type ScopeObject = EmptyScopeObject | AsmRegister | ConstField | GlobalField | Var
121127
122128// TODO: replace Param
123129pub type Node = CallArg
209215pub const empty_expr = Expr (EmptyExpr (0 ))
210216pub const empty_stmt = Stmt (EmptyStmt{})
211217pub const empty_node = Node (EmptyNode{})
218+ pub const empty_scope_object = ScopeObject (EmptyScopeObject{'empty_scope_object' , 0 })
212219pub const empty_comptime_const_value = ComptTimeConstValue (EmptyExpr (0 ))
213220
214221// `{stmts}` or `unsafe {stmts}`
@@ -1076,8 +1083,8 @@ pub:
10761083 mut_pos token.Pos
10771084 comptime bool
10781085pub mut :
1079- scope & Scope = unsafe { nil }
1080- obj ScopeObject
1086+ scope & Scope = unsafe { nil }
1087+ obj ScopeObject = empty_scope_object
10811088 mod string
10821089 name string
10831090 full_name string
@@ -1115,7 +1122,7 @@ pub fn (i &Ident) is_auto_heap() bool {
11151122pub fn (i &Ident) is_mut () bool {
11161123 match i.obj {
11171124 Var { return i.obj.is_mut }
1118- ConstField { return false }
1125+ ConstField, EmptyScopeObject { return false }
11191126 AsmRegister, GlobalField { return true }
11201127 }
11211128}
@@ -2403,7 +2410,7 @@ pub fn (node Node) pos() token.Pos {
24032410 ConstField, GlobalField, Var {
24042411 return node.pos
24052412 }
2406- AsmRegister {
2413+ EmptyScopeObject, AsmRegister {
24072414 return token.Pos{
24082415 len: - 1
24092416 line_nr: - 1
@@ -2551,7 +2558,7 @@ pub fn (node Node) children() []Node {
25512558 } else if node is ScopeObject {
25522559 match node {
25532560 GlobalField, ConstField, Var { children << node.expr }
2554- AsmRegister {}
2561+ AsmRegister, EmptyScopeObject {}
25552562 }
25562563 } else {
25572564 match node {
0 commit comments