| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 ClassElement classElement, | 288 ClassElement classElement, |
| 289 ClassBuilder builder, | 289 ClassBuilder builder, |
| 290 CodeBuffer buffer) { | 290 CodeBuffer buffer) { |
| 291 var metadata = task.metadataEmitter.buildMetadataFunction(classElement); | 291 var metadata = task.metadataEmitter.buildMetadataFunction(classElement); |
| 292 if (metadata != null) { | 292 if (metadata != null) { |
| 293 builder.addProperty("@", metadata); | 293 builder.addProperty("@", metadata); |
| 294 } | 294 } |
| 295 | 295 |
| 296 if (backend.isNeededForReflection(classElement)) { | 296 if (backend.isNeededForReflection(classElement)) { |
| 297 Link typeVars = classElement.typeVariables; | 297 Link typeVars = classElement.typeVariables; |
| 298 List properties = []; | 298 Iterable properties = []; |
| 299 if (task.typeVariableHandler.typeVariablesOf(classElement) != null) { | 299 if (task.typeVariableHandler.typeVariablesOf(classElement) != null) { |
| 300 properties = task.typeVariableHandler.typeVariablesOf(classElement) | 300 properties = task.typeVariableHandler.typeVariablesOf(classElement) |
| 301 .map(js.toExpression); | 301 .map(js.toExpression); |
| 302 } | 302 } |
| 303 | 303 |
| 304 ClassElement superclass = classElement.superclass; | 304 ClassElement superclass = classElement.superclass; |
| 305 bool hasSuper = superclass != null; | 305 bool hasSuper = superclass != null; |
| 306 if ((!properties.isEmpty && !hasSuper) || | 306 if ((!properties.isEmpty && !hasSuper) || |
| 307 (hasSuper && superclass.typeVariables != typeVars)) { | 307 (hasSuper && superclass.typeVariables != typeVars)) { |
| 308 builder.addProperty('<>', new jsAst.ArrayInitializer.from(properties)); | 308 builder.addProperty('<>', new jsAst.ArrayInitializer.from(properties)); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 ? new Selector.getter(member.name, member.getLibrary()) | 593 ? new Selector.getter(member.name, member.getLibrary()) |
| 594 : new Selector.setter(member.name, member.getLibrary()); | 594 : new Selector.setter(member.name, member.getLibrary()); |
| 595 String reflectionName = task.getReflectionName(selector, name); | 595 String reflectionName = task.getReflectionName(selector, name); |
| 596 if (reflectionName != null) { | 596 if (reflectionName != null) { |
| 597 var reflectable = | 597 var reflectable = |
| 598 js(backend.isAccessibleByReflection(member) ? '1' : '0'); | 598 js(backend.isAccessibleByReflection(member) ? '1' : '0'); |
| 599 builder.addProperty('+$reflectionName', reflectable); | 599 builder.addProperty('+$reflectionName', reflectable); |
| 600 } | 600 } |
| 601 } | 601 } |
| 602 } | 602 } |
| OLD | NEW |