| Index: compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
|
| ===================================================================
|
| --- compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java (revision 9886)
|
| +++ compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java (working copy)
|
| @@ -15,6 +15,7 @@
|
| import com.google.dart.compiler.ast.DartExpression;
|
| import com.google.dart.compiler.ast.DartField;
|
| import com.google.dart.compiler.ast.DartFieldDefinition;
|
| +import com.google.dart.compiler.ast.DartFunctionExpression;
|
| import com.google.dart.compiler.ast.DartIdentifier;
|
| import com.google.dart.compiler.ast.DartIntegerLiteral;
|
| import com.google.dart.compiler.ast.DartMapLiteral;
|
| @@ -70,6 +71,22 @@
|
| "}"));
|
| }
|
|
|
| + public void test_functionExpression_asStatement() {
|
| + DartUnit unit = parseUnit("function.dart", Joiner.on("\n").join(
|
| + "main() {",
|
| + " () {};",
|
| + "}"
|
| + ));
|
| + assertNotNull(unit);
|
| + assertEquals(1, unit.getTopLevelNodes().size());
|
| + DartMethodDefinition function = (DartMethodDefinition) unit.getTopLevelNodes().get(0);
|
| + assertNotNull(function);
|
| + DartStatement statement = function.getFunction().getBody().getStatements().get(0);
|
| + assertTrue(statement instanceof DartExprStmt);
|
| + DartExpression expression = ((DartExprStmt) statement).getExpression();
|
| + assertTrue(expression instanceof DartFunctionExpression);
|
| + }
|
| +
|
| public void test_const() {
|
| DartUnit unit = parseUnit(getName() + ".dart", makeCode(
|
| "// filler filler filler filler filler filler filler filler filler filler",
|
|
|