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

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

Issue 742023002: Handle named and optional arguments in cps-ir. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // VMOptions=-DUSE_CPS_IR=true 4 // VMOptions=-DUSE_CPS_IR=true
5 5
6 // Test that the CPS IR code generator is able to compile the provided 6 // Test that the CPS IR code generator is able to compile the provided
7 // example programs. 7 // example programs.
8 8
9 import 'package:async_helper/async_helper.dart'; 9 import 'package:async_helper/async_helper.dart';
10 import 'package:expect/expect.dart'; 10 import 'package:expect/expect.dart';
11 import 'package:compiler/src/apiimpl.dart' 11 import 'package:compiler/src/apiimpl.dart'
12 show Compiler; 12 show Compiler;
13 import 'memory_compiler.dart'; 13 import 'memory_compiler.dart';
14 import 'package:compiler/src/js/js.dart' as js; 14 import 'package:compiler/src/js/js.dart' as js;
15 import 'package:compiler/src/common.dart' show Element; 15 import 'package:compiler/src/common.dart' show Element;
16 16
17 17
18 const String TEST_MAIN_FILE = 'test.dart'; 18 const String TEST_MAIN_FILE = 'test.dart';
19 19
20 class TestEntry { 20 class TestEntry {
21 final String source; 21 final String source;
22 final String expectation; 22 final String expectation;
23 const TestEntry(this.source, [this.expectation]); 23 const TestEntry(this.source, [this.expectation]);
24 } 24 }
25 25
26 /// The list of tests to run. 26 /// The list of tests to run.
27 const List<TestEntry> tests = const [ 27 const List<TestEntry> tests = const [
28 const TestEntry("""
29 foo(a, [b = "b"]) => b;
30 bar(a, {b: "b", c: "c"}) => c;
31 main() {
32 foo(0);
33 foo(0, 1);
34 bar(0);
35 bar(0, b: 1);
36 bar(0, c: 1);
37 bar(0, b: 1, c: 2);
38 }
39 """,
40 """
41 function() {
42 V.foo(0, "b");
43 V.foo(0, 1);
44 V.bar(0, "b", "c");
45 V.bar(0, 1, "c");
46 V.bar(0, "b", 1);
47 V.bar(0, 1, 2);
48 return null;
49 }"""),
28 const TestEntry( 50 const TestEntry(
29 """ 51 """
30 foo(a) { 52 foo(a) {
31 return a; 53 return a;
32 } 54 }
33 main() { 55 main() {
34 var a = 10; 56 var a = 10;
35 var b = 1; 57 var b = 1;
36 var t; 58 var t;
37 t = a; 59 t = a;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 Expect.equals(test.expectation, getCodeForMain(compiler)); 117 Expect.equals(test.expectation, getCodeForMain(compiler));
96 } 118 }
97 }).catchError((e) { 119 }).catchError((e) {
98 print(e); 120 print(e);
99 Expect.fail('The following test failed to compile:\n' 121 Expect.fail('The following test failed to compile:\n'
100 '${formatTest(files)}'); 122 '${formatTest(files)}');
101 }); 123 });
102 }); 124 });
103 } 125 }
104 } 126 }
OLDNEW
« pkg/compiler/lib/src/universe/universe.dart ('K') | « pkg/compiler/lib/src/universe/universe.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698