浏览代码

Minor issues with inline operators (allow Oberon inline for stream operator on ports)

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6995 8c9fc860-2736-0410-a75d-ab315db34111
felixf 8 年之前
父节点
当前提交
812a845eba
共有 2 个文件被更改,包括 7 次插入3 次删除
  1. 6 2
      source/FoxParser.Mod
  2. 1 1
      source/FoxSemanticChecker.Mod

+ 6 - 2
source/FoxParser.Mod

@@ -1886,7 +1886,9 @@ TYPE
 			END;
 			END;
 
 
 			IF Peek(Scanner.String) OR Peek(Scanner.Character)  THEN (* for compatibility with release *)
 			IF Peek(Scanner.String) OR Peek(Scanner.Character)  THEN (* for compatibility with release *)
-				OperatorDeclaration( parentScope );  RETURN
+				OperatorDeclaration( parentScope );  
+				procedure.SetInline(isInline);
+				RETURN
 			END;
 			END;
 
 
 			position:= symbol.position;
 			position:= symbol.position;
@@ -1945,7 +1947,7 @@ TYPE
 				modifiers := Flags();
 				modifiers := Flags();
 			END;
 			END;
 			IF Optional( Scanner.Minus ) THEN  (* inline *)
 			IF Optional( Scanner.Minus ) THEN  (* inline *)
-				isInline := TRUE
+				isInline := TRUE;
 			END;
 			END;
 
 
 			IF MandatoryString( string ) THEN
 			IF MandatoryString( string ) THEN
@@ -1960,6 +1962,8 @@ TYPE
 			ELSIF Optional( Scanner.Minus ) THEN access := SyntaxTree.ReadOnly;
 			ELSIF Optional( Scanner.Minus ) THEN access := SyntaxTree.ReadOnly;
 			ELSE access := SyntaxTree.Internal;
 			ELSE access := SyntaxTree.Internal;
 			END;
 			END;
+			
+
 			procedureScope := SyntaxTree.NewProcedureScope(parentScope);
 			procedureScope := SyntaxTree.NewProcedureScope(parentScope);
 			operator := SyntaxTree.NewOperator( symbol.position, SyntaxTree.NewIdentifier(string^), procedureScope);
 			operator := SyntaxTree.NewOperator( symbol.position, SyntaxTree.NewIdentifier(string^), procedureScope);
 			CommentSymbol(operator);
 			CommentSymbol(operator);

+ 1 - 1
source/FoxSemanticChecker.Mod

@@ -4577,7 +4577,7 @@ TYPE
 		PROCEDURE CanPassInRegister*(type: SyntaxTree.Type): BOOLEAN;
 		PROCEDURE CanPassInRegister*(type: SyntaxTree.Type): BOOLEAN;
 		BEGIN
 		BEGIN
 			type := type.resolved;
 			type := type.resolved;
-			IF (type IS SyntaxTree.BasicType) & ~type.IsPointer() & ~type.IsComposite() THEN
+			IF (type IS SyntaxTree.BasicType) & ~type.IsPointer() & ~type.IsComposite() OR (type IS SyntaxTree.PortType) THEN
 				RETURN TRUE
 				RETURN TRUE
 			ELSIF system.CanPassInRegister # NIL THEN
 			ELSIF system.CanPassInRegister # NIL THEN
 				RETURN system.CanPassInRegister(type);
 				RETURN system.CanPassInRegister(type);