瀏覽代碼

ImplementsInterface() should check hierarchy. Fixes #294.

woollybah 8 年之前
父節點
當前提交
b4dc07113c
共有 2 個文件被更改,包括 10 次插入0 次删除
  1. 6 0
      decl.bmx
  2. 4 0
      parser.bmx

+ 6 - 0
decl.bmx

@@ -3018,6 +3018,12 @@ End Rem
 				Return True
 				Return True
 			End If
 			End If
 		Next
 		Next
+		
+		' check hierarchy
+		If superClass Then
+			Return superClass.ImplementsInterface(ident)
+		End If
+		
 		Return False
 		Return False
 	End Method
 	End Method
 	
 	

+ 4 - 0
parser.bmx

@@ -177,6 +177,10 @@ Type TForEachinStmt Extends TLoopStmt
 		Else If TObjectType( expr.exprType )
 		Else If TObjectType( expr.exprType )
 			Local tmpDecl:TDeclStmt
 			Local tmpDecl:TDeclStmt
 			Local iterable:Int
 			Local iterable:Int
+
+			' ensure semanted
+			TObjectType(expr.exprType).classDecl.Semant()
+			
 			If TObjectType(expr.exprType).classDecl.ImplementsInterface("iiterable") Then
 			If TObjectType(expr.exprType).classDecl.ImplementsInterface("iiterable") Then
 				iterable = True
 				iterable = True
 			End If
 			End If