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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart

Issue 1183273004: Revert "Cleanup TypedSelector.appliesUnnamed" (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/types/type_mask.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 class ClassEmitter extends CodeEmitterHelper { 7 class ClassEmitter extends CodeEmitterHelper {
8 8
9 ClassStubGenerator get _stubGenerator => 9 ClassStubGenerator get _stubGenerator =>
10 new ClassStubGenerator(compiler, namer, backend); 10 new ClassStubGenerator(compiler, namer, backend);
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 } 475 }
476 476
477 bool fieldNeedsSetter(VariableElement field) { 477 bool fieldNeedsSetter(VariableElement field) {
478 assert(field.isField); 478 assert(field.isField);
479 if (fieldAccessNeverThrows(field)) return false; 479 if (fieldAccessNeverThrows(field)) return false;
480 return (!field.isFinal && !field.isConst) 480 return (!field.isFinal && !field.isConst)
481 && (backend.shouldRetainSetter(field) 481 && (backend.shouldRetainSetter(field)
482 || compiler.codegenWorld.hasInvokedSetter(field, compiler.world)); 482 || compiler.codegenWorld.hasInvokedSetter(field, compiler.world));
483 } 483 }
484 484
485 // We never access a field in a closure (a captured variable) without knowing
486 // that it is there. Therefore we don't need to use a getter (that will throw
487 // if the getter method is missing), but can always access the field directly.
485 static bool fieldAccessNeverThrows(VariableElement field) { 488 static bool fieldAccessNeverThrows(VariableElement field) {
486 return 489 return field is ClosureFieldElement;
487 // Exceptions for missing static and top level fields are generated at
488 // compile time.
489 field.isStatic || field.isTopLevel ||
490 // We never access a field in a closure (a captured variable) without
491 // knowing that it is there. Therefore we don't need to use a getter
492 // (that will throw if the getter method is missing), but can always
493 // access the field directly.
494 field is ClosureFieldElement;
495 } 490 }
496 491
497 bool canAvoidGeneratedCheckedSetter(VariableElement member) { 492 bool canAvoidGeneratedCheckedSetter(VariableElement member) {
498 // We never generate accessors for top-level/static fields. 493 // We never generate accessors for top-level/static fields.
499 if (!member.isInstanceMember) return true; 494 if (!member.isInstanceMember) return true;
500 DartType type = member.type; 495 DartType type = member.type;
501 return type.treatAsDynamic || (type.element == compiler.objectClass); 496 return type.treatAsDynamic || (type.element == compiler.objectClass);
502 } 497 }
503 498
504 void generateCheckedSetter(Element member, 499 void generateCheckedSetter(Element member,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 ? new Selector.getter(member.name, member.library) 555 ? new Selector.getter(member.name, member.library)
561 : new Selector.setter(member.name, member.library); 556 : new Selector.setter(member.name, member.library);
562 String reflectionName = emitter.getReflectionName(selector, name); 557 String reflectionName = emitter.getReflectionName(selector, name);
563 if (reflectionName != null) { 558 if (reflectionName != null) {
564 var reflectable = 559 var reflectable =
565 js(backend.isAccessibleByReflection(member) ? '1' : '0'); 560 js(backend.isAccessibleByReflection(member) ? '1' : '0');
566 builder.addProperty('+$reflectionName', reflectable); 561 builder.addProperty('+$reflectionName', reflectable);
567 } 562 }
568 } 563 }
569 } 564 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/types/type_mask.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698