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