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

Unified Diff: runtime/observatory/tests/service/evaluate_activation_in_method_class_test.dart

Issue 1854243002: VM: Evaluate-in-frame should happen in the scope of the method class, not the receiver class. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/tests/service/evaluate_activation_in_method_class_test.dart
diff --git a/runtime/observatory/tests/service/evaluate_activation_in_method_class_test.dart b/runtime/observatory/tests/service/evaluate_activation_in_method_class_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..cfe43154d620438a0b9da841b6d32684b1ac022a
--- /dev/null
+++ b/runtime/observatory/tests/service/evaluate_activation_in_method_class_test.dart
@@ -0,0 +1,82 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// VMOptions=--error_on_bad_type --error_on_bad_override
+
+// Tests that expressions evaluated in a frame see the same scope as the
+// frame's method.
+
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+import 'test_helper.dart';
+import 'service_test_common.dart';
+
+import 'evaluate_activation_in_method_class_other.dart';
+
+var topLevel = "TestLibrary";
+
+class Subclass extends Superclass with Klass {
+ var _instVar = 'Subclass';
+ var instVar = 'Subclass';
+ method() => 'Subclass';
+ static staticMethod() => 'Subclass';
+}
+
+testeeDo() {
+ var obj = new Subclass();
+ obj.test();
+}
+
+testerDo(Isolate isolate) async {
+ await hasStoppedAtBreakpoint(isolate);
+
+ // Make sure we are in the right place.
+ var stack = await isolate.getStack();
+ var topFrame = 0;
+ expect(stack.type, equals('Stack'));
+ expect(stack['frames'][topFrame].function.name, equals('test'));
+ expect(stack['frames'][topFrame].function.dartOwner.name, equals('Superclass&Klass'));
+
+ var result;
+
+ result = await isolate.evalFrame(topFrame, '_local');
+ print(result);
+ expect(result.valueAsString, equals('Klass'));
+
+ result = await isolate.evalFrame(topFrame, '_instVar');
+ print(result);
+ expect(result.valueAsString, equals('Klass'));
+
+ result = await isolate.evalFrame(topFrame, 'instVar');
+ print(result);
+ expect(result.valueAsString, equals('Subclass'));
+
+ result = await isolate.evalFrame(topFrame, 'method()');
+ print(result);
+ expect(result.valueAsString, equals('Subclass'));
+
+ result = await isolate.evalFrame(topFrame, 'super._instVar');
+ print(result);
+ expect(result.valueAsString, equals('Superclass'));
+
+ result = await isolate.evalFrame(topFrame, 'super.instVar');
+ print(result);
+ expect(result.valueAsString, equals('Superclass'));
+
+ result = await isolate.evalFrame(topFrame, 'super.method()');
+ print(result);
+ expect(result.valueAsString, equals('Superclass'));
+
+ result = await isolate.evalFrame(topFrame, 'staticMethod()');
+ print(result);
+ expect(result.valueAsString, equals('Klass'));
+
+ // function.Owner verus function.Origin
+ // The mixin of Superclass is in _other.dart and the mixin
+ // application is in _test.dart.
+ result = await isolate.evalFrame(topFrame, 'topLevel');
+ print(result);
+ expect(result.valueAsString, equals('OtherLibrary'));
+}
+
+main(args) => runIsolateTests(args, [testerDo], testeeConcurrent:testeeDo);
« no previous file with comments | « runtime/observatory/tests/service/evaluate_activation_in_method_class_other.dart ('k') | runtime/vm/compiler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698