| 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 * Documentation wanted -- johnniwinther | 9 * Documentation wanted -- johnniwinther |
| 10 * | 10 * |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 void emitClassBuilderWithReflectionData(String className, | 306 void emitClassBuilderWithReflectionData(String className, |
| 307 ClassElement classElement, | 307 ClassElement classElement, |
| 308 ClassBuilder classBuilder, | 308 ClassBuilder classBuilder, |
| 309 ClassBuilder enclosingBuilder) { | 309 ClassBuilder enclosingBuilder) { |
| 310 var metadata = task.metadataEmitter.buildMetadataFunction(classElement); | 310 var metadata = task.metadataEmitter.buildMetadataFunction(classElement); |
| 311 if (metadata != null) { | 311 if (metadata != null) { |
| 312 classBuilder.addProperty("@", metadata); | 312 classBuilder.addProperty("@", metadata); |
| 313 } | 313 } |
| 314 | 314 |
| 315 if (backend.isNeededForReflection(classElement)) { | 315 if (backend.isNeededForReflection(classElement)) { |
| 316 Link typeVars = classElement.typeVariables; | 316 List<DartType> typeVars = classElement.typeVariables; |
| 317 Iterable typeVariableProperties = task.typeVariableHandler | 317 Iterable typeVariableProperties = task.typeVariableHandler |
| 318 .typeVariablesOf(classElement).map(js.number); | 318 .typeVariablesOf(classElement).map(js.number); |
| 319 | 319 |
| 320 ClassElement superclass = classElement.superclass; | 320 ClassElement superclass = classElement.superclass; |
| 321 bool hasSuper = superclass != null; | 321 bool hasSuper = superclass != null; |
| 322 if ((!typeVariableProperties.isEmpty && !hasSuper) || | 322 if ((!typeVariableProperties.isEmpty && !hasSuper) || |
| 323 (hasSuper && superclass.typeVariables != typeVars)) { | 323 (hasSuper && !equalElements(superclass.typeVariables, typeVars))) { |
| 324 classBuilder.addProperty('<>', | 324 classBuilder.addProperty('<>', |
| 325 new jsAst.ArrayInitializer.from(typeVariableProperties)); | 325 new jsAst.ArrayInitializer.from(typeVariableProperties)); |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 | 328 |
| 329 List<jsAst.Property> statics = new List<jsAst.Property>(); | 329 List<jsAst.Property> statics = new List<jsAst.Property>(); |
| 330 ClassBuilder staticsBuilder = new ClassBuilder(namer); | 330 ClassBuilder staticsBuilder = new ClassBuilder(namer); |
| 331 if (emitFields(classElement, staticsBuilder, null, emitStatics: true)) { | 331 if (emitFields(classElement, staticsBuilder, null, emitStatics: true)) { |
| 332 statics.add(staticsBuilder.toObjectInitializer().properties.single); | 332 statics.add(staticsBuilder.toObjectInitializer().properties.single); |
| 333 } | 333 } |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 computeTypeVariable = | 609 computeTypeVariable = |
| 610 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); | 610 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); |
| 611 } | 611 } |
| 612 jsAst.Expression convertRtiToRuntimeType = | 612 jsAst.Expression convertRtiToRuntimeType = |
| 613 namer.elementAccess(backend.findHelper('convertRtiToRuntimeType')); | 613 namer.elementAccess(backend.findHelper('convertRtiToRuntimeType')); |
| 614 builder.addProperty(name, | 614 builder.addProperty(name, |
| 615 js('function () { return #(#) }', | 615 js('function () { return #(#) }', |
| 616 [convertRtiToRuntimeType, computeTypeVariable])); | 616 [convertRtiToRuntimeType, computeTypeVariable])); |
| 617 } | 617 } |
| 618 } | 618 } |
| OLD | NEW |