Kaynağa Gözat

Fixed order-dependent method generation. Fixes #431.

woollybah 6 yıl önce
ebeveyn
işleme
984333ac5a
3 değiştirilmiş dosya ile 7 ekleme ve 5 silme
  1. 3 2
      ctranslator.bmx
  2. 3 2
      decl.bmx
  3. 1 1
      translator.bmx

+ 3 - 2
ctranslator.bmx

@@ -3395,7 +3395,7 @@ End Rem
 					Local link:TLink=list._head._succ
 					While link<>list._head
 						Local ofdecl:TFuncDecl = TFuncDecl(link._value)
-						If fdecl.ident = ofdecl.ident And fdecl.EqualsArgs(ofdecl) Then
+						If fdecl.ident = ofdecl.ident And fdecl.EqualsArgs(ofdecl) And fdecl.scope <> ofdecl.scope Then
 
 							If fdecl.overrides Then
 								link._value = fdecl
@@ -3857,7 +3857,8 @@ End Rem
 					Local ignore:Int
 					Local link:TLink=list._head._succ
 					While link<>list._head
-						If fdecl.ident = TFuncDecl(link._value).ident Then
+						Local ofdecl:TFuncDecl = TFuncDecl(link._value)
+						If fdecl.ident = ofdecl.ident And fdecl.EqualsArgs(ofdecl) And fdecl.scope <> ofdecl.scope Then
 							If fdecl.overrides Then
 								link._value = fdecl
 								ignore = True

+ 3 - 2
decl.bmx

@@ -2786,11 +2786,12 @@ End Rem
 			Local matched:Int = False
 			
 			For Local i:Int = 0 Until funcs.length
+				Local ofunc:TFuncDecl = funcs[i]
 				' found a match - we are overriding it
-				If func.IdentLower() = funcs[i].IdentLower() And func.EqualsArgs(funcs[i]) Then
+				If func.IdentLower() = ofunc.IdentLower() And func.EqualsArgs(ofunc) And func.scope <> ofunc.scope Then
 					matched = True
 					' but don't override if we are an interface and the function is implemented
-					If IsInterface() And Not funcs[i].ClassScope().IsInterface() Then
+					If IsInterface() And Not ofunc.ClassScope().IsInterface() Then
 						Exit
 					End If
 					' set this to our own func

+ 1 - 1
translator.bmx

@@ -362,7 +362,7 @@ Type TTranslator
 		Local funcs:TFuncDeclList=TFuncDeclList(funcMungs.ValueForKey( fdecl.ident ))
 		If funcs
 			For Local tdecl:TFuncDecl=EachIn funcs
-				If fdecl.EqualsArgs( tdecl ) And fdecl.scope = tdecl.scope
+				If fdecl.EqualsArgs( tdecl, True ) And fdecl.scope = tdecl.scope
 					fdecl.munged=tdecl.munged
 					Return
 				EndIf