Unverified Commit ed2376a7 authored by Alexander Aprelev's avatar Alexander Aprelev Committed by GitHub

Fix library-scope expression evaluation. (#18851)

This also improves diagnostic in case of internal compiler errors.
parent e87b83bf
...@@ -116,12 +116,12 @@ class HotRunner extends ResidentRunner { ...@@ -116,12 +116,12 @@ class HotRunner extends ResidentRunner {
final CompilerOutput compilerOutput = final CompilerOutput compilerOutput =
await device.generator.compileExpression(expression, definitions, await device.generator.compileExpression(expression, definitions,
typeDefinitions, libraryUri, klass, isStatic); typeDefinitions, libraryUri, klass, isStatic);
if (compilerOutput.outputFilename != null) { if (compilerOutput != null && compilerOutput.outputFilename != null) {
return base64.encode(fs.file(compilerOutput.outputFilename).readAsBytesSync()); return base64.encode(fs.file(compilerOutput.outputFilename).readAsBytesSync());
} }
} }
} }
return null; throw 'Failed to compile $expression';
} }
Future<int> attach({ Future<int> attach({
......
...@@ -163,7 +163,7 @@ class VMService { ...@@ -163,7 +163,7 @@ class VMService {
final List<String> definitions = params['definitions'].asList; final List<String> definitions = params['definitions'].asList;
final List<String> typeDefinitions = params['typeDefinitions'].asList; final List<String> typeDefinitions = params['typeDefinitions'].asList;
final String libraryUri = params['libraryUri'].asString; final String libraryUri = params['libraryUri'].asString;
final String klass = params['klass'] != null ? params['klass'].asString : null; final String klass = params['klass'].exists ? params['klass'].asString : null;
final bool isStatic = params['isStatic'].asBoolOr(false); final bool isStatic = params['isStatic'].asBoolOr(false);
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment