Browse Source

Ignore out of scope function decls.
Fixes #74.

woollybah 10 years ago
parent
commit
77ce22e169
2 changed files with 14 additions and 1 deletions
  1. 13 0
      expr.bmx
  2. 1 1
      options.bmx

+ 13 - 0
expr.bmx

@@ -1998,6 +1998,19 @@ Type TIdentExpr Extends TExpr
 		'Local scope:TScopeDecl=IdentScope()
 		Local fdecl:TFuncDecl=scope.FindFuncDecl( ident,args )
 
+		' if our scope is static, but the scope of the found function/method is not
+		' then we should ignore it and continue looking higher up the scope stack.
+		If static And fdecl And Not fdecl.IsStatic() Then
+			Local scope2:TScopeDecl = fdecl.scope
+			
+			fdecl = Null
+			
+			' if fdecl was a method, this would be the Type's scope (ie. file/module)
+			If scope2.scope Then
+				fdecl = scope2.scope.FindFuncDecl( ident,args )
+			End If
+		End If
+
 		' couldn't find it? try a global search
 		If Not fdecl Then
 			For Local mdecl:TModuleDecl = EachIn _appInstance.globalImports.Values()

+ 1 - 1
options.bmx

@@ -25,7 +25,7 @@ SuperStrict
 
 Import "base.configmap.bmx"
 
-Const version:String = "0.37"
+Const version:String = "0.38"
 
 Const BUILDTYPE_APP:Int = 0
 Const BUILDTYPE_MODULE:Int = 1