| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.new_js_emitter.model; | 5 library dart2js.new_js_emitter.model; |
| 6 | 6 |
| 7 import '../js/js.dart' as js show Expression; | 7 import '../js/js.dart' as js show Expression; |
| 8 import '../constants/values.dart' show ConstantValue; | 8 import '../constants/values.dart' show ConstantValue; |
| 9 | 9 |
| 10 import '../deferred_load.dart' show OutputUnit; | 10 import '../deferred_load.dart' show OutputUnit; |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 /** | 311 /** |
| 312 * A method that corresponds to a method in the original Dart program. | 312 * A method that corresponds to a method in the original Dart program. |
| 313 */ | 313 */ |
| 314 class DartMethod extends Method { | 314 class DartMethod extends Method { |
| 315 final bool needsTearOff; | 315 final bool needsTearOff; |
| 316 final String tearOffName; | 316 final String tearOffName; |
| 317 // TODO(herhut): Directly store stubs instead/ | 317 // TODO(herhut): Directly store stubs instead/ |
| 318 final bool needsStubs; | 318 final bool needsStubs; |
| 319 // TODO(herhut): Directly store aliases instead. | 319 // TODO(herhut): Directly store aliases instead. |
| 320 final bool canBeApplied; | 320 final bool canBeApplied; |
| 321 final bool canBeReflected; | |
| 322 | 321 |
| 323 DartMethod(Element element, String name, js.Expression code, | 322 DartMethod(Element element, String name, js.Expression code, |
| 324 {this.needsTearOff, this.tearOffName, this.needsStubs, this.canBeApplied, | 323 {this.needsTearOff, this.tearOffName, this.needsStubs, this.canBeApplied}) |
| 325 this.canBeReflected}) | |
| 326 : super(element, name, code) { | 324 : super(element, name, code) { |
| 327 assert(needsTearOff != null); | 325 assert(needsTearOff != null); |
| 328 assert(!needsTearOff || tearOffName != null); | 326 assert(!needsTearOff || tearOffName != null); |
| 329 assert(canBeApplied != null); | 327 assert(canBeApplied != null); |
| 330 assert(canBeReflected != null); | |
| 331 assert(needsStubs != null); | 328 assert(needsStubs != null); |
| 332 } | 329 } |
| 333 } | 330 } |
| 334 | 331 |
| 335 class InstanceMethod extends DartMethod { | 332 class InstanceMethod extends DartMethod { |
| 336 // TODO(herhut): Directly store aliases instead. | 333 // TODO(herhut): Directly store aliases instead. |
| 337 final bool hasSuperAlias; | 334 final bool hasSuperAlias; |
| 338 final bool isClosure; | 335 final bool isClosure; |
| 339 | 336 |
| 340 InstanceMethod(element, name, code, | 337 InstanceMethod(element, name, code, |
| 341 {bool needsTearOff, | 338 {bool needsTearOff, |
| 342 String tearOffName, | 339 String tearOffName, |
| 343 this.hasSuperAlias, | 340 this.hasSuperAlias, |
| 344 bool canBeApplied, | 341 bool canBeApplied, |
| 345 bool canBeReflected, | |
| 346 this.isClosure, | 342 this.isClosure, |
| 347 bool needsStubs}) | 343 bool needsStubs}) |
| 348 : super(element, name, code, | 344 : super(element, name, code, |
| 349 needsTearOff: needsTearOff, | 345 needsTearOff: needsTearOff, |
| 350 tearOffName: tearOffName, | 346 tearOffName: tearOffName, |
| 351 canBeApplied: canBeApplied, | 347 canBeApplied: canBeApplied, |
| 352 canBeReflected: canBeReflected, | |
| 353 needsStubs: needsStubs) { | 348 needsStubs: needsStubs) { |
| 354 assert(hasSuperAlias != null); | 349 assert(hasSuperAlias != null); |
| 355 assert(isClosure != null); | 350 assert(isClosure != null); |
| 356 } | 351 } |
| 357 } | 352 } |
| 358 | 353 |
| 359 /** | 354 /** |
| 360 * A method that is generated by the backend and has not direct correspondence | 355 * A method that is generated by the backend and has not direct correspondence |
| 361 * to a method in the original Dart program. Examples are getter and setter | 356 * to a method in the original Dart program. Examples are getter and setter |
| 362 * stubs and stubs to dispatch calls to methods with optional parameters. | 357 * stubs and stubs to dispatch calls to methods with optional parameters. |
| 363 */ | 358 */ |
| 364 class StubMethod extends Method { | 359 class StubMethod extends Method { |
| 365 StubMethod(String name, js.Expression code, | 360 StubMethod(String name, js.Expression code, |
| 366 {Element element}) | 361 {Element element}) |
| 367 : super(element, name, code); | 362 : super(element, name, code); |
| 368 } | 363 } |
| 369 | 364 |
| 370 class StaticMethod extends DartMethod { | 365 class StaticMethod extends DartMethod { |
| 371 final Holder holder; | 366 final Holder holder; |
| 372 StaticMethod(Element element, String name, this.holder, js.Expression code, | 367 StaticMethod(Element element, String name, this.holder, js.Expression code, |
| 373 {bool needsTearOff, String tearOffName, bool canBeApplied, | 368 {bool needsTearOff, String tearOffName, bool canBeApplied, |
| 374 bool canBeReflected, bool needsStubs}) | 369 bool needsStubs}) |
| 375 : super(element, name, code, | 370 : super(element, name, code, |
| 376 needsTearOff: needsTearOff, | 371 needsTearOff: needsTearOff, |
| 377 tearOffName : tearOffName, | 372 tearOffName : tearOffName, |
| 378 canBeApplied : canBeApplied, | 373 canBeApplied : canBeApplied, |
| 379 canBeReflected : canBeReflected, | |
| 380 needsStubs : needsStubs); | 374 needsStubs : needsStubs); |
| 381 } | 375 } |
| 382 | 376 |
| 383 class StaticStubMethod extends StubMethod { | 377 class StaticStubMethod extends StubMethod { |
| 384 Holder holder; | 378 Holder holder; |
| 385 StaticStubMethod(String name, this.holder, js.Expression code) | 379 StaticStubMethod(String name, this.holder, js.Expression code) |
| 386 : super(name, code); | 380 : super(name, code); |
| 387 } | 381 } |
| OLD | NEW |