Skip to content

Commit

Permalink
[vm/kernel] Handle InvalidExpression in constant contexts
Browse files Browse the repository at this point in the history
It might occur there when CFE starts performing constant evaluation.

Change-Id: I635b8f855f0128a4c1decb1417e310ab91b276ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108780
Auto-Submit: Vyacheslav Egorov <[email protected]>
Reviewed-by: Martin Kustermann <[email protected]>
Commit-Queue: Vyacheslav Egorov <[email protected]>
  • Loading branch information
mraleph authored and [email protected] committed Jul 11, 2019
1 parent 0c9abb8 commit f521f38
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions runtime/vm/compiler/frontend/constant_evaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@ RawInstance* ConstantEvaluator::EvaluateExpression(intptr_t offset,
case kDeprecated_ConstantExpression:
result_ = EvaluateConstantExpression(helper_->ReadUInt());
break;
case kInvalidExpression: {
helper_->ReadPosition(); // Skip position.
const String& message = H.DartString(helper_->ReadStringReference());
// Invalid expression message has pointer to the source code, no need to
// report it twice.
H.ReportError(helper_->script(), TokenPosition::kNoSource, "%s",
message.ToCString());
break;
}
default:
H.ReportError(
script_, TokenPosition::kNoSource,
Expand Down

0 comments on commit f521f38

Please sign in to comment.