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

Unified Diff: tests/compiler/dart2js/drop_trailing_null_arguments_test.dart

Issue 575013002: Drop trailing null arguments in generated JS. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: sra@ comments Created 6 years, 1 month 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 | « sdk/lib/_internal/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/drop_trailing_null_arguments_test.dart
diff --git a/tests/compiler/dart2js/drop_trailing_null_arguments_test.dart b/tests/compiler/dart2js/drop_trailing_null_arguments_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..7a6f58e43556e43c82c1eca1e5c277353867ef1f
--- /dev/null
+++ b/tests/compiler/dart2js/drop_trailing_null_arguments_test.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2014, 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 that parameters keep their names in the output.
+
+import 'package:async_helper/async_helper.dart';
+import 'package:expect/expect.dart';
+import 'compiler_helper.dart';
+
+main() {
+ // If a function call has trailing 'null' arguments, we can safely skip
+ // them as JavaScript will fill missing arguments with 'undefined'.
+ asyncTest(() => compile(r"""
+ class It<A, B> {
+ It([a, b, c]) : super;
+ }
+
+ foo(a,b,c) => a;
+ test() {
+ foo(1, null, null);
+ foo(2, 3, null);
+ new It();
+ new It(null, 1);
+ }
+ """,
+ entry: 'test', minify: false).then((String generated) {
+ Expect.isTrue(generated.contains(r"foo(1)"));
+ Expect.isTrue(generated.contains(r"foo(2, 3)"));
+ Expect.isTrue(generated.contains(r"It$()"));
+ Expect.isTrue(generated.contains(r"It$(null, 1)"));
+ }));
+}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698