Partial static mode changes for vm-service and tests (part 4).

Bug: https://github.com/dart-lang/sdk/issues/31587
Bug: https://github.com/dart-lang/sdk/issues/31696
Change-Id: I2b37ad97da0520db08f43981fdbc48b094942a0e
Reviewed-on: https://dart-review.googlesource.com/34306
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
This commit is contained in:
Ryan Macnak 2018-01-12 20:12:41 +00:00 committed by commit-bot@chromium.org
parent 87e5a57b9a
commit 9cf7d6fa93
22 changed files with 126 additions and 172 deletions

View file

@ -9,7 +9,7 @@ part of cli;
// line from the pieces. // line from the pieces.
List<String> _splitLine(String line) { List<String> _splitLine(String line) {
line = line.trimLeft(); line = line.trimLeft();
var args = []; var args = <String>[];
int pos = 0; int pos = 0;
while (pos < line.length) { while (pos < line.length) {
int startPos = pos; int startPos = pos;
@ -44,7 +44,7 @@ abstract class _CommandBase {
} }
// A command may optionally have sub-commands. // A command may optionally have sub-commands.
List<Command> _children = []; List<Command> _children = <Command>[];
_CommandBase _parent; _CommandBase _parent;
int get _depth => (_parent == null ? 0 : _parent._depth + 1); int get _depth => (_parent == null ? 0 : _parent._depth + 1);
@ -53,7 +53,8 @@ abstract class _CommandBase {
// //
// Given a list of arguments to this command, provide a list of // Given a list of arguments to this command, provide a list of
// possible completions for those arguments. // possible completions for those arguments.
Future<List<String>> complete(List<String> args) => new Future.value([]); Future<List<String>> complete(List<String> args) =>
new Future.value(<String>[]);
// Override in subclasses to provide command-specific execution. // Override in subclasses to provide command-specific execution.
Future run(List<String> args); Future run(List<String> args);
@ -77,12 +78,12 @@ abstract class _CommandBase {
// arguments. // arguments.
List<Command> _match(List<String> args, bool preferExact) { List<Command> _match(List<String> args, bool preferExact) {
if (args.isEmpty) { if (args.isEmpty) {
return []; return <Command>[];
} }
bool lastArg = (args.length == 1); bool lastArg = (args.length == 1);
var matches = _matchLocal(args[0], !lastArg || preferExact); var matches = _matchLocal(args[0], !lastArg || preferExact);
if (matches.isEmpty) { if (matches.isEmpty) {
return []; return <Command>[];
} else if (matches.length == 1) { } else if (matches.length == 1) {
var childMatches = matches[0]._match(args.sublist(1), preferExact); var childMatches = matches[0]._match(args.sublist(1), preferExact);
if (childMatches.isEmpty) { if (childMatches.isEmpty) {
@ -104,7 +105,7 @@ abstract class _CommandBase {
args[args.length - 1] == '') { args[args.length - 1] == '') {
// Special case allowance for an empty particle at the end of // Special case allowance for an empty particle at the end of
// the command. // the command.
completions = ['']; completions = <String>[''];
} }
var prefix = _concatArgs(args, _depth); var prefix = _concatArgs(args, _depth);
return completions.map((str) => '${prefix}${str}').toList(); return completions.map((str) => '${prefix}${str}').toList();
@ -134,7 +135,7 @@ class RootCommand extends _CommandBase {
var commands = _match(args, false); var commands = _match(args, false);
if (commands.isEmpty) { if (commands.isEmpty) {
// No matching commands. // No matching commands.
return new Future.value([]); return new Future.value(<String>[]);
} }
int matchLen = commands[0]._depth; int matchLen = commands[0]._depth;
if (matchLen < args.length) { if (matchLen < args.length) {
@ -147,7 +148,7 @@ class RootCommand extends _CommandBase {
} else { } else {
// An ambiguous prefix match leaves us nowhere. The user is // An ambiguous prefix match leaves us nowhere. The user is
// typing a bunch of stuff that we don't know how to complete. // typing a bunch of stuff that we don't know how to complete.
return new Future.value([]); return new Future.value(<String>[]);
} }
} }

View file

@ -458,6 +458,8 @@ abstract class ServiceObjectOwner extends ServiceObject {
abstract class Location implements M.Location { abstract class Location implements M.Location {
Script get script; Script get script;
int get tokenPos; int get tokenPos;
Future<int> getLine();
Future<int> getColumn();
} }
/// A [SourceLocation] represents a location or range in the source code. /// A [SourceLocation] represents a location or range in the source code.
@ -1362,7 +1364,7 @@ class Isolate extends ServiceObjectOwner implements M.Isolate {
static const kPossibleBreakpointsReport = 'PossibleBreakpoints'; static const kPossibleBreakpointsReport = 'PossibleBreakpoints';
static const kProfileReport = '_Profile'; static const kProfileReport = '_Profile';
Future<ServiceMap> getSourceReport(List<String> report_kinds, Future<ServiceObject> getSourceReport(List<String> report_kinds,
[Script script, int startPos, int endPos]) { [Script script, int startPos, int endPos]) {
var params = <String, dynamic>{'reports': report_kinds}; var params = <String, dynamic>{'reports': report_kinds};
if (script != null) { if (script != null) {
@ -2448,7 +2450,8 @@ class Library extends HeapObject implements M.Library {
functions.sort(ServiceObject.LexicalSortName); functions.sort(ServiceObject.LexicalSortName);
} }
Future<ServiceObject> evaluate(String expression, {Map scope}) { Future<ServiceObject> evaluate(String expression,
{Map<String, ServiceObject> scope}) {
return isolate.eval(this, expression, scope: scope); return isolate.eval(this, expression, scope: scope);
} }
@ -2626,7 +2629,8 @@ class Class extends HeapObject implements M.Class {
subclasses.sort(ServiceObject.LexicalSortName); subclasses.sort(ServiceObject.LexicalSortName);
} }
Future<ServiceObject> evaluate(String expression, {Map scope}) { Future<ServiceObject> evaluate(String expression,
{Map<String, ServiceObject> scope}) {
return isolate.eval(this, expression, scope: scope); return isolate.eval(this, expression, scope: scope);
} }
@ -2991,7 +2995,8 @@ class Instance extends HeapObject implements M.Instance {
return 'a ${clazz.name}'; return 'a ${clazz.name}';
} }
Future<ServiceObject> evaluate(String expression, {Map scope}) { Future<ServiceObject> evaluate(String expression,
{Map<String, ServiceObject> scope}) {
return isolate.eval(this, expression, scope: scope); return isolate.eval(this, expression, scope: scope);
} }
@ -3588,7 +3593,7 @@ class Script extends HeapObject implements M.Script {
library = map['library']; library = map['library'];
} }
void _parseTokenPosTable(List<List<int>> table) { void _parseTokenPosTable(List/*<List<int>>*/ table) {
if (table == null) { if (table == null) {
return; return;
} }
@ -4398,7 +4403,7 @@ class Code extends HeapObject implements M.Code {
} }
} }
void _processDescriptors(List<Map> descriptors) { void _processDescriptors(List/*<Map>*/ descriptors) {
for (Map descriptor in descriptors) { for (Map descriptor in descriptors) {
var pcOffset = int.parse(descriptor['pcOffset'], radix: 16); var pcOffset = int.parse(descriptor['pcOffset'], radix: 16);
var address = startAddress + pcOffset; var address = startAddress + pcOffset;
@ -4558,7 +4563,7 @@ class ServiceMetric extends ServiceObject implements M.Metric {
String toString() => "ServiceMetric($_id)"; String toString() => "ServiceMetric($_id)";
} }
Future<Null> printFrames(List<Frame> frames) async { Future<Null> printFrames(List/*<Frame>*/ frames) async {
for (int i = 0; i < frames.length; i++) { for (int i = 0; i < frames.length; i++) {
final Frame frame = frames[i]; final Frame frame = frames[i];
String frameText = await frame.toUserString(); String frameText = await frame.toUserString();

View file

@ -62,13 +62,15 @@ var tests = <IsolateTest>[
expect(await futureBpt2.location.getColumn(), equals(3)); expect(await futureBpt2.location.getColumn(), equals(3));
// The first breakpoint hits before value is modified. // The first breakpoint hits before value is modified.
expect((await rootLib.evaluate('value')).valueAsString, equals('0')); Instance result = await rootLib.evaluate('value');
expect(result.valueAsString, equals('0'));
isolate.resume(); isolate.resume();
await hasStoppedAtBreakpoint(isolate); await hasStoppedAtBreakpoint(isolate);
// The second breakpoint hits after value has been modified once. // The second breakpoint hits after value has been modified once.
expect((await rootLib.evaluate('value')).valueAsString, equals('1')); result = await rootLib.evaluate('value');
expect(result.valueAsString, equals('1'));
// Remove the breakpoints. // Remove the breakpoints.
expect( expect(

View file

@ -1,7 +1,7 @@
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a // 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. // BSD-style license that can be found in the LICENSE file.
// VMOptions=--compile_all --error_on_bad_type --error_on_bad_override // VMOptions=--error_on_bad_type --error_on_bad_override
import 'package:observatory/object_graph.dart'; import 'package:observatory/object_graph.dart';
import 'package:unittest/unittest.dart'; import 'package:unittest/unittest.dart';

View file

@ -4,24 +4,25 @@
// VMOptions=--error_on_bad_type --error_on_bad_override --verbose-debug // VMOptions=--error_on_bad_type --error_on_bad_override --verbose-debug
// VMOptions=--error_on_bad_type --error_on_bad_override --verbose-debug --stacktrace-every=55 --stress-async-stacks // VMOptions=--error_on_bad_type --error_on_bad_override --verbose-debug --stacktrace-every=55 --stress-async-stacks
import 'dart:async';
import 'package:observatory/service_io.dart'; import 'package:observatory/service_io.dart';
import 'package:unittest/unittest.dart'; import 'package:unittest/unittest.dart';
import 'test_helper.dart'; import 'test_helper.dart';
printSync() { printSync() {
print('sync'); // Line 11 print('sync'); // Line 12
} }
printAsync() async { printAsync() async {
print('async'); // Line 15 print('async'); // Line 16
} }
printAsyncStar() async* { printAsyncStar() async* {
print('async*'); // Line 19 print('async*'); // Line 20
} }
printSyncStar() sync* { printSyncStar() sync* {
print('sync*'); // Line 23 print('sync*'); // Line 24
} }
var testerReady = false; var testerReady = false;
@ -38,38 +39,38 @@ testeeDo() {
var stream = printAsyncStar(); var stream = printAsyncStar();
var iterator = printSyncStar(); var iterator = printSyncStar();
print('middle'); // Line 41 print('middle'); // Line 42
future.then((v) => print(v)); future.then((v) => print(v));
stream.toList(); stream.toList();
iterator.toList(); iterator.toList();
} }
testAsync(Isolate isolate) async { Future testAsync(Isolate isolate) async {
await isolate.rootLibrary.load(); await isolate.rootLibrary.load();
var script = isolate.rootLibrary.scripts[0]; var script = isolate.rootLibrary.scripts[0];
var bp1 = await isolate.addBreakpoint(script, 11); var bp1 = await isolate.addBreakpoint(script, 12);
expect(bp1, isNotNull); expect(bp1, isNotNull);
expect(bp1 is Breakpoint, isTrue); expect(bp1 is Breakpoint, isTrue);
var bp2 = await isolate.addBreakpoint(script, 15); var bp2 = await isolate.addBreakpoint(script, 16);
expect(bp2, isNotNull); expect(bp2, isNotNull);
expect(bp2 is Breakpoint, isTrue); expect(bp2 is Breakpoint, isTrue);
var bp3 = await isolate.addBreakpoint(script, 19); var bp3 = await isolate.addBreakpoint(script, 20);
expect(bp3, isNotNull); expect(bp3, isNotNull);
expect(bp3 is Breakpoint, isTrue); expect(bp3 is Breakpoint, isTrue);
var bp4 = await isolate.addBreakpoint(script, 23); var bp4 = await isolate.addBreakpoint(script, 24);
expect(bp4, isNotNull); expect(bp4, isNotNull);
expect(bp4 is Breakpoint, isTrue); expect(bp4 is Breakpoint, isTrue);
var bp5 = await isolate.addBreakpoint(script, 41); var bp5 = await isolate.addBreakpoint(script, 42);
print("BP5 - $bp5"); print("BP5 - $bp5");
expect(bp5, isNotNull); expect(bp5, isNotNull);
expect(bp5 is Breakpoint, isTrue); expect(bp5 is Breakpoint, isTrue);
var hits = []; var hits = [];
isolate.rootLibrary.evaluate('testerReady = true;').then((Instance result) { isolate.rootLibrary.evaluate('testerReady = true;').then((result) {
expect(result.valueAsString, equals('true')); expect((result as Instance).valueAsString, equals('true'));
}); });
var stream = await isolate.vm.getEventStream(VM.kDebugStream); var stream = await isolate.vm.getEventStream(VM.kDebugStream);

View file

@ -66,9 +66,9 @@ var tests = <IsolateTest>[
); );
// Observe that it failed. // Observe that it failed.
expect(response['success'], isFalse); expect(response['success'], isFalse);
List<Map<String, dynamic>> notices = response['details']['notices']; List/*<Map<String, dynamic>>*/ notices = response['details']['notices'];
expect(notices.length, equals(1)); expect(notices.length, equals(1));
Map<String, dynamic> reasonForCancelling = notices[0]; Map/*<String, dynamic>*/ reasonForCancelling = notices[0];
expect(reasonForCancelling['type'], equals('ReasonForCancelling')); expect(reasonForCancelling['type'], equals('ReasonForCancelling'));
expect(reasonForCancelling['message'], contains('library_isnt_here_man')); expect(reasonForCancelling['message'], contains('library_isnt_here_man'));

View file

@ -9,7 +9,7 @@ import 'package:unittest/unittest.dart';
void testBadWebSocket() { void testBadWebSocket() {
var vm = new WebSocketVM(new WebSocketVMTarget('ws://karatekid/ws')); var vm = new WebSocketVM(new WebSocketVMTarget('ws://karatekid/ws'));
vm.load().catchError(expectAsync((error) { vm.load().then<dynamic>((_) => null).catchError(expectAsync((error) {
expect(error, new isInstanceOf<NetworkRpcException>()); expect(error, new isInstanceOf<NetworkRpcException>());
})); }));
} }

View file

@ -1,7 +1,7 @@
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a // 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. // BSD-style license that can be found in the LICENSE file.
// VMOptions=--compile_all --error_on_bad_type --error_on_bad_override // VMOptions=--error_on_bad_type --error_on_bad_override
import 'dart:async'; import 'dart:async';
import 'dart:developer'; import 'dart:developer';

View file

@ -36,18 +36,18 @@ class TestCompleteCommand extends Command {
void testCommandComplete() { void testCommandComplete() {
RootCommand cmd = new RootCommand([ RootCommand cmd = new RootCommand([
new TestCommand(null, 'alpha', []), new TestCommand(null, 'alpha', <Command>[]),
new TestCommand(null, 'game', [ new TestCommand(null, 'game', <Command>[
new TestCommand(null, 'checkers', []), new TestCommand(null, 'checkers', <Command>[]),
new TestCommand(null, 'chess', []) new TestCommand(null, 'chess', <Command>[])
]), ]),
new TestCommand(null, 'gamera', [ new TestCommand(null, 'gamera', <Command>[
new TestCommand(null, 'london', []), new TestCommand(null, 'london', <Command>[]),
new TestCommand(null, 'tokyo', []), new TestCommand(null, 'tokyo', <Command>[]),
new TestCommand(null, 'topeka', []) new TestCommand(null, 'topeka', <Command>[])
]), ]),
new TestCompleteCommand( new TestCompleteCommand(
null, 'count', [new TestCommand(null, 'chocula', [])]) null, 'count', <Command>[new TestCommand(null, 'chocula', <Command>[])])
]); ]);
// Show all commands. // Show all commands.
@ -147,7 +147,8 @@ void testCommandComplete() {
void testCommandRunSimple() { void testCommandRunSimple() {
// Run a simple command. // Run a simple command.
StringBuffer out = new StringBuffer(); StringBuffer out = new StringBuffer();
RootCommand cmd = new RootCommand([new TestCommand(out, 'alpha', [])]); RootCommand cmd =
new RootCommand([new TestCommand(out, 'alpha', <Command>[])]);
// Full name dispatch works. Argument passing works. // Full name dispatch works. Argument passing works.
cmd.runCommand('alpha dog').then(expectAsync((_) { cmd.runCommand('alpha dog').then(expectAsync((_) {
@ -164,8 +165,10 @@ void testCommandRunSubcommand() {
// Run a simple command. // Run a simple command.
StringBuffer out = new StringBuffer(); StringBuffer out = new StringBuffer();
RootCommand cmd = new RootCommand([ RootCommand cmd = new RootCommand([
new TestCommand(out, 'alpha', new TestCommand(out, 'alpha', [
[new TestCommand(out, 'beta', []), new TestCommand(out, 'gamma', [])]) new TestCommand(out, 'beta', <Command>[]),
new TestCommand(out, 'gamma', <Command>[])
])
]); ]);
cmd.runCommand('a b').then(expectAsync((_) { cmd.runCommand('a b').then(expectAsync((_) {
@ -180,7 +183,8 @@ void testCommandRunSubcommand() {
void testCommandRunNotFound() { void testCommandRunNotFound() {
// Run a simple command. // Run a simple command.
StringBuffer out = new StringBuffer(); StringBuffer out = new StringBuffer();
RootCommand cmd = new RootCommand([new TestCommand(out, 'alpha', [])]); RootCommand cmd =
new RootCommand([new TestCommand(out, 'alpha', <Command>[])]);
cmd.runCommand('goose').catchError(expectAsync((e) { cmd.runCommand('goose').catchError(expectAsync((e) {
expect(e.toString(), equals("No such command: 'goose'")); expect(e.toString(), equals("No such command: 'goose'"));
@ -190,8 +194,10 @@ void testCommandRunNotFound() {
void testCommandRunAmbiguous() { void testCommandRunAmbiguous() {
// Run a simple command. // Run a simple command.
StringBuffer out = new StringBuffer(); StringBuffer out = new StringBuffer();
RootCommand cmd = new RootCommand( RootCommand cmd = new RootCommand([
[new TestCommand(out, 'alpha', []), new TestCommand(out, 'ankle', [])]); new TestCommand(out, 'alpha', <Command>[]),
new TestCommand(out, 'ankle', <Command>[])
]);
cmd.runCommand('a 55').catchError(expectAsync((e) { cmd.runCommand('a 55').catchError(expectAsync((e) {
expect(e.toString(), equals("Command 'a 55' is ambiguous: [alpha, ankle]")); expect(e.toString(), equals("Command 'a 55' is ambiguous: [alpha, ankle]"));
@ -205,10 +211,10 @@ void testCommandRunAmbiguous() {
void testCommandRunAlias() { void testCommandRunAlias() {
// Run a simple command. // Run a simple command.
StringBuffer out = new StringBuffer(); StringBuffer out = new StringBuffer();
var aliasCmd = new TestCommand(out, 'alpha', []); var aliasCmd = new TestCommand(out, 'alpha', <Command>[]);
aliasCmd.alias = 'a'; aliasCmd.alias = 'a';
RootCommand cmd = RootCommand cmd =
new RootCommand([aliasCmd, new TestCommand(out, 'ankle', [])]); new RootCommand([aliasCmd, new TestCommand(out, 'ankle', <Command>[])]);
cmd.runCommand('a 55').then(expectAsync((_) { cmd.runCommand('a 55').then(expectAsync((_) {
expect(out.toString(), equals('executing alpha([55])\n')); expect(out.toString(), equals('executing alpha([55])\n'));

View file

@ -156,7 +156,7 @@ main(args, msg) {
result = await vm.invokeRpcNoUpgrade('_spawnUri', { result = await vm.invokeRpcNoUpgrade('_spawnUri', {
'token': 'mySpawnToken1', 'token': 'mySpawnToken1',
'uri': '${fsUri}${filePaths[1]}', 'uri': '${fsUri}${filePaths[1]}',
'args': ['one', 'two', 'three'] 'args': <String>['one', 'two', 'three']
}); });
expect(result['type'], equals('Success')); expect(result['type'], equals('Success'));
spawnedIsolate = await completer.future; spawnedIsolate = await completer.future;

View file

@ -12,7 +12,7 @@ var tests = <IsolateTest>[
Class classLibrary = await root.clazz.load(); Class classLibrary = await root.clazz.load();
print(classLibrary); print(classLibrary);
var result = await classLibrary.evaluate('3 + 4'); dynamic result = await classLibrary.evaluate('3 + 4');
print(result); print(result);
expect(result is DartError, isTrue); expect(result is DartError, isTrue);
expect(result.message, contains('Cannot evaluate')); expect(result.message, contains('Cannot evaluate'));
@ -24,7 +24,7 @@ var tests = <IsolateTest>[
expect(result is DartError, isTrue); expect(result is DartError, isTrue);
expect(result.message, contains('Cannot evaluate')); expect(result.message, contains('Cannot evaluate'));
var someArray = await root.evaluate("new List(2)"); Instance someArray = await root.evaluate("new List(2)");
print(someArray); print(someArray);
expect(someArray is Instance, isTrue); expect(someArray is Instance, isTrue);
Class classArray = await someArray.clazz.load(); Class classArray = await someArray.clazz.load();

View file

@ -6,6 +6,7 @@
// Tests that expressions evaluated in a frame see the same scope as the // Tests that expressions evaluated in a frame see the same scope as the
// frame's method. // frame's method.
import 'dart:async';
import 'package:observatory/service_io.dart'; import 'package:observatory/service_io.dart';
import 'package:unittest/unittest.dart'; import 'package:unittest/unittest.dart';
import 'test_helper.dart'; import 'test_helper.dart';
@ -28,7 +29,7 @@ testeeDo() {
obj.test(); obj.test();
} }
testerDo(Isolate isolate) async { Future testerDo(Isolate isolate) async {
await hasStoppedAtBreakpoint(isolate); await hasStoppedAtBreakpoint(isolate);
// Make sure we are in the right place. // Make sure we are in the right place.
@ -39,7 +40,7 @@ testerDo(Isolate isolate) async {
expect(stack['frames'][topFrame].function.dartOwner.name, expect(stack['frames'][topFrame].function.dartOwner.name,
equals('Superclass&Klass')); equals('Superclass&Klass'));
var result; Instance result;
result = await isolate.evalFrame(topFrame, '_local'); result = await isolate.evalFrame(topFrame, '_local');
print(result); print(result);

View file

@ -7,6 +7,7 @@ import 'package:observatory/service_io.dart';
import 'package:unittest/unittest.dart'; import 'package:unittest/unittest.dart';
import 'test_helper.dart'; import 'test_helper.dart';
import 'dart:async';
import 'dart:math' as math; import 'dart:math' as math;
breakHere() {} breakHere() {}
@ -67,7 +68,7 @@ class C {
} }
} }
testMethod(Isolate isolate) async { Future testMethod(Isolate isolate) async {
// silence analyzer. // silence analyzer.
expect(math.sqrt(4), equals(2)); expect(math.sqrt(4), equals(2));
Library rootLib = await isolate.rootLibrary.load(); Library rootLib = await isolate.rootLibrary.load();
@ -118,7 +119,7 @@ testMethod(Isolate isolate) async {
expect(hitBreakpoint, isTrue); expect(hitBreakpoint, isTrue);
} }
testMethod2(Isolate isolate) async { Future testMethod2(Isolate isolate) async {
Library rootLib = await isolate.rootLibrary.load(); Library rootLib = await isolate.rootLibrary.load();
ServiceFunction function = ServiceFunction function =
rootLib.functions.singleWhere((f) => f.name == 'breakHere'); rootLib.functions.singleWhere((f) => f.name == 'breakHere');
@ -167,7 +168,7 @@ testMethod2(Isolate isolate) async {
expect(hitBreakpoint, isTrue); expect(hitBreakpoint, isTrue);
} }
testMethod3(Isolate isolate) async { Future testMethod3(Isolate isolate) async {
Library rootLib = await isolate.rootLibrary.load(); Library rootLib = await isolate.rootLibrary.load();
ServiceFunction function = ServiceFunction function =
rootLib.functions.singleWhere((f) => f.name == 'breakHere'); rootLib.functions.singleWhere((f) => f.name == 'breakHere');
@ -209,7 +210,7 @@ testMethod3(Isolate isolate) async {
} }
testMethod4(Isolate isolate) async { Future testMethod4(Isolate isolate) async {
Library rootLib = await isolate.rootLibrary.load(); Library rootLib = await isolate.rootLibrary.load();
ServiceFunction function = ServiceFunction function =
rootLib.functions.singleWhere((f) => f.name == 'breakHere'); rootLib.functions.singleWhere((f) => f.name == 'breakHere');

View file

@ -27,7 +27,7 @@ var tests = <IsolateTest>[
expect(stack.type, equals('Stack')); expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 16); expect(await stack['frames'][topFrame].location.getLine(), 16);
var result = await isolate.evalFrame(topFrame, "x"); Instance result = await isolate.evalFrame(topFrame, "x");
print(result); print(result);
expect(result.valueAsString, equals("3")); expect(result.valueAsString, equals("3"));
}, },
@ -40,7 +40,7 @@ var tests = <IsolateTest>[
expect(stack.type, equals('Stack')); expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 18); expect(await stack['frames'][topFrame].location.getLine(), 18);
var result = await isolate.evalFrame(topFrame, "z"); Instance result = await isolate.evalFrame(topFrame, "z");
print(result); print(result);
expect(result.valueAsString, equals("7")); expect(result.valueAsString, equals("7"));
}, },

View file

@ -31,7 +31,7 @@ var tests = <IsolateTest>[
expect(stack.type, equals('Stack')); expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 15); expect(await stack['frames'][topFrame].location.getLine(), 15);
var result = await isolate.evalFrame(topFrame, "x"); Instance result = await isolate.evalFrame(topFrame, "x");
print(result); print(result);
expect(result.valueAsString, equals("3")); expect(result.valueAsString, equals("3"));
}, },
@ -44,7 +44,7 @@ var tests = <IsolateTest>[
expect(stack.type, equals('Stack')); expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 18); expect(await stack['frames'][topFrame].location.getLine(), 18);
var result = await isolate.evalFrame(topFrame, "z"); Instance result = await isolate.evalFrame(topFrame, "z");
print(result); print(result);
expect(result.valueAsString, equals("7")); expect(result.valueAsString, equals("7"));
}, },

View file

@ -45,25 +45,26 @@ var tests = <IsolateTest>[
var thing2 = thing2Field.staticValue; var thing2 = thing2Field.staticValue;
print(thing2); print(thing2);
var result = await isolate Instance result = await isolate.evalFrame(0, "x + y + a + b",
.evalFrame(0, "x + y + a + b", scope: {"a": thing1, "b": thing2}); scope: <String, ServiceObject>{"a": thing1, "b": thing2});
print(result); print(result);
expect(result.valueAsString, equals('2033')); expect(result.valueAsString, equals('2033'));
result = await isolate result = await isolate.evalFrame(0, "local + a + b",
.evalFrame(0, "local + a + b", scope: {"a": thing1, "b": thing2}); scope: <String, ServiceObject>{"a": thing1, "b": thing2});
print(result); print(result);
expect(result.valueAsString, equals('2033')); expect(result.valueAsString, equals('2033'));
// Note the eval's scope is shadowing the locals' scope. // Note the eval's scope is shadowing the locals' scope.
result = result = await isolate.evalFrame(0, "x + y",
await isolate.evalFrame(0, "x + y", scope: {"x": thing1, "y": thing2}); scope: <String, ServiceObject>{"x": thing1, "y": thing2});
print(result); print(result);
expect(result.valueAsString, equals('7')); expect(result.valueAsString, equals('7'));
bool didThrow = false; bool didThrow = false;
try { try {
await lib.evaluate("x + y", scope: {"x": lib, "y": lib}); await lib.evaluate("x + y",
scope: <String, ServiceObject>{"x": lib, "y": lib});
} catch (e) { } catch (e) {
didThrow = true; didThrow = true;
expect(e.toString(), expect(e.toString(),
@ -73,8 +74,8 @@ var tests = <IsolateTest>[
didThrow = false; didThrow = false;
try { try {
result = result = await lib.evaluate("x + y",
await lib.evaluate("x + y", scope: {"not&an&identifier": thing1}); scope: <String, ServiceObject>{"not&an&identifier": thing1});
print(result); print(result);
} catch (e) { } catch (e) {
didThrow = true; didThrow = true;

View file

@ -31,7 +31,7 @@ var tests = <IsolateTest>[
expect(stack.type, equals('Stack')); expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 15); expect(await stack['frames'][topFrame].location.getLine(), 15);
var result = await isolate.evalFrame(topFrame, "x"); Instance result = await isolate.evalFrame(topFrame, "x");
print(result); print(result);
expect(result.valueAsString, equals("3")); expect(result.valueAsString, equals("3"));
}, },
@ -44,7 +44,7 @@ var tests = <IsolateTest>[
expect(stack.type, equals('Stack')); expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 18); expect(await stack['frames'][topFrame].location.getLine(), 18);
var result = await isolate.evalFrame(topFrame, "z"); Instance result = await isolate.evalFrame(topFrame, "z");
print(result); print(result);
expect(result.valueAsString, equals("7")); expect(result.valueAsString, equals("7"));
}, },

View file

@ -27,12 +27,14 @@ var tests = <IsolateTest>[
var thing2 = thing2Field.staticValue; var thing2 = thing2Field.staticValue;
print(thing2); print(thing2);
var result = await lib.evaluate("x + y", scope: {"x": thing1, "y": thing2}); Instance result = await lib.evaluate("x + y",
scope: <String, ServiceObject>{"x": thing1, "y": thing2});
expect(result.valueAsString, equals('7')); expect(result.valueAsString, equals('7'));
bool didThrow = false; bool didThrow = false;
try { try {
result = await lib.evaluate("x + y", scope: {"x": lib, "y": lib}); result = await lib.evaluate("x + y",
scope: <String, ServiceObject>{"x": lib, "y": lib});
print(result); print(result);
} catch (e) { } catch (e) {
didThrow = true; didThrow = true;
@ -43,8 +45,8 @@ var tests = <IsolateTest>[
didThrow = false; didThrow = false;
try { try {
result = result = await lib.evaluate("x + y",
await lib.evaluate("x + y", scope: {"not&an&identifier": thing1}); scope: <String, ServiceObject>{"not&an&identifier": thing1});
print(result); print(result);
} catch (e) { } catch (e) {
didThrow = true; didThrow = true;

View file

@ -5,28 +5,25 @@
# Kernel works slightly different. There are kernel specific versions. # Kernel works slightly different. There are kernel specific versions.
# These are the non-kernel specific versions so skip tests and allow errors. # These are the non-kernel specific versions so skip tests and allow errors.
[ $compiler == dartk ] [ $compiler == dartk ]
*_reload_*: Skip # no reload support for now
add_breakpoint_rpc_test: SkipByDesign # non-kernel specific version of add_breakpoint_rpc_kernel_test. add_breakpoint_rpc_test: SkipByDesign # non-kernel specific version of add_breakpoint_rpc_kernel_test.
address_mapper_test: CompileTimeError # These 3 tests fail with 'dart:vmservice_io': error: [...] native function 'VMServiceIO_Shutdown' (0 arguments) cannot be found because of '--compile_all'
address_mapper_test: Crash
async_generator_breakpoint_test: Skip # Issue 29158, Async debugging
async_single_step_out_test: RuntimeError # Issue 29158, Async debugging async_single_step_out_test: RuntimeError # Issue 29158, Async debugging
async_star_single_step_into_test: RuntimeError # Issue 29158, Async debugging async_star_single_step_into_test: RuntimeError # Issue 29158, Async debugging
async_star_step_out_test: RuntimeError # Issue 29158, Async debugging async_star_step_out_test: RuntimeError # Issue 29158, Async debugging
async_step_out_test: RuntimeError # Issue 29158, Async debugging async_step_out_test: RuntimeError # Issue 29158, Async debugging
awaiter_async_stack_contents_test: RuntimeError # Issue 29158, Async debugging awaiter_async_stack_contents_test: RuntimeError # Issue 29158, Async debugging
capture_stdio_test: CompileTimeError # These 3 tests fail with 'dart:vmservice_io': error: [...] native function 'VMServiceIO_Shutdown' (0 arguments) cannot be found because of '--compile_all' complex_reload_test: RuntimeError
capture_stdio_test: Crash
developer_extension_test: CompileTimeError developer_extension_test: CompileTimeError
eval_internal_class_test: Skip # no evaluation test for now eval_internal_class_test: RuntimeError
evaluate_*: Skip # no evaluation test for now evaluate_activation_in_method_class_test: RuntimeError
evaluate_activation_test/instance: RuntimeError
evaluate_activation_test/scope: RuntimeError
evaluate_in_sync_star_activation_test: RuntimeError
get_isolate_after_language_error_test: CompileTimeError get_isolate_after_language_error_test: CompileTimeError
isolate_lifecycle_test: Pass, RuntimeError # Inherited from service.status
library_dependency_test: CompileTimeError # Deferred loading kernel issue 28335. library_dependency_test: CompileTimeError # Deferred loading kernel issue 28335.
pause_on_unhandled_async_exceptions2_test: RuntimeError # --pause-isolates-on-unhandled-exceptions doesn't currently work. Issue #29056 pause_on_unhandled_async_exceptions2_test: RuntimeError # --pause-isolates-on-unhandled-exceptions doesn't currently work. Issue #29056
pause_on_unhandled_async_exceptions_test: RuntimeError # --pause-isolates-on-unhandled-exceptions doesn't currently work. Issue #29056 pause_on_unhandled_async_exceptions_test: RuntimeError # --pause-isolates-on-unhandled-exceptions doesn't currently work. Issue #29056
step_through_arithmetic_test: RuntimeError # probably constant evaluator pre-evaluating e.g. 1+2 step_through_arithmetic_test: RuntimeError # probably constant evaluator pre-evaluating e.g. 1+2
vm_restart_test: Crash unused_changes_in_last_reload_test: RuntimeError
[ $compiler == dartkp ] [ $compiler == dartkp ]
*: Skip # Non-kernel also skips precompiled mode. *: Skip # Non-kernel also skips precompiled mode.
@ -42,81 +39,10 @@ pause_idle_isolate_test: Skip # Flaky
[ $compiler == dartk && $mode == debug && $strong ] [ $compiler == dartk && $mode == debug && $strong ]
external_service_disappear_test: Crash # Issue 31587 external_service_disappear_test: Crash # Issue 31587
# Issue 31587
[ $compiler == dartk && $strong ] [ $compiler == dartk && $strong ]
add_breakpoint_rpc_kernel_test: CompileTimeError external_service_asynchronous_invocation_test: CompileTimeError # Issue 31696
async_next_test: RuntimeError external_service_disappear_test: CompileTimeError # Issue 31696
async_scope_test: RuntimeError external_service_notification_invocation_test: CompileTimeError # Issue 31696
async_single_step_exception_test: RuntimeError external_service_registration_test: CompileTimeError # Issue 31696
async_single_step_into_test: RuntimeError external_service_registration_via_notification_test: CompileTimeError # Issue 31696
awaiter_async_stack_contents_test: RuntimeError external_service_synchronous_invocation_test: CompileTimeError # Issue 31696
bad_web_socket_address_test: CompileTimeError
break_on_function_test: RuntimeError
breakpoint_in_parts_class_test: RuntimeError
breakpoint_two_args_checked_test: CompileTimeError
caching_test: RuntimeError
causal_async_stack_contents_test: RuntimeError
causal_async_stack_presence_test: RuntimeError
causal_async_star_stack_contents_test: RuntimeError
causal_async_star_stack_presence_test: RuntimeError
code_test: RuntimeError
command_test: CompileTimeError
debugger_location_second_test: RuntimeError
debugger_location_test: RuntimeError
debugging_inlined_finally_test: RuntimeError
debugging_test: RuntimeError
dev_fs_spawn_test: RuntimeError
external_service_asynchronous_invocation_test: CompileTimeError
external_service_disappear_test: CompileTimeError
external_service_notification_invocation_test: CompileTimeError
external_service_registration_test: CompileTimeError
external_service_registration_via_notification_test: CompileTimeError
external_service_synchronous_invocation_test: CompileTimeError
get_object_store_rpc_test: RuntimeError
get_stack_rpc_test: RuntimeError
issue_25465_test: CompileTimeError
issue_27238_test: RuntimeError
issue_27287_test: RuntimeError
local_variable_declaration_test: RuntimeError
mixin_break_test: RuntimeError
next_through_assign_call_test: RuntimeError
next_through_assign_int_test: RuntimeError
next_through_call_on_field_in_class_test: RuntimeError
next_through_call_on_field_test: RuntimeError
next_through_call_on_static_field_in_class_test: RuntimeError
next_through_catch_test: RuntimeError
next_through_closure_test: RuntimeError
next_through_create_list_and_map_test: RuntimeError
next_through_for_each_loop_test: RuntimeError
next_through_for_loop_with_break_and_continue_test: RuntimeError
next_through_function_expression_test: RuntimeError
next_through_implicit_call_test: RuntimeError
next_through_is_and_as_test: RuntimeError
next_through_multi_catch_test: RuntimeError
next_through_new_test: RuntimeError
next_through_operator_bracket_on_super_test: RuntimeError
next_through_operator_bracket_on_this_test: RuntimeError
next_through_operator_bracket_test: RuntimeError
next_through_simple_async_with_returns_test: RuntimeError
next_through_simple_linear_2_test: RuntimeError
next_through_simple_linear_test: RuntimeError
parameters_in_scope_at_entry_test: RuntimeError
positive_token_pos_test: RuntimeError
regress_28443_test: RuntimeError
rewind_optimized_out_test: RuntimeError
rewind_test: RuntimeError
set_library_debuggable_test: RuntimeError
steal_breakpoint_test: RuntimeError
step_into_async_no_await_test: RuntimeError
step_over_await_test: RuntimeError
step_through_arithmetic_test: RuntimeError
step_through_constructor_calls_test: RuntimeError
step_through_constructor_test: RuntimeError
step_through_function_2_test: RuntimeError
step_through_function_test: RuntimeError
step_through_getter_test: RuntimeError
step_through_property_get_test: RuntimeError
step_through_property_set_test: RuntimeError
step_through_setter_test: RuntimeError
step_through_switch_test: RuntimeError
step_through_switch_with_continue_test: RuntimeError

View file

@ -20,7 +20,7 @@ main(List args, SendPort replyPort) {
"""; """;
RawReceivePort receivePort; RawReceivePort receivePort;
receivePort = new RawReceivePort(expectAsync((int message) { receivePort = new RawReceivePort(expectAsync((message) {
expect(message, equals(42)); expect(message, equals(42));
receivePort.close(); receivePort.close();
})); }));

View file

@ -326,7 +326,6 @@ cc/Parser_AllocateVariables_NestedCapturedVar: Crash
cc/Parser_AllocateVariables_TwoChains: Crash cc/Parser_AllocateVariables_TwoChains: Crash
[ $compiler == dartk && $strong ] [ $compiler == dartk && $strong ]
dart/data_uri_spawn_test: CompileTimeError # Issue 31586
dart/optimized_stacktrace_line_and_column_test: CompileTimeError # Issue 31586 dart/optimized_stacktrace_line_and_column_test: CompileTimeError # Issue 31586
dart/optimized_stacktrace_line_test: CompileTimeError # Issue 31586 dart/optimized_stacktrace_line_test: CompileTimeError # Issue 31586

View file

@ -511,12 +511,21 @@ class VMService extends MessageRouter {
return encodeInvalidParamError(message, 'uri'); return encodeInvalidParamError(message, 'uri');
} }
var args = message.params['args']; var args = message.params['args'];
if (args != null && args is! List<String>) { var argsOfString = new List<String>();
return encodeInvalidParamError(message, 'args'); if (args != null) {
if (args is! List) {
return encodeInvalidParamError(message, 'args');
}
for (var arg in args) {
if (arg is! String) {
return encodeInvalidParamError(message, 'args');
}
argsOfString.add(arg);
}
} }
var msg = message.params['message']; var msg = message.params['message'];
Isolate.spawnUri(Uri.parse(uri), args, msg).then((isolate) { Isolate.spawnUri(Uri.parse(uri), argsOfString, msg).then((isolate) {
_spawnUriNotify(isolate.controlPort, token); _spawnUriNotify(isolate.controlPort, token);
}).catchError((e) { }).catchError((e) {
_spawnUriNotify(e.toString(), token); _spawnUriNotify(e.toString(), token);