| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 // VMOptions=--error_on_bad_type --error_on_bad_override |
| 5 |
| 6 // Tests that expressions evaluated in a frame see the same scope as the |
| 7 // frame's method. |
| 8 |
| 9 import 'package:observatory/service_io.dart'; |
| 10 import 'package:unittest/unittest.dart'; |
| 11 import 'test_helper.dart'; |
| 12 import 'service_test_common.dart'; |
| 13 |
| 14 import 'evaluate_activation_in_method_class_other.dart'; |
| 15 |
| 16 var topLevel = "TestLibrary"; |
| 17 |
| 18 class Subclass extends Superclass with Klass { |
| 19 var _instVar = 'Subclass'; |
| 20 var instVar = 'Subclass'; |
| 21 method() => 'Subclass'; |
| 22 static staticMethod() => 'Subclass'; |
| 23 } |
| 24 |
| 25 testeeDo() { |
| 26 var obj = new Subclass(); |
| 27 obj.test(); |
| 28 } |
| 29 |
| 30 testerDo(Isolate isolate) async { |
| 31 await hasStoppedAtBreakpoint(isolate); |
| 32 |
| 33 // Make sure we are in the right place. |
| 34 var stack = await isolate.getStack(); |
| 35 var topFrame = 0; |
| 36 expect(stack.type, equals('Stack')); |
| 37 expect(stack['frames'][topFrame].function.name, equals('test')); |
| 38 expect(stack['frames'][topFrame].function.dartOwner.name, equals('Superclass&K
lass')); |
| 39 |
| 40 var result; |
| 41 |
| 42 result = await isolate.evalFrame(topFrame, '_local'); |
| 43 print(result); |
| 44 expect(result.valueAsString, equals('Klass')); |
| 45 |
| 46 result = await isolate.evalFrame(topFrame, '_instVar'); |
| 47 print(result); |
| 48 expect(result.valueAsString, equals('Klass')); |
| 49 |
| 50 result = await isolate.evalFrame(topFrame, 'instVar'); |
| 51 print(result); |
| 52 expect(result.valueAsString, equals('Subclass')); |
| 53 |
| 54 result = await isolate.evalFrame(topFrame, 'method()'); |
| 55 print(result); |
| 56 expect(result.valueAsString, equals('Subclass')); |
| 57 |
| 58 result = await isolate.evalFrame(topFrame, 'super._instVar'); |
| 59 print(result); |
| 60 expect(result.valueAsString, equals('Superclass')); |
| 61 |
| 62 result = await isolate.evalFrame(topFrame, 'super.instVar'); |
| 63 print(result); |
| 64 expect(result.valueAsString, equals('Superclass')); |
| 65 |
| 66 result = await isolate.evalFrame(topFrame, 'super.method()'); |
| 67 print(result); |
| 68 expect(result.valueAsString, equals('Superclass')); |
| 69 |
| 70 result = await isolate.evalFrame(topFrame, 'staticMethod()'); |
| 71 print(result); |
| 72 expect(result.valueAsString, equals('Klass')); |
| 73 |
| 74 // function.Owner verus function.Origin |
| 75 // The mixin of Superclass is in _other.dart and the mixin |
| 76 // application is in _test.dart. |
| 77 result = await isolate.evalFrame(topFrame, 'topLevel'); |
| 78 print(result); |
| 79 expect(result.valueAsString, equals('OtherLibrary')); |
| 80 } |
| 81 |
| 82 main(args) => runIsolateTests(args, [testerDo], testeeConcurrent:testeeDo); |
| OLD | NEW |