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

Side by Side Diff: lib/compiler/implementation/emitter.dart

Issue 10535074: Add field getters and setters to the collection of getters and setters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed code in comments Created 8 years, 6 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 | lib/compiler/implementation/enqueue.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 /** 5 /**
6 * A function element that represents a closure call. The signature is copied 6 * A function element that represents a closure call. The signature is copied
7 * from the given element. 7 * from the given element.
8 */ 8 */
9 class ClosureInvocationElement extends FunctionElement { 9 class ClosureInvocationElement extends FunctionElement {
10 ClosureInvocationElement(SourceString name, 10 ClosureInvocationElement(SourceString name,
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 Set<Selector> selectors = compiler.codegenWorld.invokedNames[member.name]; 360 Set<Selector> selectors = compiler.codegenWorld.invokedNames[member.name];
361 if (selectors == null) return; 361 if (selectors == null) return;
362 for (Selector selector in selectors) { 362 for (Selector selector in selectors) {
363 if (!selector.applies(member, compiler)) continue; 363 if (!selector.applies(member, compiler)) continue;
364 addParameterStub(member, selector, defineInstanceMember); 364 addParameterStub(member, selector, defineInstanceMember);
365 } 365 }
366 } 366 }
367 367
368 bool instanceFieldNeedsGetter(Element member) { 368 bool instanceFieldNeedsGetter(Element member) {
369 assert(member.kind === ElementKind.FIELD); 369 assert(member.kind === ElementKind.FIELD);
370 return compiler.codegenWorld.hasGetter(member, compiler); 370 return compiler.codegenWorld.hasInvokedGetter(member, compiler);
371 } 371 }
372 372
373 bool instanceFieldNeedsSetter(Element member) { 373 bool instanceFieldNeedsSetter(Element member) {
374 assert(member.kind === ElementKind.FIELD); 374 assert(member.kind === ElementKind.FIELD);
375 return (member.modifiers === null || !member.modifiers.isFinal()) 375 return (member.modifiers === null || !member.modifiers.isFinal())
376 && compiler.codegenWorld.hasSetter(member, compiler); 376 && compiler.codegenWorld.hasInvokedSetter(member, compiler);
377 } 377 }
378 378
379 String compiledFieldName(Element member) { 379 String compiledFieldName(Element member) {
380 assert(member.kind === ElementKind.FIELD); 380 assert(member.kind === ElementKind.FIELD);
381 return member.isNative() 381 return member.isNative()
382 ? member.name.slowToString() 382 ? member.name.slowToString()
383 : namer.getName(member); 383 : namer.getName(member);
384 } 384 }
385 385
386 void addInstanceMember(Element member, 386 void addInstanceMember(Element member,
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 816
817 void emitExtraAccessors(Element member, 817 void emitExtraAccessors(Element member,
818 void defineInstanceMember(String invocationName, 818 void defineInstanceMember(String invocationName,
819 String definition)) { 819 String definition)) {
820 if (member.kind == ElementKind.GETTER || member.kind == ElementKind.FIELD) { 820 if (member.kind == ElementKind.GETTER || member.kind == ElementKind.FIELD) {
821 Set<Selector> selectors = compiler.codegenWorld.invokedNames[member.name]; 821 Set<Selector> selectors = compiler.codegenWorld.invokedNames[member.name];
822 if (selectors !== null && !selectors.isEmpty()) { 822 if (selectors !== null && !selectors.isEmpty()) {
823 emitCallStubForGetter(member, selectors, defineInstanceMember); 823 emitCallStubForGetter(member, selectors, defineInstanceMember);
824 } 824 }
825 } else if (member.kind == ElementKind.FUNCTION) { 825 } else if (member.kind == ElementKind.FUNCTION) {
826 if (compiler.codegenWorld.hasGetter(member, compiler)) { 826 if (compiler.codegenWorld.hasInvokedGetter(member, compiler)) {
827 emitDynamicFunctionGetter(member, defineInstanceMember); 827 emitDynamicFunctionGetter(member, defineInstanceMember);
828 } 828 }
829 } 829 }
830 } 830 }
831 831
832 void emitNoSuchMethodCalls(void defineInstanceMember(String invocationName, 832 void emitNoSuchMethodCalls(void defineInstanceMember(String invocationName,
833 String definition)) { 833 String definition)) {
834 // Do not generate no such method calls if there is no class. 834 // Do not generate no such method calls if there is no class.
835 if (compiler.codegenWorld.instantiatedClasses.isEmpty()) return; 835 if (compiler.codegenWorld.instantiatedClasses.isEmpty()) return;
836 836
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 mainBuffer.add('function init() {\n'); 1025 mainBuffer.add('function init() {\n');
1026 mainBuffer.add(' $isolateProperties = {};\n'); 1026 mainBuffer.add(' $isolateProperties = {};\n');
1027 addDefineClassAndFinishClassFunctionsIfNecessary(mainBuffer); 1027 addDefineClassAndFinishClassFunctionsIfNecessary(mainBuffer);
1028 emitFinishIsolateConstructor(mainBuffer); 1028 emitFinishIsolateConstructor(mainBuffer);
1029 mainBuffer.add('}\n'); 1029 mainBuffer.add('}\n');
1030 compiler.assembledCode = mainBuffer.toString(); 1030 compiler.assembledCode = mainBuffer.toString();
1031 }); 1031 });
1032 return compiler.assembledCode; 1032 return compiler.assembledCode;
1033 } 1033 }
1034 } 1034 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698