| 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> types = <int>[]; | 358 List<int> interfaces = <int>[]; |
| 359 if (classElement.supertype != null) { | 359 for (DartType interface in classElement.interfaces) { |
| 360 types.add( | 360 interfaces.add(task.metadataEmitter.reifyType(interface)); |
| 361 task.metadataEmitter.reifyType(classElement.supertype)); | |
| 362 } | 361 } |
| 363 for (DartType interface in classElement.interfaces) { | 362 buffer.write(',$n$n"+$reflectionName": $interfaces'); |
| 364 types.add(task.metadataEmitter.reifyType(interface)); | |
| 365 } | |
| 366 buffer.write(',$n$n"+$reflectionName": $types'); | |
| 367 } | 363 } |
| 368 } | 364 } |
| 369 } | 365 } |
| 370 | 366 |
| 371 /** | 367 /** |
| 372 * Calls [addField] for each of the fields of [element]. | 368 * Calls [addField] for each of the fields of [element]. |
| 373 * | 369 * |
| 374 * [element] must be a [ClassElement] or a [LibraryElement]. | 370 * [element] must be a [ClassElement] or a [LibraryElement]. |
| 375 * | 371 * |
| 376 * If [element] is a [ClassElement], the static fields of the class are | 372 * 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... |
| 604 ? new Selector.getter(member.name, member.getLibrary()) | 600 ? new Selector.getter(member.name, member.getLibrary()) |
| 605 : new Selector.setter(member.name, member.getLibrary()); | 601 : new Selector.setter(member.name, member.getLibrary()); |
| 606 String reflectionName = task.getReflectionName(selector, name); | 602 String reflectionName = task.getReflectionName(selector, name); |
| 607 if (reflectionName != null) { | 603 if (reflectionName != null) { |
| 608 var reflectable = | 604 var reflectable = |
| 609 js(backend.isAccessibleByReflection(member) ? '1' : '0'); | 605 js(backend.isAccessibleByReflection(member) ? '1' : '0'); |
| 610 builder.addProperty('+$reflectionName', reflectable); | 606 builder.addProperty('+$reflectionName', reflectable); |
| 611 } | 607 } |
| 612 } | 608 } |
| 613 } | 609 } |
| OLD | NEW |