Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: pkg/compiler/lib/src/parser/parser.dart

Issue 1512573002: Disallow const getters. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/const_getter_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/parser/parser.dart
diff --git a/pkg/compiler/lib/src/parser/parser.dart b/pkg/compiler/lib/src/parser/parser.dart
index 7adddb5f2cff272bf02554d1515d2f9287f52119..f6465022108db1ed6f9dd500be07f63b0ff2baef 100644
--- a/pkg/compiler/lib/src/parser/parser.dart
+++ b/pkg/compiler/lib/src/parser/parser.dart
@@ -931,6 +931,8 @@ class Parser {
Token name) {
Token externalModifier;
+ // TODO(johnniwinther): Move error reporting to resolution to give more
+ // specific error messages.
for (Token modifier in modifiers) {
if (externalModifier == null && optional('external', modifier)) {
externalModifier = modifier;
@@ -1306,6 +1308,8 @@ class Parser {
Token constModifier;
int modifierCount = 0;
int allowedModifierCount = 1;
+ // TODO(johnniwinther): Move error reporting to resolution to give more
+ // specific error messages.
for (Token modifier in modifiers) {
if (externalModifier == null && optional('external', modifier)) {
modifierCount++;
@@ -1337,6 +1341,11 @@ class Parser {
modifier, MessageKind.EXTRANEOUS_MODIFIER, {'modifier': modifier});
}
}
+ if (getOrSet != null && constModifier != null) {
+ listener.reportError(
+ constModifier, MessageKind.EXTRANEOUS_MODIFIER,
+ {'modifier': constModifier});
+ }
parseModifierList(modifiers);
if (type == null) {
@@ -1348,7 +1357,6 @@ class Parser {
if (optional('operator', name)) {
token = parseOperatorName(name);
if (staticModifier != null) {
- // TODO(ahe): Consider a more specific error message.
listener.reportError(
staticModifier, MessageKind.EXTRANEOUS_MODIFIER,
{'modifier': staticModifier});
« no previous file with comments | « no previous file | tests/language/const_getter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698