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

Unified Diff: pkg/compiler/lib/src/scanner/listener.dart

Issue 707463003: Support enums in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 1 month 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/compiler/lib/src/resolution/signatures.dart ('k') | pkg/compiler/lib/src/scanner/scannerlib.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/scanner/listener.dart
diff --git a/pkg/compiler/lib/src/scanner/listener.dart b/pkg/compiler/lib/src/scanner/listener.dart
index ac28f07686ba512decc8b5e05e7a326e24faa439..aa5224168ab42ed3ebf0579e1555306dfa4a1dc6 100644
--- a/pkg/compiler/lib/src/scanner/listener.dart
+++ b/pkg/compiler/lib/src/scanner/listener.dart
@@ -868,7 +868,12 @@ class ElementListener extends Listener {
void endEnum(Token enumKeyword, Token endBrace, int count) {
NodeList names = makeNodeList(count, enumKeyword.next.next, endBrace, ",");
Identifier name = popNode();
- pushNode(new Enum(enumKeyword, name, names));
+
+ int id = idGenerator();
+ Element enclosing = compilationUnitElement;
+ pushElement(new EnumClassElementX(name.source, enclosing, id,
+ new Enum(enumKeyword, name, names)));
+ rejectBuiltInIdentifier(name);
}
void endExport(Token exportKeyword, Token semicolon) {
@@ -1547,6 +1552,12 @@ class NodeListener extends ElementListener {
classKeyword, endToken));
}
+ void endEnum(Token enumKeyword, Token endBrace, int count) {
+ NodeList names = makeNodeList(count, enumKeyword.next.next, endBrace, ",");
+ Identifier name = popNode();
+ pushNode(new Enum(enumKeyword, name, names));
+ }
+
void endClassBody(int memberCount, Token beginToken, Token endToken) {
pushNode(makeNodeList(memberCount, beginToken, endToken, null));
}
« no previous file with comments | « pkg/compiler/lib/src/resolution/signatures.dart ('k') | pkg/compiler/lib/src/scanner/scannerlib.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698