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

Side by Side Diff: lib/compiler/implementation/scanner/class_element_parser.dart

Issue 10990108: Handle modifiers (abstract) on class nodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class ClassElementParser extends PartialParser { 5 class ClassElementParser extends PartialParser {
6 ClassElementParser(Listener listener) : super(listener); 6 ClassElementParser(Listener listener) : super(listener);
7 7
8 Token parseClassBody(Token token) => fullParseClassBody(token); 8 Token parseClassBody(Token token) => fullParseClassBody(token);
9 } 9 }
10 10
11 class PartialClassElement extends ClassElement { 11 class PartialClassElement extends ClassElement {
12 final Token beginToken; 12 final Token beginToken;
13 final Token endToken; 13 final Token endToken;
14 Node cachedNode; 14 ClassNode cachedNode;
15 15
16 PartialClassElement(SourceString name, 16 PartialClassElement(SourceString name,
17 Token this.beginToken, 17 Token this.beginToken,
18 Token this.endToken, 18 Token this.endToken,
19 Element enclosing, 19 Element enclosing,
20 int id) 20 int id)
21 : super(name, enclosing, id, STATE_NOT_STARTED); 21 : super(name, enclosing, id, STATE_NOT_STARTED);
22 22
23 void set supertypeLoadState(int state) { 23 void set supertypeLoadState(int state) {
24 assert(state == supertypeLoadState + 1); 24 assert(state == supertypeLoadState + 1);
(...skipping 26 matching lines...) Expand all
51 Link<Element> patches = patch.localMembers; 51 Link<Element> patches = patch.localMembers;
52 compiler.applyContainerPatch(this, patches); 52 compiler.applyContainerPatch(this, patches);
53 } 53 }
54 }); 54 });
55 }); 55 });
56 return cachedNode; 56 return cachedNode;
57 } 57 }
58 58
59 Token position() => beginToken; 59 Token position() => beginToken;
60 60
61 Modifiers get modifiers() => cachedNode != null ? cachedNode.modifiers : null;
ahe 2012/10/09 12:47:35 It should be an error to call this method without
Johnni Winther 2012/10/09 14:04:57 Done.
62
61 bool isInterface() => beginToken.stringValue === "interface"; 63 bool isInterface() => beginToken.stringValue === "interface";
62 64
63 PartialClassElement cloneTo(Element enclosing, DiagnosticListener listener) { 65 PartialClassElement cloneTo(Element enclosing, DiagnosticListener listener) {
ahe 2012/10/09 12:47:35 What?
Johnni Winther 2012/10/09 14:04:57 Removed.
64 parseNode(listener); 66 parseNode(listener);
65 // TODO(lrn): Is copying id acceptable? 67 // TODO(lrn): Is copying id acceptable?
66 // TODO(ahe): No. 68 // TODO(ahe): No.
67 PartialClassElement result = 69 PartialClassElement result =
68 new PartialClassElement(name, beginToken, endToken, enclosing, id); 70 new PartialClassElement(name, beginToken, endToken, enclosing, id);
69 71
70 assert(this.supertypeLoadState == STATE_NOT_STARTED); 72 assert(this.supertypeLoadState == STATE_NOT_STARTED);
71 assert(this.resolutionState == STATE_NOT_STARTED); 73 assert(this.resolutionState == STATE_NOT_STARTED);
72 assert(this.type === null); 74 assert(this.type === null);
73 assert(this.supertype === null); 75 assert(this.supertype === null);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 195 }
194 196
195 void addMember(Element memberElement) { 197 void addMember(Element memberElement) {
196 for (Link link = metadata; !link.isEmpty(); link = link.tail) { 198 for (Link link = metadata; !link.isEmpty(); link = link.tail) {
197 memberElement.addMetadata(link.head); 199 memberElement.addMetadata(link.head);
198 } 200 }
199 metadata = const EmptyLink<MetadataAnnotation>(); 201 metadata = const EmptyLink<MetadataAnnotation>();
200 enclosingElement.addMember(memberElement, listener); 202 enclosingElement.addMember(memberElement, listener);
201 } 203 }
202 } 204 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/dart_backend/utils.dart ('k') | lib/compiler/implementation/scanner/listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698