| 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; |
| 321 | 322 |
| 322 DartMethod(Element element, String name, js.Expression code, | 323 DartMethod(Element element, String name, js.Expression code, |
| 323 {this.needsTearOff, this.tearOffName, this.needsStubs, this.canBeApplied}) | 324 {this.needsTearOff, this.tearOffName, this.needsStubs, this.canBeApplied, |
| 325 this.canBeReflected}) |
| 324 : super(element, name, code) { | 326 : super(element, name, code) { |
| 325 assert(needsTearOff != null); | 327 assert(needsTearOff != null); |
| 326 assert(!needsTearOff || tearOffName != null); | 328 assert(!needsTearOff || tearOffName != null); |
| 327 assert(canBeApplied != null); | 329 assert(canBeApplied != null); |
| 330 assert(canBeReflected != null); |
| 328 assert(needsStubs != null); | 331 assert(needsStubs != null); |
| 329 } | 332 } |
| 330 } | 333 } |
| 331 | 334 |
| 332 class InstanceMethod extends DartMethod { | 335 class InstanceMethod extends DartMethod { |
| 333 // TODO(herhut): Directly store aliases instead. | 336 // TODO(herhut): Directly store aliases instead. |
| 334 final bool hasSuperAlias; | 337 final bool hasSuperAlias; |
| 335 final bool isClosure; | 338 final bool isClosure; |
| 336 | 339 |
| 337 InstanceMethod(element, name, code, | 340 InstanceMethod(element, name, code, |
| 338 {bool needsTearOff, | 341 {bool needsTearOff, |
| 339 String tearOffName, | 342 String tearOffName, |
| 340 this.hasSuperAlias, | 343 this.hasSuperAlias, |
| 341 bool canBeApplied, | 344 bool canBeApplied, |
| 345 bool canBeReflected, |
| 342 this.isClosure, | 346 this.isClosure, |
| 343 bool needsStubs}) | 347 bool needsStubs}) |
| 344 : super(element, name, code, | 348 : super(element, name, code, |
| 345 needsTearOff: needsTearOff, | 349 needsTearOff: needsTearOff, |
| 346 tearOffName: tearOffName, | 350 tearOffName: tearOffName, |
| 347 canBeApplied: canBeApplied, | 351 canBeApplied: canBeApplied, |
| 352 canBeReflected: canBeReflected, |
| 348 needsStubs: needsStubs) { | 353 needsStubs: needsStubs) { |
| 349 assert(hasSuperAlias != null); | 354 assert(hasSuperAlias != null); |
| 350 assert(isClosure != null); | 355 assert(isClosure != null); |
| 351 } | 356 } |
| 352 } | 357 } |
| 353 | 358 |
| 354 /** | 359 /** |
| 355 * A method that is generated by the backend and has not direct correspondence | 360 * A method that is generated by the backend and has not direct correspondence |
| 356 * to a method in the original Dart program. Examples are getter and setter | 361 * to a method in the original Dart program. Examples are getter and setter |
| 357 * stubs and stubs to dispatch calls to methods with optional parameters. | 362 * stubs and stubs to dispatch calls to methods with optional parameters. |
| 358 */ | 363 */ |
| 359 class StubMethod extends Method { | 364 class StubMethod extends Method { |
| 360 StubMethod(String name, js.Expression code, | 365 StubMethod(String name, js.Expression code, |
| 361 {Element element}) | 366 {Element element}) |
| 362 : super(element, name, code); | 367 : super(element, name, code); |
| 363 } | 368 } |
| 364 | 369 |
| 365 class StaticMethod extends DartMethod { | 370 class StaticMethod extends DartMethod { |
| 366 final Holder holder; | 371 final Holder holder; |
| 367 StaticMethod(Element element, String name, this.holder, js.Expression code, | 372 StaticMethod(Element element, String name, this.holder, js.Expression code, |
| 368 {bool needsTearOff, String tearOffName, bool canBeApplied, | 373 {bool needsTearOff, String tearOffName, bool canBeApplied, |
| 369 bool needsStubs}) | 374 bool canBeReflected, bool needsStubs}) |
| 370 : super(element, name, code, | 375 : super(element, name, code, |
| 371 needsTearOff: needsTearOff, | 376 needsTearOff: needsTearOff, |
| 372 tearOffName : tearOffName, | 377 tearOffName : tearOffName, |
| 373 canBeApplied : canBeApplied, | 378 canBeApplied : canBeApplied, |
| 379 canBeReflected : canBeReflected, |
| 374 needsStubs : needsStubs); | 380 needsStubs : needsStubs); |
| 375 } | 381 } |
| 376 | 382 |
| 377 class StaticStubMethod extends StubMethod { | 383 class StaticStubMethod extends StubMethod { |
| 378 Holder holder; | 384 Holder holder; |
| 379 StaticStubMethod(String name, this.holder, js.Expression code) | 385 StaticStubMethod(String name, this.holder, js.Expression code) |
| 380 : super(name, code); | 386 : super(name, code); |
| 381 } | 387 } |
| OLD | NEW |