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

Side by Side Diff: frog/leg/compiler.dart

Issue 9223012: Small changes to get code generation of getters and setters working. Resolution is not fully corr... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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
« no previous file with comments | « no previous file | frog/leg/emitter.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 WorkItem { 5 class WorkItem {
6 final Element element; 6 final Element element;
7 TreeElements resolutionTree; 7 TreeElements resolutionTree;
8 Function run; 8 Function run;
9 Map<int, BailoutInfo> bailouts = null; 9 Map<int, BailoutInfo> bailouts = null;
10 10
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // TODO(floitsch): find a more efficient way of doing this. 144 // TODO(floitsch): find a more efficient way of doing this.
145 // Run through the classes and see if we need to compile methods. 145 // Run through the classes and see if we need to compile methods.
146 for (ClassElement classElement in universe.instantiatedClasses) { 146 for (ClassElement classElement in universe.instantiatedClasses) {
147 for (ClassElement currentClass = classElement; 147 for (ClassElement currentClass = classElement;
148 currentClass !== null; 148 currentClass !== null;
149 currentClass = currentClass.superClass) { 149 currentClass = currentClass.superClass) {
150 // TODO(floitsch): we don't need to add members that have been 150 // TODO(floitsch): we don't need to add members that have been
151 // overwritten by subclasses. 151 // overwritten by subclasses.
152 for (Element member in currentClass.members) { 152 for (Element member in currentClass.members) {
153 SourceString name = member.name; 153 SourceString name = member.name;
154 if (Elements.isInstanceMethod(member) && 154 if (universe.generatedCode[member] !== null) continue;
155 universe.generatedCode[member] === null) { 155 if (!member.isInstanceMember()) continue;
156 if (member.kind == ElementKind.FUNCTION) {
156 FunctionElement element = member; 157 FunctionElement element = member;
157 Set<int> invocations = universe.invokedNames[name]; 158 Set<int> invocations = universe.invokedNames[name];
158 if (invocations != null 159 if (invocations != null
159 && invocations.contains(element.parameterCount(this))) { 160 && invocations.contains(element.parameterCount(this))) {
160 addToWorklist(member); 161 addToWorklist(member);
161 } 162 }
163 } else if (member.kind == ElementKind.GETTER) {
164 if (universe.invokedGetters.contains(name)) {
165 addToWorklist(member);
166 }
167 } else if (member.kind === ElementKind.SETTER) {
168 if (universe.invokedSetters.contains(name)) {
169 addToWorklist(member);
170 }
162 } 171 }
163 } 172 }
164 } 173 }
165 } 174 }
166 } 175 }
167 176
168 void runCompiler(Script script) { 177 void runCompiler(Script script) {
169 scanCoreLibrary(); 178 scanCoreLibrary();
170 currentElement = new CompilationUnitElement(script, currentLibrary); 179 currentElement = new CompilationUnitElement(script, currentLibrary);
171 scanner.scan(currentElement); 180 scanner.scan(currentElement);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 307
299 class CompilerCancelledException implements Exception { 308 class CompilerCancelledException implements Exception {
300 final String reason; 309 final String reason;
301 CompilerCancelledException(this.reason); 310 CompilerCancelledException(this.reason);
302 311
303 String toString() { 312 String toString() {
304 String banner = 'compiler cancelled'; 313 String banner = 'compiler cancelled';
305 return (reason !== null) ? '$banner: $reason' : '$banner'; 314 return (reason !== null) ? '$banner: $reason' : '$banner';
306 } 315 }
307 } 316 }
OLDNEW
« no previous file with comments | « no previous file | frog/leg/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698