Jelajahi Sumber

use ternary operator

Vladislav Folts 9 tahun lalu
induk
melakukan
08ebbd916d
1 mengubah file dengan 3 tambahan dan 7 penghapusan
  1. 3 7
      src/eberon/EberonContextExpression.ob

+ 3 - 7
src/eberon/EberonContextExpression.ob

@@ -137,14 +137,10 @@ PROCEDURE ExpressionNode.ExpressionNode(parent: ContextHierarchy.PNode)
 END;
 
 PROCEDURE processTypePromotion(node: Node): EberonTypePromotion.PType;
-VAR
-    typePromotion: EberonTypePromotion.PType;
 BEGIN
-    typePromotion := node.combinedTypePromotion;
-    IF typePromotion = NIL THEN
-        typePromotion := node.varTypePromotion;
-    END;
-    RETURN typePromotion;
+    typePromotion <- node.combinedTypePromotion;
+    RETURN typePromotion # NIL ? typePromotion 
+                               : node.varTypePromotion;
 END;
 
 PROCEDURE ExpressionNode.handleExpression(e: Expression.PType);