瀏覽代碼

Check for superclass cycles. Fixes #373.

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

+ 4 - 1
decl.bmx

@@ -2871,9 +2871,12 @@ End Rem
 		If superTy
 		If superTy
 			Local cb:TClassDeclCallback = New TClassDeclCallback
 			Local cb:TClassDeclCallback = New TClassDeclCallback
 			cb.decl = Self
 			cb.decl = Self
-			
+
 			attrs :| DECL_CYCLIC
 			attrs :| DECL_CYCLIC
 			superClass=superTy.SemantClass(cb)
 			superClass=superTy.SemantClass(cb)
+			If superClass.attrs & DECL_CYCLIC Then
+				Err "Cyclic type dependency"
+			End If
 			attrs :~ DECL_CYCLIC
 			attrs :~ DECL_CYCLIC
 			If superClass.IsInterface() Then
 			If superClass.IsInterface() Then
 				If Not IsExtern() Or Not superClass.IsExtern() Err superClass.ToString()+" is an interface, not a class."
 				If Not IsExtern() Or Not superClass.IsExtern() Err superClass.ToString()+" is an interface, not a class."