Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1045)

Unified Diff: compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java

Issue 10823014: Fix for issue 1489 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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",
« no previous file with comments | « compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698