| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.program_builder; | 5 part of dart2js.js_emitter.program_builder; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * [member] is a field (instance, static, or top level). | 8 * [member] is a field (instance, static, or top level). |
| 9 * | 9 * |
| 10 * [name] is the field name that the [Namer] has picked for this field's | 10 * [name] is the field name that the [Namer] has picked for this field's |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 isNativeClass = _nativeData.isNativeClass(cls); | 72 isNativeClass = _nativeData.isNativeClass(cls); |
| 73 | 73 |
| 74 // If the class is never instantiated we still need to set it up for | 74 // If the class is never instantiated we still need to set it up for |
| 75 // inheritance purposes, but we can simplify its JavaScript constructor. | 75 // inheritance purposes, but we can simplify its JavaScript constructor. |
| 76 isInstantiated = | 76 isInstantiated = |
| 77 _codegenWorldBuilder.directlyInstantiatedClasses.contains(cls); | 77 _codegenWorldBuilder.directlyInstantiatedClasses.contains(cls); |
| 78 } else if (library != null) { | 78 } else if (library != null) { |
| 79 isLibrary = true; | 79 isLibrary = true; |
| 80 assert(visitStatics, failedAt(library)); | 80 assert(visitStatics, failedAt(library)); |
| 81 } else { | 81 } else { |
| 82 throw new SpannableAssertionFailure(NO_LOCATION_SPANNABLE, | 82 failedAt(NO_LOCATION_SPANNABLE, |
| 83 'Expected a ClassElement or a LibraryElement.'); | 83 'Expected a ClassElement or a LibraryElement.'); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void visitField(FieldEntity field, {ClassEntity holder}) { | 86 void visitField(FieldEntity field, {ClassEntity holder}) { |
| 87 assert(!(field is FieldElement && !field.isDeclaration), failedAt(field)); | 87 assert(!(field is FieldElement && !field.isDeclaration), failedAt(field)); |
| 88 | 88 |
| 89 bool isMixinNativeField = | 89 bool isMixinNativeField = |
| 90 isNativeClass && _elementEnvironment.isMixinApplication(holder); | 90 isNativeClass && _elementEnvironment.isMixinApplication(holder); |
| 91 | 91 |
| 92 // See if we can dynamically create getters and setters. | 92 // See if we can dynamically create getters and setters. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 field is ClosureFieldElement; | 175 field is ClosureFieldElement; |
| 176 } | 176 } |
| 177 | 177 |
| 178 bool canAvoidGeneratedCheckedSetter(FieldElement member) { | 178 bool canAvoidGeneratedCheckedSetter(FieldElement member) { |
| 179 // We never generate accessors for top-level/static fields. | 179 // We never generate accessors for top-level/static fields. |
| 180 if (!member.isInstanceMember) return true; | 180 if (!member.isInstanceMember) return true; |
| 181 ResolutionDartType type = member.type; | 181 ResolutionDartType type = member.type; |
| 182 return type.treatAsDynamic || type.isObject; | 182 return type.treatAsDynamic || type.isObject; |
| 183 } | 183 } |
| 184 } | 184 } |
| OLD | NEW |