Просмотр исходного кода

Added check for non-allocability of unsafe pointers

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7900 8c9fc860-2736-0410-a75d-ab315db34111
felixf 7 лет назад
Родитель
Сommit
ca8615ceb3
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      source/FoxSemanticChecker.Mod

+ 4 - 1
source/FoxSemanticChecker.Mod

@@ -5296,6 +5296,9 @@ TYPE
 					IF currentIsRealtime THEN
 						Error(position, "forbidden new in realtime block");
 					END;
+					IF IsUnsafePointer(type0) THEN 
+						Error(position, "forbidden new on unsafe pointer");
+					END;
 					(* check constructor *)
 					IF (first =0) OR CheckVariable(parameter0) THEN
 						IF type0 IS SyntaxTree.PointerType THEN
@@ -8408,7 +8411,7 @@ TYPE
 			i: LONGINT;
 			
 			PROCEDURE DeclareCell(type: SyntaxTree.CellType);
-			VAR baseType: SyntaxTree.Type; property, prop: SyntaxTree.Property; variable: SyntaxTree.Variable;
+			VAR baseType: SyntaxTree.Type; property: SyntaxTree.Property;
 			BEGIN
 				IF type.baseType # NIL THEN 
 					baseType := type.baseType.resolved;