OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 js_backend; | 5 part of js_backend; |
6 | 6 |
7 /** | 7 /** |
8 * A function element that represents a closure call. The signature is copied | 8 * A function element that represents a closure call. The signature is copied |
9 * from the given element. | 9 * from the given element. |
10 */ | 10 */ |
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 bool needsAccessor = (needsGetter || needsSetter); | 1488 bool needsAccessor = (needsGetter || needsSetter); |
1489 // We need to output the fields for non-native classes so we can auto- | 1489 // We need to output the fields for non-native classes so we can auto- |
1490 // generate the constructor. For native classes there are no | 1490 // generate the constructor. For native classes there are no |
1491 // constructors, so we don't need the fields unless we are generating | 1491 // constructors, so we don't need the fields unless we are generating |
1492 // accessors at runtime. | 1492 // accessors at runtime. |
1493 if (!classIsNative || needsAccessor) { | 1493 if (!classIsNative || needsAccessor) { |
1494 buffer.write(separator); | 1494 buffer.write(separator); |
1495 separator = ','; | 1495 separator = ','; |
1496 if (compiler.mirrorsEnabled) { | 1496 if (compiler.mirrorsEnabled) { |
1497 var metadata = buildMetadataFunction(member); | 1497 var metadata = buildMetadataFunction(member); |
1498 fieldMetadata.add(metadata); | |
1499 if (metadata != null) { | 1498 if (metadata != null) { |
1500 hasMetadata = true; | 1499 hasMetadata = true; |
| 1500 } else { |
| 1501 metadata = new jsAst.LiteralNull(); |
1501 } | 1502 } |
| 1503 fieldMetadata.add(metadata); |
1502 } | 1504 } |
1503 if (!needsAccessor) { | 1505 if (!needsAccessor) { |
1504 // Emit field for constructor generation. | 1506 // Emit field for constructor generation. |
1505 assert(!classIsNative); | 1507 assert(!classIsNative); |
1506 buffer.write(name); | 1508 buffer.write(name); |
1507 } else { | 1509 } else { |
1508 // Emit (possibly renaming) field name so we can add accessors at | 1510 // Emit (possibly renaming) field name so we can add accessors at |
1509 // runtime. | 1511 // runtime. |
1510 buffer.write(accessorName); | 1512 buffer.write(accessorName); |
1511 if (name != accessorName) { | 1513 if (name != accessorName) { |
(...skipping 1837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3349 | 3351 |
3350 const String HOOKS_API_USAGE = """ | 3352 const String HOOKS_API_USAGE = """ |
3351 // The code supports the following hooks: | 3353 // The code supports the following hooks: |
3352 // dartPrint(message) - if this function is defined it is called | 3354 // dartPrint(message) - if this function is defined it is called |
3353 // instead of the Dart [print] method. | 3355 // instead of the Dart [print] method. |
3354 // dartMainRunner(main) - if this function is defined, the Dart [main] | 3356 // dartMainRunner(main) - if this function is defined, the Dart [main] |
3355 // method will not be invoked directly. | 3357 // method will not be invoked directly. |
3356 // Instead, a closure that will invoke [main] is | 3358 // Instead, a closure that will invoke [main] is |
3357 // passed to [dartMainRunner]. | 3359 // passed to [dartMainRunner]. |
3358 """; | 3360 """; |
OLD | NEW |