Browse Source

patched issues with realtime: no more failed compilation tests

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6848 8c9fc860-2736-0410-a75d-ab315db34111
felixf 9 năm trước cách đây
mục cha
commit
da863aa98f
3 tập tin đã thay đổi với 16 bổ sung6 xóa
  1. BIN
      source/Fox.Tool
  2. 15 5
      source/FoxSemanticChecker.Mod
  3. 1 1
      source/Oberon.Compilation.Test

BIN
source/Fox.Tool


+ 15 - 5
source/FoxSemanticChecker.Mod

@@ -739,6 +739,7 @@ TYPE
 				*)
 				IF x.pointerBase IS SyntaxTree.RecordType THEN
 					recordType := x.pointerBase(SyntaxTree.RecordType);
+					IF x.isRealtime THEN recordType.SetRealtime(TRUE) END;
 					recordBaseType := ResolveType(recordType.baseType);
 					recordType.SetBaseType(recordBaseType);
 					recordType.SetProtected(HasFlag(modifiers, Global.NameExclusive, position));
@@ -1040,10 +1041,13 @@ TYPE
 				END;
 
 				isRealtime := TRUE;
+				IF x.isRealtime & (x.recordScope.bodyProcedure # NIL) THEN
+					x.recordScope.bodyProcedure.type.SetRealtime(TRUE)
+				END;
 				symbol := x.recordScope.firstSymbol; (* sorted symbols, important to go through procedures in a sorted way here !*)
 				WHILE symbol # NIL DO
+					isRealtime := isRealtime & symbol.type.resolved.isRealtime;
 					IF symbol IS SyntaxTree.Variable THEN
-						isRealtime := isRealtime & symbol.type.resolved.isRealtime;
 						hasPointers := hasPointers OR symbol.type.resolved.hasPointers & ~symbol(SyntaxTree.Variable).untraced;
 					END;
 					IF symbol IS SyntaxTree.Procedure THEN
@@ -1053,8 +1057,15 @@ TYPE
 						ELSIF InMethodTable(procedure) THEN (* not a static method *)
 							procedure.SetMethodNumber(numberMethods);
 							INC(numberMethods);
-						END;
+						END;	
+					IF ~x.isRealtime & procedure.type.resolved.isRealtime THEN
+						Error(procedure.position, Diagnostics.Invalid,"realtime procedure in non-realtime object")
+					END;
+					END;
+					IF x.isRealtime & ~symbol.type.resolved.isRealtime THEN
+						Error(symbol.position, Diagnostics.Invalid,"non-realtime symbol in realtime object")
 					END;
+
 					symbol := symbol.nextSymbol;
 				END;
 				IF isRealtime THEN x.SetRealtime(TRUE) END;
@@ -6838,9 +6849,7 @@ TYPE
 				IF procedure.scope IS SyntaxTree.RecordScope THEN
 					record := procedure.scope(SyntaxTree.RecordScope).ownerRecord;
 					procedureType.SetDelegate(TRUE);
-					IF procedureType.isRealtime & ~record.isRealtime THEN
-						Error(procedure.position, Diagnostics.Invalid, "invalid realtime procedure in non-realtime object");
-					END;
+
 
 					selfParameter := SyntaxTree.NewParameter(procedure.position,procedureType,Global.SelfParameterName,SyntaxTree.ValueParameter);
 					IF record.pointerType.typeDeclaration = NIL THEN
@@ -8189,6 +8198,7 @@ TYPE
 				ELSIF (phase = ImplementationPhase) & ~IsOberonInline(procedure) THEN
 					Body(scope(SyntaxTree.ProcedureScope).body)
 				END;
+				
 			END;
 			currentScope := prevScope;
 			currentIsRealtime := prevIsRealtime;

+ 1 - 1
source/Oberon.Compilation.Test

@@ -38305,7 +38305,7 @@ positive: overwriting realtime procedure with realtime procedure
 	END Object;
 	END Test.
 
-positive: overwriting non-realtime procedure with realtime procedure
+negative: overwriting non-realtime procedure with realtime procedure
 
 	MODULE Test;
 	TYPE Base = OBJECT {REALTIME}