浏览代码

Fixed not finding localmain under certain circumstances.

woollybah 9 年之前
父节点
当前提交
a10ebc1d17
共有 1 个文件被更改,包括 12 次插入2 次删除
  1. 12 2
      decl.bmx

+ 12 - 2
decl.bmx

@@ -889,9 +889,19 @@ Type TScopeDecl Extends TDecl
 			If Not decl Then
 				' didn't find it? Maybe it is in module local scope?
 				' issue arises when a global initialises with a local variable in the module scope.
-				Local fdecl:TFuncDecl = TFuncDecl(FindDecl("__localmain", True))
+				Local fdecl:Object = FindDecl("__localmain", True)
 				If fdecl Then
-					decl = TValDecl( fdecl.FindDecl( ident ) )
+					If TFuncDecl(fdecl) Then
+						decl = TValDecl( TFuncDecl(fdecl).FindDecl( ident ) )
+					Else If TFuncDeclList(fdecl) Then
+						For Local func:TFuncDecl = EachIn TFuncDeclList(fdecl)
+							func.Semant()
+							decl = TValDecl( func.FindDecl( ident ) )
+							If decl Then
+								Exit
+							End If
+						Next
+					End If
 					
 					' a local variable from module local scope can't be seen outside of module local scope...
 					If TLocalDecl(decl) And static Then