| 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 dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 class NativeEmitter { | 7 class NativeEmitter { |
| 8 | 8 |
| 9 final Map<Element, ClassBuilder> cachedBuilders; | 9 final Map<Element, ClassBuilder> cachedBuilders; |
| 10 | 10 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| 240 // Emit the native class interceptors that were actually used. | 240 // Emit the native class interceptors that were actually used. |
| 241 for (Class cls in classes) { | 241 for (Class cls in classes) { |
| 242 assert(!cls.onlyForRti); | 242 assert(!cls.onlyForRti); |
| 243 ClassElement classElement = cls.element; | 243 ClassElement classElement = cls.element; |
| 244 if (!cls.isNative) continue; | 244 if (!cls.isNative) continue; |
| 245 if (neededClasses.contains(cls)) { | 245 if (neededClasses.contains(cls)) { |
| 246 ClassBuilder builder = builders[classElement]; | 246 ClassBuilder builder = builders[cls]; |
| 247 | 247 |
| 248 // In CSP mode [emitClassConstructor] and [emitClassGettersSetters] have | 248 // In CSP mode [emitClassConstructor] and [emitClassGettersSetters] have |
| 249 // a side-effect on "precompiled" functions in [OldEmitter]. For this | 249 // a side-effect on "precompiled" functions in [OldEmitter]. For this |
| 250 // reason, it is important that we don't call these methods before we | 250 // reason, it is important that we don't call these methods before we |
| 251 // are certain that a class is needed. | 251 // are certain that a class is needed. |
| 252 | 252 |
| 253 emitterTask.oldEmitter.classEmitter.emitConstructorsForCSP(cls); | 253 emitterTask.oldEmitter.classEmitter.emitConstructorsForCSP(cls); |
| 254 | 254 |
| 255 // [emitClassGettersSettersForCSP] does not affect whether or not a | 255 // [emitClassGettersSettersForCSP] does not affect whether or not a |
| 256 // class is needed. If getters/setters are emitted, the class has fields | 256 // class is needed. If getters/setters are emitted, the class has fields |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 targetOutput.add(';'); | 489 targetOutput.add(';'); |
| 490 } | 490 } |
| 491 targetOutput.addBuffer(jsAst.prettyPrint( | 491 targetOutput.addBuffer(jsAst.prettyPrint( |
| 492 new jsAst.ExpressionStatement(init), compiler)); | 492 new jsAst.ExpressionStatement(init), compiler)); |
| 493 targetOutput.add('\n'); | 493 targetOutput.add('\n'); |
| 494 } | 494 } |
| 495 | 495 |
| 496 targetOutput.add('\n'); | 496 targetOutput.add('\n'); |
| 497 } | 497 } |
| 498 } | 498 } |
| OLD | NEW |