Chromium Code Reviews| 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 511 'lazyStatics': emitLazilyInitializedStatics(fragment), | 511 'lazyStatics': emitLazilyInitializedStatics(fragment), |
| 512 'types': deferredTypes, | 512 'types': deferredTypes, |
| 513 // TODO(floitsch): only call emitNativeSupport if we need native. | 513 // TODO(floitsch): only call emitNativeSupport if we need native. |
| 514 'nativeSupport': emitNativeSupport(fragment), | 514 'nativeSupport': emitNativeSupport(fragment), |
| 515 }); | 515 }); |
| 516 } | 516 } |
| 517 | 517 |
| 518 js.Statement emitDeferredInitializerGlobal(Map loadMap) { | 518 js.Statement emitDeferredInitializerGlobal(Map loadMap) { |
| 519 if (loadMap.isEmpty) return new js.Block.empty(); | 519 if (loadMap.isEmpty) return new js.Block.empty(); |
| 520 | 520 |
| 521 return js.js.statement(""" | 521 String global = ModelEmitter.deferredInitializersGlobal; |
| 522 if (typeof(${ModelEmitter.deferredInitializersGlobal}) === 'undefined') | 522 return js.js.statement( |
| 523 var ${ModelEmitter.deferredInitializersGlobal} = Object.create(null);"""); | 523 "if (typeof($global) === 'undefined') var # = Object.create(null);", |
| 524 new js.VariableDeclaration(global, allowRename: false)); | |
|
floitsch
2015/08/04 15:06:38
It worked before, but since this variable is share
| |
| 524 } | 525 } |
| 525 | 526 |
| 526 /// Emits all holders, except for the static-state holder. | 527 /// Emits all holders, except for the static-state holder. |
| 527 /// | 528 /// |
| 528 /// The emitted holders contain classes (only the constructors) and all | 529 /// The emitted holders contain classes (only the constructors) and all |
| 529 /// static functions. | 530 /// static functions. |
| 530 js.Statement emitHolders(List<Holder> holders, Fragment fragment) { | 531 js.Statement emitHolders(List<Holder> holders, Fragment fragment) { |
| 531 // Skip the static-state holder in this function. | 532 // Skip the static-state holder in this function. |
| 532 holders = holders | 533 holders = holders |
| 533 .where((Holder holder) => !holder.isStaticStateHolder) | 534 .where((Holder holder) => !holder.isStaticStateHolder) |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1297 } | 1298 } |
| 1298 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);", | 1299 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);", |
| 1299 js.objectLiteral(interceptorsByTag))); | 1300 js.objectLiteral(interceptorsByTag))); |
| 1300 statements.add(js.js.statement("setOrUpdateLeafTags(#);", | 1301 statements.add(js.js.statement("setOrUpdateLeafTags(#);", |
| 1301 js.objectLiteral(leafTags))); | 1302 js.objectLiteral(leafTags))); |
| 1302 statements.add(subclassAssignment); | 1303 statements.add(subclassAssignment); |
| 1303 | 1304 |
| 1304 return new js.Block(statements); | 1305 return new js.Block(statements); |
| 1305 } | 1306 } |
| 1306 } | 1307 } |
| OLD | NEW |