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

Unified Diff: pkg/front_end/lib/src/scanner/token.dart

Issue 2800583002: move fasta.Keyword methods to analyzer.Keyword (Closed)
Patch Set: Created 3 years, 8 months 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 | « pkg/front_end/lib/src/fasta/scanner/keyword.dart ('k') | pkg/front_end/test/token_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/scanner/token.dart
diff --git a/pkg/front_end/lib/src/scanner/token.dart b/pkg/front_end/lib/src/scanner/token.dart
index fe79e5f2387a8e57efc10e7f687ee8925765bd8d..65b1d9217e54a5a9c0ef66d28c572561fd0c053a 100644
--- a/pkg/front_end/lib/src/scanner/token.dart
+++ b/pkg/front_end/lib/src/scanner/token.dart
@@ -308,21 +308,47 @@ abstract class Keyword {
*/
static final Map<String, Keyword> keywords = _createKeywordMap();
+ final fasta.PrecedenceInfo info;
+
/**
- * The name of the keyword type.
+ * A flag indicating whether the keyword is "built-in" identifier.
*/
- String get name;
+ final bool isBuiltIn;
+
+ /**
+ * A flag indicating whether the keyword can be used as an identifier
+ * in some situations.
+ */
+ final bool isPseudo;
/**
* The lexeme for the keyword.
*/
- String get syntax;
+ final String syntax;
+
+ /**
+ * Initialize a newly created keyword.
+ */
+ const Keyword(this.syntax,
+ {this.isBuiltIn: false,
+ this.isPseudo: false,
+ this.info: fasta.KEYWORD_INFO});
+
+ /**
+ * A flag indicating whether the keyword is "built-in" identifier.
+ * This method exists for backward compatibility and will be removed.
+ * Use [isBuiltIn] instead.
+ */
+ @deprecated
+ bool get isPseudoKeyword => isBuiltIn; // TODO (danrubel): remove this
/**
- * A flag indicating whether the keyword is a pseudo-keyword. Pseudo keywords
- * can be used as identifiers.
+ * The name of the keyword type.
*/
- bool get isPseudoKeyword;
+ String get name => syntax.toUpperCase();
+
+ @override
+ String toString() => name;
/**
* Create a table mapping the lexemes of keywords to the corresponding keyword
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/keyword.dart ('k') | pkg/front_end/test/token_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698