OLD | NEW |
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 // Regression test: this used to crash the VM. | 5 // Regression test: this used to crash the VM. |
6 | 6 |
7 library test.find_in_context_fake_function; | 7 library test.find_in_context_fake_function; |
8 | 8 |
9 import "dart:mirrors"; | 9 import "dart:mirrors"; |
10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
11 | 11 |
12 var topLevelField = 1; | 12 var topLevelField = 1; |
13 get topLevelGetter => 2; | 13 get topLevelGetter => 2; |
14 topLevelFunction() => 3; | 14 topLevelFunction() => 3; |
15 | 15 |
16 class FakeFunction1 { | 16 class FakeFunction1 { |
17 var field = 4; | 17 var field = 4; |
18 get getter => 5; | 18 get getter => 5; |
19 method() => 6; | 19 method() => 6; |
20 static var staticField = 7; | 20 static var staticField = 7; |
21 static get staticGetter => 8; | 21 static get staticGetter => 8; |
22 staticFunction() => 9; | 22 staticFunction() => 9; |
23 call(x) { | 23 call(x) { |
24 var local = x * 2; | 24 var local = x * 2; |
25 return local; | 25 return local; |
26 } | 26 } |
27 } | 27 } |
28 | 28 |
29 class FakeFunction2 implements Function { | 29 class FakeFunction2 |
| 30 implements Function /// static type warning |
| 31 { |
30 var field = 10; | 32 var field = 10; |
31 get getter => 11; | 33 get getter => 11; |
32 method() => 12; | 34 method() => 12; |
33 static var staticField = 13; | 35 static var staticField = 13; |
34 static get staticGetter => 14; | 36 static get staticGetter => 14; |
35 staticFunction() => 15; | 37 staticFunction() => 15; |
36 noSuchMethod(msg) { | 38 noSuchMethod(msg) { |
37 var local = msg.positionalArguments; | 39 var local = msg.positionalArguments; |
38 if (msg.memberName != #call) return super.noSuchMethod(msg); | 40 if (msg.memberName != #call) return super.noSuchMethod(msg); |
39 return local.join('+'); | 41 return local.join('+'); |
(...skipping 28 matching lines...) Expand all Loading... |
68 dontFindInContext(cm, #field); | 70 dontFindInContext(cm, #field); |
69 dontFindInContext(cm, #getter); | 71 dontFindInContext(cm, #getter); |
70 dontFindInContext(cm, #method); | 72 dontFindInContext(cm, #method); |
71 dontFindInContext(cm, #staticField); | 73 dontFindInContext(cm, #staticField); |
72 dontFindInContext(cm, #staticGetter); | 74 dontFindInContext(cm, #staticGetter); |
73 dontFindInContext(cm, #staticFunction); | 75 dontFindInContext(cm, #staticFunction); |
74 dontFindInContext(cm, #topLevelField); | 76 dontFindInContext(cm, #topLevelField); |
75 dontFindInContext(cm, #topLevelGetter); | 77 dontFindInContext(cm, #topLevelGetter); |
76 dontFindInContext(cm, #topLevelFunction); | 78 dontFindInContext(cm, #topLevelFunction); |
77 } | 79 } |
OLD | NEW |