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

Side by Side Diff: tests/compiler/dart2js/closure_codegen_test.dart

Issue 208043003: Rename [call$...] properties to [$...] in compiled code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: found another use of call Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/lib/js_mirrors.dart ('k') | tests/compiler/dart2js/compiler_helper.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // Test that parameters keep their names in the output. 4 // Test that parameters keep their names in the output.
5 5
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 import "package:async_helper/async_helper.dart"; 7 import "package:async_helper/async_helper.dart";
8 import 'compiler_helper.dart'; 8 import 'compiler_helper.dart';
9 import 'parser_helper.dart'; 9 import 'parser_helper.dart';
10 10
(...skipping 14 matching lines...) Expand all
25 const String TEST_INVOCATION2 = r""" 25 const String TEST_INVOCATION2 = r"""
26 main() { 26 main() {
27 var o = null; 27 var o = null;
28 o(1, 2); 28 o(1, 2);
29 } 29 }
30 """; 30 """;
31 31
32 const String TEST_BAILOUT = r""" 32 const String TEST_BAILOUT = r"""
33 class A { 33 class A {
34 var x; 34 var x;
35 foo() { 35 foo(_) { // make sure only g has no arguments
36 var f = function g() { return 499; }; 36 var f = function g() { return 499; };
37 return 499 + x + f(); 37 return 499 + x + f();
38 } 38 }
39 } 39 }
40 40
41 main() { new A().foo(); } 41 main() { new A().foo(1); }
42 """; 42 """;
43 43
44 closureInvocation() { 44 closureInvocation(bool minify, String prefix) {
45 String generated = compile(TEST_INVOCATION0); 45 String generated = compile(TEST_INVOCATION0, minify: minify);
46 Expect.isTrue(generated.contains(r".call$0()")); 46 Expect.isTrue(generated.contains(".$prefix\$0()"));
47 generated = compile(TEST_INVOCATION1); 47 generated = compile(TEST_INVOCATION1, minify: minify);
48 Expect.isTrue(generated.contains(r".call$1(1)")); 48 Expect.isTrue(generated.contains(".$prefix\$1(1)"));
49 generated = compile(TEST_INVOCATION2); 49 generated = compile(TEST_INVOCATION2, minify: minify);
50 Expect.isTrue(generated.contains(r".call$2(1, 2)")); 50 Expect.isTrue(generated.contains(".$prefix\$2(1,${minify ? "" : " "}2)"));
51 } 51 }
52 52
53 // Make sure that the bailout version does not introduce a second version of 53 // Make sure that the bailout version does not introduce a second version of
54 // the closure. 54 // the closure.
55 closureBailout() { 55 closureBailout(bool minify, String prefix) {
56 asyncTest(() => compileAll(TEST_BAILOUT).then((generated) { 56 asyncTest(() => compileAll(TEST_BAILOUT, minify: minify)
57 RegExp regexp = new RegExp(r'call\$0: function'); 57 .then((generated) {
58 RegExp regexp = new RegExp("$prefix\\\$0:${minify ? "" : " "}function");
58 Iterator<Match> matches = regexp.allMatches(generated).iterator; 59 Iterator<Match> matches = regexp.allMatches(generated).iterator;
59 checkNumberOfMatches(matches, 1); 60 checkNumberOfMatches(matches, 1);
60 })); 61 }));
61 } 62 }
62 63
63 main() { 64 main() {
64 closureInvocation(); 65 closureInvocation(false, "call");
65 closureBailout(); 66 closureInvocation(true, "");
67 closureBailout(false, "call");
68 closureBailout(true, "");
66 } 69 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/lib/js_mirrors.dart ('k') | tests/compiler/dart2js/compiler_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698