Unverified Commit 9a51588d authored by Alexander Aprelev's avatar Alexander Aprelev Committed by GitHub

Suppress stdout compile diagnostic when compile expressions. (#18703)

* Suppress stdout compile diagnostic when compile expressions.

This fixes https://github.com/flutter/flutter/issues/18574.

* Use equal sign for default values
parent b327ac34
...@@ -35,6 +35,8 @@ class _StdoutHandler { ...@@ -35,6 +35,8 @@ class _StdoutHandler {
String boundaryKey; String boundaryKey;
Completer<CompilerOutput> compilerOutput; Completer<CompilerOutput> compilerOutput;
bool _suppressCompilerMessages;
void handler(String string) { void handler(String string) {
const String kResultPrefix = 'result '; const String kResultPrefix = 'result ';
if (boundaryKey == null) { if (boundaryKey == null) {
...@@ -51,15 +53,17 @@ class _StdoutHandler { ...@@ -51,15 +53,17 @@ class _StdoutHandler {
string.substring(boundaryKey.length + 1, spaceDelimiter), string.substring(boundaryKey.length + 1, spaceDelimiter),
int.parse(string.substring(spaceDelimiter + 1).trim()))); int.parse(string.substring(spaceDelimiter + 1).trim())));
} }
else else if (!_suppressCompilerMessages) {
consumer('compiler message: $string'); consumer('compiler message: $string');
}
} }
// This is needed to get ready to process next compilation result output, // This is needed to get ready to process next compilation result output,
// with its own boundary key and new completer. // with its own boundary key and new completer.
void reset() { void reset({bool suppressCompilerMessages = false}) {
boundaryKey = null; boundaryKey = null;
compilerOutput = new Completer<CompilerOutput>(); compilerOutput = new Completer<CompilerOutput>();
_suppressCompilerMessages = suppressCompilerMessages;
} }
} }
...@@ -394,7 +398,7 @@ class ResidentCompiler { ...@@ -394,7 +398,7 @@ class ResidentCompiler {
Future<CompilerOutput> _compileExpression( Future<CompilerOutput> _compileExpression(
_CompileExpressionRequest request) async { _CompileExpressionRequest request) async {
_stdoutHandler.reset(); _stdoutHandler.reset(suppressCompilerMessages: true);
// 'compile-expression' should be invoked after compiler has been started, // 'compile-expression' should be invoked after compiler has been started,
// program was compiled. // program was compiled.
......
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