Explorar o código

DIM now needs to return something compatible to SIZE (and not to LONGINT as it was before)

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8137 8c9fc860-2736-0410-a75d-ab315db34111
felixf %!s(int64=7) %!d(string=hai) anos
pai
achega
2393da1668
Modificáronse 1 ficheiros con 4 adicións e 3 borrados
  1. 4 3
      source/FoxSemanticChecker.Mod

+ 4 - 3
source/FoxSemanticChecker.Mod

@@ -7280,8 +7280,8 @@ TYPE
 									Error(operator.position,"return type is not Boolean")
 								END
 							ELSIF mustReturnInteger THEN
-								IF ~(procedureType.returnType.resolved IS SyntaxTree.IntegerType) THEN
-									Error(operator.position,"return type is not integer")
+								IF ~IsSizeType(procedureType.returnType, system.addressSize) THEN
+									Error(operator.position,"return type is no size type")
 								END
 							END
 						ELSIF procedureType.returnType # NIL THEN
@@ -9534,7 +9534,8 @@ TYPE
 
 	PROCEDURE IsSizeType(type: SyntaxTree.Type; addressWidth: LONGINT): BOOLEAN;
 	BEGIN
-		RETURN (type # NIL) & ((type IS SyntaxTree.IntegerType) & (type(SyntaxTree.IntegerType).sizeInBits <= addressWidth) OR (type IS SyntaxTree.SizeType))
+		
+		RETURN (type # NIL) & ((type.resolved IS SyntaxTree.IntegerType) & (type.resolved(SyntaxTree.IntegerType).sizeInBits <= addressWidth) OR (type.resolved IS SyntaxTree.SizeType))
 	END IsSizeType;