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

Side by Side Diff: tests/compiler/dart2js_native/apply_test.dart

Issue 11021008: Added 'dynamic' keyword, so that 'Dynamic' can be deprecated. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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
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 // 4 //
5 // This test should move to a language test once the apply method 5 // This test should move to a language test once the apply method
6 // gets into the specification. 6 // gets into the specification.
7 7
8 apply(Function function, ArgumentDescriptor args) { 8 apply(Function function, ArgumentDescriptor args) {
9 int argumentCount = 0; 9 int argumentCount = 0;
10 StringBuffer buffer = new StringBuffer(); 10 StringBuffer buffer = new StringBuffer();
(...skipping 27 matching lines...) Expand all
38 throw new NoSuchMethodError(function, selectorName, arguments); 38 throw new NoSuchMethodError(function, selectorName, arguments);
39 } 39 }
40 // We bound 'this' to [function] because of how we compile 40 // We bound 'this' to [function] because of how we compile
41 // closures: escaped local variables are stored and accessed through 41 // closures: escaped local variables are stored and accessed through
42 // [function]. 42 // [function].
43 return JS('var', '#.apply(#, #)', jsFunction, function, arguments); 43 return JS('var', '#.apply(#, #)', jsFunction, function, arguments);
44 } 44 }
45 45
46 class ArgumentDescriptor { 46 class ArgumentDescriptor {
47 final List positionalArguments; 47 final List positionalArguments;
48 final Map<String, Dynamic> namedArguments; 48 final Map<String, dynamic> namedArguments;
49 49
50 ArgumentDescriptor(this.positionalArguments, this.namedArguments); 50 ArgumentDescriptor(this.positionalArguments, this.namedArguments);
51 } 51 }
52 52
53 void throwsNSME(function) { 53 void throwsNSME(function) {
54 Expect.throws(function, (e) => e is NoSuchMethodError); 54 Expect.throws(function, (e) => e is NoSuchMethodError);
55 } 55 }
56 56
57 main() { 57 main() {
58 var c1 = () => 'c1'; 58 var c1 = () => 'c1';
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 apply(c6, new ArgumentDescriptor([], {'a': 3, 'b': 4}))); 126 apply(c6, new ArgumentDescriptor([], {'a': 3, 'b': 4})));
127 Expect.equals('c6 4 3', 127 Expect.equals('c6 4 3',
128 apply(c6, new ArgumentDescriptor([], {'b': 3, 'a': 4}))); 128 apply(c6, new ArgumentDescriptor([], {'b': 3, 'a': 4})));
129 Expect.equals('c6 2 3', 129 Expect.equals('c6 2 3',
130 apply(c6, new ArgumentDescriptor([], {'b': 3}))); 130 apply(c6, new ArgumentDescriptor([], {'b': 3})));
131 throwsNSME(() => apply(c6, new ArgumentDescriptor([1], {'a': 1}))); 131 throwsNSME(() => apply(c6, new ArgumentDescriptor([1], {'a': 1})));
132 throwsNSME(() => apply(c6, new ArgumentDescriptor([1], {}))); 132 throwsNSME(() => apply(c6, new ArgumentDescriptor([1], {})));
133 throwsNSME(() => 133 throwsNSME(() =>
134 apply(c6, new ArgumentDescriptor([], {'a': 1, 'b': 2, 'c': 3}))); 134 apply(c6, new ArgumentDescriptor([], {'a': 1, 'b': 2, 'c': 3})));
135 } 135 }
OLDNEW
« tests/co19/co19-dart2js.status ('K') | « tests/compiler/dart2js/unparser2_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698