| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 void emitClassBuilderWithReflectionData(String className, | 294 void emitClassBuilderWithReflectionData(String className, |
| 295 ClassElement classElement, | 295 ClassElement classElement, |
| 296 ClassBuilder classBuilder, | 296 ClassBuilder classBuilder, |
| 297 ClassBuilder enclosingBuilder) { | 297 ClassBuilder enclosingBuilder) { |
| 298 var metadata = task.metadataEmitter.buildMetadataFunction(classElement); | 298 var metadata = task.metadataEmitter.buildMetadataFunction(classElement); |
| 299 if (metadata != null) { | 299 if (metadata != null) { |
| 300 classBuilder.addProperty("@", metadata); | 300 classBuilder.addProperty("@", metadata); |
| 301 } | 301 } |
| 302 | 302 |
| 303 if (backend.isNeededForReflection(classElement)) { | 303 if (backend.isNeededForReflection(classElement)) { |
| 304 Link typeVars = classElement.typeVariables; | 304 List<DartType> typeVars = classElement.typeVariables; |
| 305 Iterable typeVariableProperties = task.typeVariableHandler | 305 Iterable typeVariableProperties = task.typeVariableHandler |
| 306 .typeVariablesOf(classElement).map(js.toExpression); | 306 .typeVariablesOf(classElement).map(js.toExpression); |
| 307 | 307 |
| 308 ClassElement superclass = classElement.superclass; | 308 ClassElement superclass = classElement.superclass; |
| 309 bool hasSuper = superclass != null; | 309 bool hasSuper = superclass != null; |
| 310 if ((!typeVariableProperties.isEmpty && !hasSuper) || | 310 if ((!typeVariableProperties.isEmpty && !hasSuper) || |
| 311 (hasSuper && superclass.typeVariables != typeVars)) { | 311 (hasSuper && !equalElements(superclass.typeVariables, typeVars))) { |
| 312 classBuilder.addProperty('<>', | 312 classBuilder.addProperty('<>', |
| 313 new jsAst.ArrayInitializer.from(typeVariableProperties)); | 313 new jsAst.ArrayInitializer.from(typeVariableProperties)); |
| 314 } | 314 } |
| 315 } | 315 } |
| 316 | 316 |
| 317 List<jsAst.Property> statics = new List<jsAst.Property>(); | 317 List<jsAst.Property> statics = new List<jsAst.Property>(); |
| 318 ClassBuilder staticsBuilder = new ClassBuilder(namer); | 318 ClassBuilder staticsBuilder = new ClassBuilder(namer); |
| 319 if (emitFields(classElement, staticsBuilder, null, emitStatics: true)) { | 319 if (emitFields(classElement, staticsBuilder, null, emitStatics: true)) { |
| 320 statics.add(staticsBuilder.toObjectInitializer().properties.single); | 320 statics.add(staticsBuilder.toObjectInitializer().properties.single); |
| 321 } | 321 } |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 computeTypeVariable = | 595 computeTypeVariable = |
| 596 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); | 596 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); |
| 597 } | 597 } |
| 598 jsAst.Expression convertRtiToRuntimeType = | 598 jsAst.Expression convertRtiToRuntimeType = |
| 599 namer.elementAccess(compiler.findHelper('convertRtiToRuntimeType')); | 599 namer.elementAccess(compiler.findHelper('convertRtiToRuntimeType')); |
| 600 builder.addProperty( | 600 builder.addProperty( |
| 601 name, js.fun( | 601 name, js.fun( |
| 602 [], [js.return_(convertRtiToRuntimeType(computeTypeVariable))])); | 602 [], [js.return_(convertRtiToRuntimeType(computeTypeVariable))])); |
| 603 } | 603 } |
| 604 } | 604 } |
| OLD | NEW |