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

Side by Side Diff: tests/language/call_with_no_such_method_test.dart

Issue 43073002: Fix Function.apply() + call() + noSuchMethod() in dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « sdk/lib/_internal/lib/js_helper.dart ('k') | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Test that dart2js type inferrer detects dead code.
6
7 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
8 6
9 class A { 7 class F {
10 var field; 8 call() => null;
11 A(test) { 9 noSuchMethod(Invocation i) {
12 if (test) { 10 if (i.memberName == #call && i.isMethod) {
13 return; 11 return i.positionalArguments[0];
14 field = 42;
15 } else {
16 field = 54;
17 } 12 }
13 return super.noSuchMethod(i);
18 } 14 }
19 } 15 }
20 16
21 main() { 17 main() {
22 var a = new A(true); 18 var result = Function.apply(new F(), ['a', 'b', 'c', 'd']);
23 Expect.throws(() => a.field + 42, (e) => e is NoSuchMethodError); 19 Expect.equals('a', result);
24 } 20 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/lib/js_helper.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698