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