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

Unified Diff: compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java

Issue 10574003: Fix for issues 1473 and 3521 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
Index: compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java
===================================================================
--- compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java (revision 8813)
+++ compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java (working copy)
@@ -34,6 +34,31 @@
"}"));
}
+ public void test_nonConstantExpressions() {
+ resolveAndTestCtConstExpectErrors(
+ Joiner.on("\n").join(
+ "class Object {}",
+// "void f() {",
+// " int x = 0;",
+// " const {'$x' : 1};",
+// " const {'key': []};",
+// " const [new Object()];",
+// "}"),
scheglov 2012/06/18 20:51:45 Do we need this commented code?
Brian Wilkerson 2012/06/18 20:53:29 Nope. Just forgot to delete it before uploading. I
+ "var x = 0;",
+ "const c1 = const {'$x' : 1};",
+ "const c2 = const {'key': []};",
+ "const c3 = const [new Object()];"),
+ errEx(ResolverErrorCode.EXPECTED_CONSTANT_EXPRESSION, 3, 21, 1),
+ errEx(ResolverErrorCode.EXPECTED_CONSTANT_EXPRESSION, 4, 26,2),
+ errEx(ResolverErrorCode.EXPECTED_CONSTANT_EXPRESSION, 5, 19, 12));
+ }
+
+ public void test_expressionsWithNull() {
+ resolveAndTestCtConst(Joiner.on("\n").join(
+ "class Object {}",
+ "var b = null === '';"));
+ }
+
public void test_parameterDefaultValue_inLocalFunction() {
resolveAndTestCtConstExpectErrors(
Joiner.on("\n").join(
« no previous file with comments | « compiler/java/com/google/dart/compiler/resolver/CompileTimeConstantAnalyzer.java ('k') | samples/tests/samples/samples.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698