OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.startup_emitter.model_emitter; | 5 part of dart2js.js_emitter.startup_emitter.model_emitter; |
6 | 6 |
7 /// The name of the property that stores the tear-off getter on a static | 7 /// The name of the property that stores the tear-off getter on a static |
8 /// function. | 8 /// function. |
9 /// | 9 /// |
10 /// This property is only used when isolates are used. | 10 /// This property is only used when isolates are used. |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 js.Name name = cls.name; | 648 js.Name name = cls.name; |
649 // If the class is not directly instantiated we only need it for inheritance | 649 // If the class is not directly instantiated we only need it for inheritance |
650 // or RTI. In either case we don't need its fields. | 650 // or RTI. In either case we don't need its fields. |
651 if (cls.isNative || !cls.isDirectlyInstantiated) { | 651 if (cls.isNative || !cls.isDirectlyInstantiated) { |
652 return js.js('function #() { }', name); | 652 return js.js('function #() { }', name); |
653 } | 653 } |
654 | 654 |
655 List<js.Name> fieldNames = | 655 List<js.Name> fieldNames = |
656 cls.fields.map((Field field) => field.name).toList(); | 656 cls.fields.map((Field field) => field.name).toList(); |
657 if (cls.hasRtiField) { | 657 if (cls.hasRtiField) { |
658 fieldNames.add(namer.rtiFieldName); | 658 fieldNames.add(namer.rtiFieldJsName); |
659 } | 659 } |
660 | 660 |
661 Iterable<js.Name> assignments = fieldNames.map((js.Name field) { | 661 Iterable<js.Name> assignments = fieldNames.map((js.Name field) { |
662 return js.js("this.#field = #field", {"field": field}); | 662 return js.js("this.#field = #field", {"field": field}); |
663 }); | 663 }); |
664 | 664 |
665 // TODO(sra): Cache 'this' in a one-character local for 4 or more uses of | 665 // TODO(sra): Cache 'this' in a one-character local for 4 or more uses of |
666 // 'this'. i.e. "var _=this;_.a=a;_.b=b;..." | 666 // 'this'. i.e. "var _=this;_.a=a;_.b=b;..." |
667 | 667 |
668 // TODO(sra): Separate field and field initializer parameter names so the | 668 // TODO(sra): Separate field and field initializer parameter names so the |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 } | 1385 } |
1386 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);", | 1386 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);", |
1387 js.objectLiteral(interceptorsByTag))); | 1387 js.objectLiteral(interceptorsByTag))); |
1388 statements.add( | 1388 statements.add( |
1389 js.js.statement("setOrUpdateLeafTags(#);", js.objectLiteral(leafTags))); | 1389 js.js.statement("setOrUpdateLeafTags(#);", js.objectLiteral(leafTags))); |
1390 statements.addAll(subclassAssignments); | 1390 statements.addAll(subclassAssignments); |
1391 | 1391 |
1392 return new js.Block(statements); | 1392 return new js.Block(statements); |
1393 } | 1393 } |
1394 } | 1394 } |
OLD | NEW |