Pārlūkot izejas kodu

patched bugs introduced before (procedure compatibility)

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7785 8c9fc860-2736-0410-a75d-ab315db34111
felixf 7 gadi atpakaļ
vecāks
revīzija
9351783616
2 mainītis faili ar 15 papildinājumiem un 8 dzēšanām
  1. 1 4
      source/FoxSemanticChecker.Mod
  2. 14 4
      source/FoxSyntaxTree.Mod

+ 1 - 4
source/FoxSemanticChecker.Mod

@@ -9021,10 +9021,7 @@ TYPE
 						IsPointerType(this) & (IsTypeExtension(to,this) OR to(SyntaxTree.PointerType).isUnsafe OR ((to(SyntaxTree.PointerType).pointerBase.resolved IS SyntaxTree.ArrayType) & SameType(to,this)))
 				     & (~to.isRealtime OR this.isRealtime);
 			ELSIF to IS SyntaxTree.ProcedureType THEN
-				result := (this IS SyntaxTree.NilType) OR (this IS SyntaxTree.ProcedureType) & SameType(to(SyntaxTree.ProcedureType),this(SyntaxTree.ProcedureType))
-					& (~(this(SyntaxTree.ProcedureType).isDelegate) OR (to(SyntaxTree.ProcedureType).isDelegate))
-					& (~to.isRealtime OR this.isRealtime)
-					& ((this(SyntaxTree.ProcedureType).stackAlignment <=1) OR (this(SyntaxTree.ProcedureType).stackAlignment <= to(SyntaxTree.ProcedureType).stackAlignment));
+				result := (this IS SyntaxTree.NilType) OR (this IS SyntaxTree.ProcedureType) & this.CompatibleTo(to)
 			ELSIF (to IS SyntaxTree.RecordType) & to(SyntaxTree.RecordType).isObject THEN
 				result := (this IS SyntaxTree.NilType) OR IsTypeExtension(to,this);
 			ELSIF to IS SyntaxTree.RecordType THEN

+ 14 - 4
source/FoxSyntaxTree.Mod

@@ -1851,8 +1851,8 @@ TYPE
 		BEGIN
 			returnType := type;
 		END SetReturnType;
-
-		PROCEDURE SameType*(this: Type): BOOLEAN;
+		
+		PROCEDURE SameSignature*(this: Type): BOOLEAN;
 		VAR result: BOOLEAN; p1,p2: Parameter;
 		BEGIN
 			result := FALSE;
@@ -1866,7 +1866,7 @@ TYPE
 					result := (returnType = NIL) & (this.returnType = NIL) OR (returnType # NIL) & (this.returnType # NIL) & returnType.SameType(this.returnType.resolved);
 					result := result & (callingConvention = this.callingConvention);
 					result := result & (noReturn = this.noReturn);
-					result := result & (isDelegate = this.isDelegate);
+					result :=  result & (isInterrupt = this.isInterrupt);
 					IF result THEN
 						
 						p1 := selfParameter; p2 := this.selfParameter;
@@ -1884,11 +1884,21 @@ TYPE
 			END;
 			recursion := FALSE;
 			RETURN result
+
+		END SameSignature;
+		
+
+		PROCEDURE SameType*(this: Type): BOOLEAN;
+		BEGIN
+			RETURN SameSignature(this) 
+				& (this(ProcedureType).isDelegate = isDelegate)
+				& (this(ProcedureType).isRealtime = isRealtime);
 		END SameType;
 
 		PROCEDURE CompatibleTo*(to: Type): BOOLEAN;
 		BEGIN
-			RETURN SameType(to) & (~isDelegate OR to(ProcedureType).isDelegate) & (~to.isRealtime OR isRealtime);
+			RETURN SameSignature(to) & (~isDelegate OR to(ProcedureType).isDelegate) & (~to.isRealtime OR isRealtime)
+					& ((stackAlignment <=1) OR (stackAlignment <= to(ProcedureType).stackAlignment));
 		END CompatibleTo;
 
 		PROCEDURE IsComposite*(): BOOLEAN;