提交 0f79a0cc 编写于 作者: A Alexander Aprelev 提交者: GitHub

Capture all aspects of messages from compiler (#4118)

* Capture all aspects of messages from compiler

* Make static
上级 82fb5595
......@@ -122,7 +122,18 @@ class _FrontendCompiler implements CompilerInterface {
..strongMode = false
..target = new FlutterTarget(new TargetFlags())
..onError = (CompilationMessage message) {
_outputStream.writeln("$message");
final StringBuffer outputMessage = new StringBuffer()
..write(_severityName(message.severity))
..write(': ');
if (message.span != null) {
outputMessage.writeln(message.span.message(message.message));
} else {
outputMessage.writeln(message.message);
}
if (message.tip != null) {
outputMessage.writeln(message.tip);
}
_outputStream.write(outputMessage);
};
Program program;
if (options['incremental']) {
......@@ -187,6 +198,21 @@ class _FrontendCompiler implements CompilerInterface {
path = '$path/';
return Uri.base.resolve(path);
}
static String _severityName(Severity severity) {
switch (severity) {
case Severity.error:
return "Error";
case Severity.internalProblem:
return "Internal problem";
case Severity.nit:
return "Nit";
case Severity.warning:
return "Warning";
default:
return severity.toString();
}
}
}
/// Entry point for this module, that creates `_FrontendCompiler` instance and
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册