| Index: compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
|
| diff --git a/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java b/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
|
| index 73ba73c9aefd2345042ea9832e805e2083e97fa0..9fc8bfe01ff7dc49001df495203ba83d5ddb0c5e 100644
|
| --- a/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
|
| +++ b/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
|
| @@ -12,6 +12,7 @@ import com.google.dart.compiler.ast.DartArrayLiteral;
|
| import com.google.dart.compiler.ast.DartAssertStatement;
|
| import com.google.dart.compiler.ast.DartBinaryExpression;
|
| import com.google.dart.compiler.ast.DartBooleanLiteral;
|
| +import com.google.dart.compiler.ast.DartCascadeExpression;
|
| import com.google.dart.compiler.ast.DartClass;
|
| import com.google.dart.compiler.ast.DartComment;
|
| import com.google.dart.compiler.ast.DartExprStmt;
|
| @@ -37,6 +38,7 @@ import com.google.dart.compiler.ast.DartUnaryExpression;
|
| import com.google.dart.compiler.ast.DartUnit;
|
| import com.google.dart.compiler.ast.DartVariable;
|
| import com.google.dart.compiler.ast.DartVariableStatement;
|
| +import com.google.dart.compiler.ast.NodeList;
|
|
|
| import java.util.List;
|
|
|
| @@ -148,6 +150,35 @@ public class SyntaxTest extends AbstractParserTest {
|
| assertTrue(expression instanceof DartBooleanLiteral);
|
| }
|
|
|
| + public void test_cascade_withConditionalInside() {
|
| + DartUnit unit = parseUnit("function.dart", Joiner.on("\n").join(
|
| + "class A {",
|
| + " var name;",
|
| + " foo() {}",
|
| + "}",
|
| + "",
|
| + "",
|
| + "",
|
| + "main() {",
|
| + " A a = new A();",
|
| + " a",
|
| + " ..name = true ? 'true' : 'false'",
|
| + " ..foo();",
|
| + "}"
|
| + ));
|
| + assertNotNull(unit);
|
| + assertEquals(2, unit.getTopLevelNodes().size());
|
| + DartMethodDefinition function = (DartMethodDefinition) unit.getTopLevelNodes().get(1);
|
| + assertNotNull(function);
|
| + DartStatement statement = function.getFunction().getBody().getStatements().get(1);
|
| + assertTrue(statement instanceof DartExprStmt);
|
| + DartCascadeExpression cascade = (DartCascadeExpression) ((DartExprStmt) statement).getExpression();
|
| + NodeList<DartExpression> cascadeSections = cascade.getCascadeSections();
|
| + assertEquals(2, cascadeSections.size());
|
| + assertEquals("..name = true ? \"true\" : \"false\"", cascadeSections.get(0).toString());
|
| + assertEquals("..foo()", cascadeSections.get(1).toString());
|
| + }
|
| +
|
| public void test_functionExpression_asStatement() {
|
| DartUnit unit = parseUnit("function.dart", Joiner.on("\n").join(
|
| "main() {",
|
|
|