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

Unified Diff: dart/tests/compiler/dart2js_extra/argument_definition_test.dart

Issue 10915030: Parse argument definition test expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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: dart/tests/compiler/dart2js_extra/argument_definition_test.dart
diff --git a/dart/tests/compiler/dart2js_extra/argument_definition_test.dart b/dart/tests/compiler/dart2js_extra/argument_definition_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5d0d936092b662075910eefcb37cebdb00f9d5ed
--- /dev/null
+++ b/dart/tests/compiler/dart2js_extra/argument_definition_test.dart
@@ -0,0 +1,51 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test parsing and resolution of argument definition test.
+
+int test(int a, [int b = 2, int c = 3]) {
+ int result = 0;
+ print(?b);
+ print(?result); /// 01: compile-time error
+ print(?a);
+ print(?b);
+ print(?c);
+ {
+ var b;
+ ?b; /// 02: compile-time error
+ }
+ print((!?a?!?b:!?c) == (?a??b:?c));
+ print(!?a?!?b:!?c == ?a??b:?c);
+}
+
+closure_test(int a, [int b = 2, int c = 3]) {
+ var x = 0;
+ return () {
+ int result = 0;
+ print(?b);
+ print(?result); /// 03: compile-time error
+ print(?x); /// 04: compile-time error
+ print(?a);
+ print(?b);
+ print(?c);
+ {
+ var b;
+ ?b; /// 05: compile-time error
+ }
+ print((!?a?!?b:!?c) == (?a??b:?c));
+ print(!?a?!?b:!?c == ?a??b:?c);
+ };
+}
+
+main() {
+ test(1);
+ test(1, 2);
+ test(1, 2, 3);
+ test(1, c:3);
+
+ closure_test(1)();
+ closure_test(1, 2)();
+ closure_test(1, 2, 3)();
+ closure_test(1, c:3)();
+}
« no previous file with comments | « dart/lib/compiler/implementation/ssa/builder.dart ('k') | dart/tests/compiler/dart2js_extra/dart2js_extra.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698