Revision 9
Added by Willibald K. over 8 years ago
UnaryOperator.java | ||
---|---|---|
28 | 28 |
package org.momut.ooas.ast.expressions; |
29 | 29 |
|
30 | 30 |
import org.momut.ooas.ast.IAstVisitor; |
31 |
import org.momut.ooas.ast.types.UlyssesType;
|
|
31 |
import org.momut.ooas.ast.types.Type; |
|
32 | 32 |
import org.momut.ooas.utils.exceptions.ArgumentException; |
33 | 33 |
|
34 | 34 |
|
... | ... | |
70 | 70 |
visitor.visit(this); |
71 | 71 |
} |
72 | 72 |
|
73 |
public static Expression CoerceUp(Expression anExpr, UlyssesType target)
|
|
73 |
public static Expression CoerceUp(Expression anExpr, Type target) |
|
74 | 74 |
{ |
75 | 75 |
if (target == null) |
76 | 76 |
throw new ArgumentException(); |
77 | 77 |
|
78 | 78 |
if (anExpr.kind() == ExpressionKind.Value |
79 | 79 |
&& anExpr.type().kind() == target.kind() |
80 |
&& UlyssesType.TypeEqual(UlyssesType.CoverType(anExpr.type(), target),target))
|
|
80 |
&& Type.TypeEqual(Type.CoverType(anExpr.type(), target),target))
|
|
81 | 81 |
{ |
82 | 82 |
// if we are widening the range of a type assigned to a value, then just set the |
83 | 83 |
// new type and skip constructing a new node. |
... | ... | |
92 | 92 |
} |
93 | 93 |
} |
94 | 94 |
|
95 |
public static Expression TryCoerceUp(Expression anExpr, UlyssesType target)
|
|
95 |
public static Expression TryCoerceUp(Expression anExpr, Type target) |
|
96 | 96 |
{ |
97 |
if (!UlyssesType.TypeEqual(anExpr.type(), target))
|
|
97 |
if (!Type.TypeEqual(anExpr.type(), target)) |
|
98 | 98 |
{ |
99 | 99 |
return CoerceUp(anExpr, target); |
100 | 100 |
} |
Also available in: Unified diff
remove support for Qualitative Action Systems, rename UlyssesType to Type