| 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 | 587 |
| 588 /// Emits the prototype of the given class [cls]. | 588 /// Emits the prototype of the given class [cls]. |
| 589 /// | 589 /// |
| 590 /// The prototype is generated as object literal. Inheritance is ignored. | 590 /// The prototype is generated as object literal. Inheritance is ignored. |
| 591 /// | 591 /// |
| 592 /// The prototype also includes the `is-property` that every class must have. | 592 /// The prototype also includes the `is-property` that every class must have. |
| 593 // TODO(floitsch): we could avoid that property if we knew that it wasn't | 593 // TODO(floitsch): we could avoid that property if we knew that it wasn't |
| 594 // needed. | 594 // needed. |
| 595 js.Expression emitPrototype(Class cls) { | 595 js.Expression emitPrototype(Class cls) { |
| 596 Iterable<Method> methods = cls.methods; | 596 Iterable<Method> methods = cls.methods; |
| 597 Iterable<Method> checkedSetters = cls.checkedSetters; |
| 597 Iterable<Method> isChecks = cls.isChecks; | 598 Iterable<Method> isChecks = cls.isChecks; |
| 598 Iterable<Method> callStubs = cls.callStubs; | 599 Iterable<Method> callStubs = cls.callStubs; |
| 599 Iterable<Method> typeVariableReaderStubs = cls.typeVariableReaderStubs; | 600 Iterable<Method> typeVariableReaderStubs = cls.typeVariableReaderStubs; |
| 600 Iterable<Method> noSuchMethodStubs = cls.noSuchMethodStubs; | 601 Iterable<Method> noSuchMethodStubs = cls.noSuchMethodStubs; |
| 601 Iterable<Method> gettersSetters = generateGettersSetters(cls); | 602 Iterable<Method> gettersSetters = generateGettersSetters(cls); |
| 602 Iterable<Method> allMethods = | 603 Iterable<Method> allMethods = |
| 603 [methods, isChecks, callStubs, typeVariableReaderStubs, | 604 [methods, checkedSetters, isChecks, callStubs, typeVariableReaderStubs, |
| 604 noSuchMethodStubs, gettersSetters].expand((x) => x); | 605 noSuchMethodStubs, gettersSetters].expand((x) => x); |
| 605 | 606 |
| 606 List<js.Property> properties = <js.Property>[]; | 607 List<js.Property> properties = <js.Property>[]; |
| 607 | 608 |
| 608 if (cls.superclass == null) { | 609 if (cls.superclass == null) { |
| 609 properties.add(new js.Property(js.string("constructor"), | 610 properties.add(new js.Property(js.string("constructor"), |
| 610 classReference(cls))); | 611 classReference(cls))); |
| 611 properties.add(new js.Property(namer.operatorIs(cls.element), | 612 properties.add(new js.Property(namer.operatorIs(cls.element), |
| 612 js.number(1))); | 613 js.number(1))); |
| 613 } | 614 } |
| 614 | 615 |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 } | 1235 } |
| 1235 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);", | 1236 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);", |
| 1236 js.objectLiteral(interceptorsByTag))); | 1237 js.objectLiteral(interceptorsByTag))); |
| 1237 statements.add(js.js.statement("setOrUpdateLeafTags(#);", | 1238 statements.add(js.js.statement("setOrUpdateLeafTags(#);", |
| 1238 js.objectLiteral(leafTags))); | 1239 js.objectLiteral(leafTags))); |
| 1239 statements.add(subclassAssignment); | 1240 statements.add(subclassAssignment); |
| 1240 | 1241 |
| 1241 return new js.Block(statements); | 1242 return new js.Block(statements); |
| 1242 } | 1243 } |
| 1243 } | 1244 } |
| OLD | NEW |