| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 if (!buffer.isEmpty) { | 348 if (!buffer.isEmpty) { |
| 349 buffer.write(',$n$n'); | 349 buffer.write(',$n$n'); |
| 350 } | 350 } |
| 351 buffer.write('$className:$_'); | 351 buffer.write('$className:$_'); |
| 352 buffer.write(jsAst.prettyPrint(builder.toObjectInitializer(), compiler)); | 352 buffer.write(jsAst.prettyPrint(builder.toObjectInitializer(), compiler)); |
| 353 String reflectionName = task.getReflectionName(classElement, className); | 353 String reflectionName = task.getReflectionName(classElement, className); |
| 354 if (reflectionName != null) { | 354 if (reflectionName != null) { |
| 355 if (!backend.isNeededForReflection(classElement)) { | 355 if (!backend.isNeededForReflection(classElement)) { |
| 356 buffer.write(',$n$n"+$reflectionName": 0'); | 356 buffer.write(',$n$n"+$reflectionName": 0'); |
| 357 } else { | 357 } else { |
| 358 List<int> interfaces = <int>[]; | 358 List<int> types = <int>[]; |
| 359 if (classElement.supertype != null) { |
| 360 types.add( |
| 361 task.metadataEmitter.reifyType(classElement.supertype)); |
| 362 } |
| 359 for (DartType interface in classElement.interfaces) { | 363 for (DartType interface in classElement.interfaces) { |
| 360 interfaces.add(task.metadataEmitter.reifyType(interface)); | 364 types.add(task.metadataEmitter.reifyType(interface)); |
| 361 } | 365 } |
| 362 buffer.write(',$n$n"+$reflectionName": $interfaces'); | 366 buffer.write(',$n$n"+$reflectionName": $types'); |
| 363 } | 367 } |
| 364 } | 368 } |
| 365 } | 369 } |
| 366 | 370 |
| 367 /** | 371 /** |
| 368 * Calls [addField] for each of the fields of [element]. | 372 * Calls [addField] for each of the fields of [element]. |
| 369 * | 373 * |
| 370 * [element] must be a [ClassElement] or a [LibraryElement]. | 374 * [element] must be a [ClassElement] or a [LibraryElement]. |
| 371 * | 375 * |
| 372 * If [element] is a [ClassElement], the static fields of the class are | 376 * If [element] is a [ClassElement], the static fields of the class are |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 ? new Selector.getter(member.name, member.getLibrary()) | 604 ? new Selector.getter(member.name, member.getLibrary()) |
| 601 : new Selector.setter(member.name, member.getLibrary()); | 605 : new Selector.setter(member.name, member.getLibrary()); |
| 602 String reflectionName = task.getReflectionName(selector, name); | 606 String reflectionName = task.getReflectionName(selector, name); |
| 603 if (reflectionName != null) { | 607 if (reflectionName != null) { |
| 604 var reflectable = | 608 var reflectable = |
| 605 js(backend.isAccessibleByReflection(member) ? '1' : '0'); | 609 js(backend.isAccessibleByReflection(member) ? '1' : '0'); |
| 606 builder.addProperty('+$reflectionName', reflectable); | 610 builder.addProperty('+$reflectionName', reflectable); |
| 607 } | 611 } |
| 608 } | 612 } |
| 609 } | 613 } |
| OLD | NEW |