|
@@ -6,6 +6,8 @@ Class VarDecl Extends Decl
|
|
Field type:Expr
|
|
Field type:Expr
|
|
Field init:Expr
|
|
Field init:Expr
|
|
|
|
|
|
|
|
+ Field semtype:Type
|
|
|
|
+
|
|
Method ToNode:SNode( scope:Scope ) Override
|
|
Method ToNode:SNode( scope:Scope ) Override
|
|
|
|
|
|
Return New VarValue( Self,scope )
|
|
Return New VarValue( Self,scope )
|
|
@@ -80,7 +82,7 @@ Class VarValue Extends Value
|
|
type=vdecl.type.SemantType( scope )
|
|
type=vdecl.type.SemantType( scope )
|
|
|
|
|
|
If vdecl.init init=vdecl.init.SemantRValue( scope,type )
|
|
If vdecl.init init=vdecl.init.SemantRValue( scope,type )
|
|
-
|
|
|
|
|
|
+
|
|
Else If vdecl.init
|
|
Else If vdecl.init
|
|
|
|
|
|
init=vdecl.init.SemantRValue( scope )
|
|
init=vdecl.init.SemantRValue( scope )
|
|
@@ -88,34 +90,26 @@ Class VarValue Extends Value
|
|
If TCast<VoidType>( init.type ) Throw New SemantEx( "Variables cannot have 'Void' type" )
|
|
If TCast<VoidType>( init.type ) Throw New SemantEx( "Variables cannot have 'Void' type" )
|
|
|
|
|
|
type=init.type
|
|
type=init.type
|
|
-
|
|
|
|
Else
|
|
Else
|
|
|
|
|
|
SemantError( "VarValue.OnSemant()" )
|
|
SemantError( "VarValue.OnSemant()" )
|
|
|
|
|
|
Endif
|
|
Endif
|
|
|
|
|
|
- If Not scope.IsGeneric And Not vdecl.IsExtern And Not Cast<Block>( scope )
|
|
|
|
-
|
|
|
|
- If vdecl.kind="global" Or vdecl.kind="const"
|
|
|
|
- transFile.globals.Push( Self )
|
|
|
|
- Else
|
|
|
|
- scope.transMembers.Push( Self )
|
|
|
|
- Endif
|
|
|
|
-
|
|
|
|
|
|
+ If Not scope.IsInstanceOf
|
|
|
|
+ If vdecl.semtype SemantError( "VarValue.OnSemant() 2" )
|
|
|
|
+ vdecl.semtype=type
|
|
Endif
|
|
Endif
|
|
|
|
|
|
- #rem
|
|
|
|
- If Not type.IsGeneric And Not vdecl.IsExtern And Not Cast<Block>( scope )
|
|
|
|
|
|
+ If Not scope.IsGeneric And Not vdecl.IsExtern And Not Cast<Block>( scope )
|
|
|
|
|
|
If vdecl.kind="global" Or vdecl.kind="const"
|
|
If vdecl.kind="global" Or vdecl.kind="const"
|
|
transFile.globals.Push( Self )
|
|
transFile.globals.Push( Self )
|
|
Else
|
|
Else
|
|
scope.transMembers.Push( Self )
|
|
scope.transMembers.Push( Self )
|
|
Endif
|
|
Endif
|
|
-
|
|
|
|
|
|
+
|
|
Endif
|
|
Endif
|
|
- #end
|
|
|
|
|
|
|
|
Scope.semanting.Pop()
|
|
Scope.semanting.Pop()
|
|
|
|
|