| 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 library dart2js.js_emitter.code_emitter_task; | 5 library dart2js.js_emitter.code_emitter_task; |
| 6 | 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart' show JsBuiltin; | 7 import 'package:js_runtime/shared/embedded_names.dart' show JsBuiltin; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/tasks.dart' show CompilerTask; | 10 import '../common/tasks.dart' show CompilerTask; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 CodeEmitterTask task, Namer namer, ClosedWorld closedWorld); | 236 CodeEmitterTask task, Namer namer, ClosedWorld closedWorld); |
| 237 } | 237 } |
| 238 | 238 |
| 239 abstract class Emitter { | 239 abstract class Emitter { |
| 240 /// Uses the [programBuilder] to generate a model of the program, emits | 240 /// Uses the [programBuilder] to generate a model of the program, emits |
| 241 /// the program, and returns the size of the generated output. | 241 /// the program, and returns the size of the generated output. |
| 242 int emitProgram(ProgramBuilder programBuilder); | 242 int emitProgram(ProgramBuilder programBuilder); |
| 243 | 243 |
| 244 /// Returns the JS function that must be invoked to get the value of the | 244 /// Returns the JS function that must be invoked to get the value of the |
| 245 /// lazily initialized static. | 245 /// lazily initialized static. |
| 246 jsAst.Expression isolateLazyInitializerAccess(FieldEntity element); | 246 jsAst.Expression isolateLazyInitializerAccess(covariant FieldEntity element); |
| 247 | 247 |
| 248 /// Returns the closure expression of a static function. | 248 /// Returns the closure expression of a static function. |
| 249 jsAst.Expression isolateStaticClosureAccess(FunctionEntity element); | 249 jsAst.Expression isolateStaticClosureAccess(covariant FunctionEntity element); |
| 250 | 250 |
| 251 /// Returns the JS code for accessing the embedded [global]. | 251 /// Returns the JS code for accessing the embedded [global]. |
| 252 jsAst.Expression generateEmbeddedGlobalAccess(String global); | 252 jsAst.Expression generateEmbeddedGlobalAccess(String global); |
| 253 | 253 |
| 254 /// Returns the JS function representing the given function. | 254 /// Returns the JS function representing the given function. |
| 255 /// | 255 /// |
| 256 /// The function must be invoked and can not be used as closure. | 256 /// The function must be invoked and can not be used as closure. |
| 257 jsAst.Expression staticFunctionAccess(FunctionEntity element); | 257 jsAst.Expression staticFunctionAccess(FunctionEntity element); |
| 258 | 258 |
| 259 jsAst.Expression staticFieldAccess(FieldEntity element); | 259 jsAst.Expression staticFieldAccess(FieldEntity element); |
| 260 | 260 |
| 261 /// Returns the JS constructor of the given element. | 261 /// Returns the JS constructor of the given element. |
| 262 /// | 262 /// |
| 263 /// The returned expression must only be used in a JS `new` expression. | 263 /// The returned expression must only be used in a JS `new` expression. |
| 264 jsAst.Expression constructorAccess(ClassEntity e); | 264 jsAst.Expression constructorAccess(ClassEntity e); |
| 265 | 265 |
| 266 /// Returns the JS prototype of the given class [e]. | 266 /// Returns the JS prototype of the given class [e]. |
| 267 jsAst.Expression prototypeAccess(ClassEntity e, bool hasBeenInstantiated); | 267 jsAst.Expression prototypeAccess( |
| 268 covariant ClassEntity e, bool hasBeenInstantiated); |
| 268 | 269 |
| 269 /// Returns the JS constructor of the given interceptor class [e]. | 270 /// Returns the JS constructor of the given interceptor class [e]. |
| 270 jsAst.Expression interceptorClassAccess(ClassEntity e); | 271 jsAst.Expression interceptorClassAccess(ClassEntity e); |
| 271 | 272 |
| 272 /// Returns the JS expression representing the type [e]. | 273 /// Returns the JS expression representing the type [e]. |
| 273 jsAst.Expression typeAccess(Entity e); | 274 jsAst.Expression typeAccess(Entity e); |
| 274 | 275 |
| 275 /// Returns the JS expression representing a function that returns 'null' | 276 /// Returns the JS expression representing a function that returns 'null' |
| 276 jsAst.Expression generateFunctionThatReturnsNull(); | 277 jsAst.Expression generateFunctionThatReturnsNull(); |
| 277 | 278 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 jsAst.PropertyAccess staticFunctionAccess(FunctionEntity element) { | 322 jsAst.PropertyAccess staticFunctionAccess(FunctionEntity element) { |
| 322 return globalPropertyAccessForMember(element); | 323 return globalPropertyAccessForMember(element); |
| 323 } | 324 } |
| 324 | 325 |
| 325 @override | 326 @override |
| 326 jsAst.PropertyAccess constructorAccess(ClassEntity element) { | 327 jsAst.PropertyAccess constructorAccess(ClassEntity element) { |
| 327 return globalPropertyAccessForClass(element); | 328 return globalPropertyAccessForClass(element); |
| 328 } | 329 } |
| 329 | 330 |
| 330 @override | 331 @override |
| 331 jsAst.PropertyAccess interceptorClassAccess(ClassEntity element) { | 332 jsAst.Expression interceptorClassAccess(ClassEntity element) { |
| 332 return globalPropertyAccessForClass(element); | 333 return globalPropertyAccessForClass(element); |
| 333 } | 334 } |
| 334 | 335 |
| 335 @override | 336 @override |
| 336 jsAst.PropertyAccess typeAccess(Entity element) { | 337 jsAst.Expression typeAccess(Entity element) { |
| 337 return globalPropertyAccessForType(element); | 338 return globalPropertyAccessForType(element); |
| 338 } | 339 } |
| 339 } | 340 } |
| OLD | NEW |