mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:28:02 +00:00
[vm/kernel] Change "constants" kernel2kernel transformation to be able to recover from errors
Instead of simply throwing an exception when a compile-time error was discovered during constant evaluation, we report the error and continue transforming. This also collects a context, which can be used by error reporters to show users in which context an error occured. The reason for using an interface for reporting errors is to be able to report reasonable nice error messages, keep the transformation inside package:kernel and allow users of the transformation to possibly report nicer error message, e.g. by adding quotes of source positions (which will come in another CL). This makes it slightly verbose. Change-Id: I965cafc690dddb525b20368d03bb978e18a6ee58 Reviewed-on: https://dart-review.googlesource.com/52447 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This commit is contained in:
parent
690b4f793b
commit
4697e3c8f6
2 changed files with 520 additions and 185 deletions
File diff suppressed because it is too large
Load diff
|
@ -163,6 +163,13 @@ class DynamicSelectorsCollector extends RecursiveVisitor<Null> {
|
|||
return v;
|
||||
}
|
||||
|
||||
@override
|
||||
visitConstantExpression(ConstantExpression node) {
|
||||
// We run the kernel2kernel "constants" transformation before running the
|
||||
// this transformation, so we will encounter constant expressions.
|
||||
// We don't need to do anything here, because there are no invocations.
|
||||
}
|
||||
|
||||
@override
|
||||
visitMethodInvocation(MethodInvocation node) {
|
||||
super.visitMethodInvocation(node);
|
||||
|
|
Loading…
Reference in a new issue