| Index: pkg/polymer_expressions/lib/expression.dart
|
| diff --git a/pkg/polymer_expressions/lib/expression.dart b/pkg/polymer_expressions/lib/expression.dart
|
| index c89724fe8232828b3ff828bcdb1783ac7263fba6..5a69ab05891db0e655869bcf7e0295d76520746c 100644
|
| --- a/pkg/polymer_expressions/lib/expression.dart
|
| +++ b/pkg/polymer_expressions/lib/expression.dart
|
| @@ -23,7 +23,8 @@ Index index(Expression e, Expression a) => new Index(e, a);
|
| Invoke invoke(Expression e, String m, List<Expression> a) =>
|
| new Invoke(e, m, a);
|
| InExpression inExpr(Expression l, Expression r) => new InExpression(l, r);
|
| -
|
| +TernaryOperator ternary(Expression c, Expression t, Expression f) =>
|
| + new TernaryOperator(c, t, f);
|
|
|
| class AstFactory {
|
| EmptyExpression empty() => const EmptyExpression();
|
| @@ -46,6 +47,9 @@ class AstFactory {
|
| BinaryOperator binary(Expression l, String op, Expression r) =>
|
| new BinaryOperator(l, op, r);
|
|
|
| + TernaryOperator ternary(Expression c, Expression t, Expression f) =>
|
| + new TernaryOperator(c, t, f);
|
| +
|
| Getter getter(Expression g, String n) => new Getter(g, n);
|
|
|
| Index index(Expression e, Expression a) => new Index(e, a);
|
| @@ -173,6 +177,26 @@ class BinaryOperator extends Expression {
|
| right.hashCode);
|
| }
|
|
|
| +class TernaryOperator extends Expression {
|
| + final Expression condition;
|
| + final Expression trueExpr;
|
| + final Expression falseExpr;
|
| +
|
| + TernaryOperator(this.condition, this.trueExpr, this.falseExpr);
|
| +
|
| + accept(Visitor v) => v.visitTernaryOperator(this);
|
| +
|
| + String toString() => '($condition ? $trueExpr : $falseExpr)';
|
| +
|
| + bool operator ==(o) => o is TernaryOperator
|
| + && o.condition == condition
|
| + && o.trueExpr == trueExpr
|
| + && o.falseExpr == falseExpr;
|
| +
|
| + int get hashCode => _JenkinsSmiHash.hash3(condition.hashCode,
|
| + trueExpr.hashCode, falseExpr.hashCode);
|
| +}
|
| +
|
| class InExpression extends Expression {
|
| final Expression left;
|
| final Expression right;
|
|
|