742ba5c20d
We rely on the result of the `ConstantVisitor` to indicate whether we have an error or a valid constant value. This CL changes `evaluationResult` to be a `Constant` and changes error reporting to occur at a POE for evaluating a constant. Last few chunks of cleaning up the constant evaluator, woo! Change-Id: Icd41a4fcbab0626df36c6a83cd60ecbb59c2dcf0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324573 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Lasse Nielsen <lrn@google.com> Commit-Queue: Kallen Tu <kallentu@google.com>
27 lines
830 B
Dart
27 lines
830 B
Dart
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
// A dollar must be followed by a "{" or an identifier.
|
|
|
|
class A {
|
|
final String str;
|
|
const A(this.str);
|
|
}
|
|
|
|
class StringInterpolation1NegativeTest {
|
|
// Dollar not followed by "{" or identifier.
|
|
static const DOLLAR = const A("$");
|
|
// ^
|
|
// [analyzer] SYNTACTIC_ERROR.MISSING_IDENTIFIER
|
|
// [analyzer] COMPILE_TIME_ERROR.INVALID_CONSTANT
|
|
// [cfe] A '$' has special meaning inside a string, and must be followed by an identifier or an expression in curly braces ({}).
|
|
static testMain() {
|
|
print(DOLLAR);
|
|
}
|
|
}
|
|
|
|
main() {
|
|
StringInterpolation1NegativeTest.testMain();
|
|
}
|