| 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 Method(this.element, this.name, this.code); | 330 Method(this.element, this.name, this.code); |
| 331 } | 331 } |
| 332 | 332 |
| 333 /// A method that corresponds to a method in the original Dart program. | 333 /// A method that corresponds to a method in the original Dart program. |
| 334 class DartMethod extends Method { | 334 class DartMethod extends Method { |
| 335 final bool needsTearOff; | 335 final bool needsTearOff; |
| 336 final String tearOffName; | 336 final String tearOffName; |
| 337 final List<ParameterStubMethod> parameterStubs; | 337 final List<ParameterStubMethod> parameterStubs; |
| 338 final bool canBeApplied; | 338 final bool canBeApplied; |
| 339 final bool canBeReflected; | 339 final bool canBeReflected; |
| 340 final DartType type; |
| 340 | 341 |
| 341 // If this method can be torn off, contains the name of the corresponding | 342 // If this method can be torn off, contains the name of the corresponding |
| 342 // call method. For example, for the member `foo$1$name` it would be | 343 // call method. For example, for the member `foo$1$name` it would be |
| 343 // `call$1$name` (in unminified mode). | 344 // `call$1$name` (in unminified mode). |
| 344 final String callName; | 345 final String callName; |
| 345 | 346 |
| 346 DartMethod(Element element, String name, js.Expression code, | 347 DartMethod(Element element, String name, js.Expression code, |
| 347 this.parameterStubs, this.callName, | 348 this.parameterStubs, this.callName, this.type, |
| 348 {this.needsTearOff, this.tearOffName, this.canBeApplied, | 349 {this.needsTearOff, this.tearOffName, this.canBeApplied, |
| 349 this.canBeReflected}) | 350 this.canBeReflected}) |
| 350 : super(element, name, code) { | 351 : super(element, name, code) { |
| 351 assert(needsTearOff != null); | 352 assert(needsTearOff != null); |
| 352 assert(!needsTearOff || tearOffName != null); | 353 assert(!needsTearOff || tearOffName != null); |
| 353 assert(canBeApplied != null); | 354 assert(canBeApplied != null); |
| 354 assert(canBeReflected != null); | 355 assert(canBeReflected != null); |
| 355 } | 356 } |
| 356 } | 357 } |
| 357 | 358 |
| 358 class InstanceMethod extends DartMethod { | 359 class InstanceMethod extends DartMethod { |
| 359 /// An alternative name for this method. This is used to model calls to | 360 /// An alternative name for this method. This is used to model calls to |
| 360 /// a method via `super`. If [aliasName] is non-null, the emitter has to | 361 /// a method via `super`. If [aliasName] is non-null, the emitter has to |
| 361 /// ensure that this method is registered on the prototype under both [name] | 362 /// ensure that this method is registered on the prototype under both [name] |
| 362 /// and [aliasName]. | 363 /// and [aliasName]. |
| 363 final String aliasName; | 364 final String aliasName; |
| 364 final bool isClosure; | 365 final bool isClosure; |
| 365 | 366 |
| 366 | 367 |
| 367 InstanceMethod(Element element, String name, js.Expression code, | 368 InstanceMethod(Element element, String name, js.Expression code, |
| 368 List<ParameterStubMethod> parameterStubs, | 369 List<ParameterStubMethod> parameterStubs, |
| 369 String callName, | 370 String callName, DartType type, |
| 370 {bool needsTearOff, | 371 {bool needsTearOff, |
| 371 String tearOffName, | 372 String tearOffName, |
| 372 this.aliasName, | 373 this.aliasName, |
| 373 bool canBeApplied, | 374 bool canBeApplied, |
| 374 bool canBeReflected, | 375 bool canBeReflected, |
| 375 this.isClosure}) | 376 this.isClosure}) |
| 376 : super(element, name, code, parameterStubs, callName, | 377 : super(element, name, code, parameterStubs, callName, type, |
| 377 needsTearOff: needsTearOff, | 378 needsTearOff: needsTearOff, |
| 378 tearOffName: tearOffName, | 379 tearOffName: tearOffName, |
| 379 canBeApplied: canBeApplied, | 380 canBeApplied: canBeApplied, |
| 380 canBeReflected: canBeReflected) { | 381 canBeReflected: canBeReflected) { |
| 381 assert(isClosure != null); | 382 assert(isClosure != null); |
| 382 } | 383 } |
| 383 } | 384 } |
| 384 | 385 |
| 385 /// A method that is generated by the backend and has not direct correspondence | 386 /// A method that is generated by the backend and has not direct correspondence |
| 386 /// to a method in the original Dart program. Examples are getter and setter | 387 /// to a method in the original Dart program. Examples are getter and setter |
| (...skipping 27 matching lines...) Expand all Loading... |
| 414 | 415 |
| 415 abstract class StaticMethod implements Method { | 416 abstract class StaticMethod implements Method { |
| 416 Holder get holder; | 417 Holder get holder; |
| 417 } | 418 } |
| 418 | 419 |
| 419 class StaticDartMethod extends DartMethod implements StaticMethod { | 420 class StaticDartMethod extends DartMethod implements StaticMethod { |
| 420 final Holder holder; | 421 final Holder holder; |
| 421 | 422 |
| 422 StaticDartMethod(Element element, String name, this.holder, | 423 StaticDartMethod(Element element, String name, this.holder, |
| 423 js.Expression code, List<ParameterStubMethod> parameterStubs, | 424 js.Expression code, List<ParameterStubMethod> parameterStubs, |
| 424 String callName, | 425 String callName, DartType type, |
| 425 {bool needsTearOff, String tearOffName, bool canBeApplied, | 426 {bool needsTearOff, String tearOffName, bool canBeApplied, |
| 426 bool canBeReflected}) | 427 bool canBeReflected}) |
| 427 : super(element, name, code, parameterStubs, callName, | 428 : super(element, name, code, parameterStubs, callName, type, |
| 428 needsTearOff: needsTearOff, | 429 needsTearOff: needsTearOff, |
| 429 tearOffName : tearOffName, | 430 tearOffName : tearOffName, |
| 430 canBeApplied : canBeApplied, | 431 canBeApplied : canBeApplied, |
| 431 canBeReflected : canBeReflected); | 432 canBeReflected : canBeReflected); |
| 432 } | 433 } |
| 433 | 434 |
| 434 class StaticStubMethod extends StubMethod implements StaticMethod { | 435 class StaticStubMethod extends StubMethod implements StaticMethod { |
| 435 Holder holder; | 436 Holder holder; |
| 436 StaticStubMethod(String name, this.holder, js.Expression code) | 437 StaticStubMethod(String name, this.holder, js.Expression code) |
| 437 : super(name, code); | 438 : super(name, code); |
| 438 } | 439 } |
| OLD | NEW |