Pārlūkot izejas kodu

Fixed not finding localmain under certain circumstances.

woollybah 9 gadi atpakaļ
vecāks
revīzija
a10ebc1d17
1 mainītis faili ar 12 papildinājumiem un 2 dzēšanām
  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