| OLD | NEW |
| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 String accessorName, | 118 String accessorName, |
| 119 bool needsGetter, | 119 bool needsGetter, |
| 120 bool needsSetter, | 120 bool needsSetter, |
| 121 bool needsCheckedSetter) { | 121 bool needsCheckedSetter) { |
| 122 // Ignore needsCheckedSetter - that is handled below. | 122 // Ignore needsCheckedSetter - that is handled below. |
| 123 bool needsAccessor = (needsGetter || needsSetter); | 123 bool needsAccessor = (needsGetter || needsSetter); |
| 124 // We need to output the fields for non-native classes so we can auto- | 124 // We need to output the fields for non-native classes so we can auto- |
| 125 // generate the constructor. For native classes there are no | 125 // generate the constructor. For native classes there are no |
| 126 // constructors, so we don't need the fields unless we are generating | 126 // constructors, so we don't need the fields unless we are generating |
| 127 // accessors at runtime. | 127 // accessors at runtime. |
| 128 if (!classIsNative || needsAccessor) { | 128 bool needsFieldsForConstructor = !emitStatics && !classIsNative; |
| 129 if (needsFieldsForConstructor || needsAccessor) { |
| 129 var metadata = emitter.metadataEmitter.buildMetadataFunction(field); | 130 var metadata = emitter.metadataEmitter.buildMetadataFunction(field); |
| 130 if (metadata != null) { | 131 if (metadata != null) { |
| 131 hasMetadata = true; | 132 hasMetadata = true; |
| 132 } else { | 133 } else { |
| 133 metadata = new jsAst.LiteralNull(); | 134 metadata = new jsAst.LiteralNull(); |
| 134 } | 135 } |
| 135 fieldMetadata.add(metadata); | 136 fieldMetadata.add(metadata); |
| 136 recordMangledField(field, accessorName, | 137 recordMangledField(field, accessorName, |
| 137 namer.privateName(field.library, field.name)); | 138 namer.privateName(field.library, field.name)); |
| 138 String fieldName = name; | 139 String fieldName = name; |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); | 620 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); |
| 620 } | 621 } |
| 621 jsAst.Expression convertRtiToRuntimeType = emitter | 622 jsAst.Expression convertRtiToRuntimeType = emitter |
| 622 .staticFunctionAccess(backend.findHelper('convertRtiToRuntimeType')); | 623 .staticFunctionAccess(backend.findHelper('convertRtiToRuntimeType')); |
| 623 compiler.dumpInfoTask.registerElementAst(element, | 624 compiler.dumpInfoTask.registerElementAst(element, |
| 624 builder.addProperty(name, | 625 builder.addProperty(name, |
| 625 js('function () { return #(#) }', | 626 js('function () { return #(#) }', |
| 626 [convertRtiToRuntimeType, computeTypeVariable]))); | 627 [convertRtiToRuntimeType, computeTypeVariable]))); |
| 627 } | 628 } |
| 628 } | 629 } |
| OLD | NEW |