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, Statement; | 7 import '../js/js.dart' as js show Expression, Statement; |
| 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 341 } | 341 } |
| 342 | 342 |
| 343 /// A method that corresponds to a method in the original Dart program. | 343 /// A method that corresponds to a method in the original Dart program. |
| 344 class DartMethod extends Method { | 344 class DartMethod extends Method { |
| 345 final bool needsTearOff; | 345 final bool needsTearOff; |
| 346 final String tearOffName; | 346 final String tearOffName; |
| 347 final List<ParameterStubMethod> parameterStubs; | 347 final List<ParameterStubMethod> parameterStubs; |
| 348 final bool canBeApplied; | 348 final bool canBeApplied; |
| 349 final bool canBeReflected; | 349 final bool canBeReflected; |
| 350 final DartType type; | 350 final DartType type; |
| 351 final js.Expression functionType; | |
|
floitsch
2015/02/20 11:00:11
Add comment. (when is it null? can it be null?)
W
zarah
2015/02/20 12:59:32
As far as I can see, we don't use the "type" anymo
| |
| 351 | 352 |
| 352 // Signature information for this method. This is only required and stored | 353 // Signature information for this method. This is only required and stored |
| 353 // here if the method [canBeApplied] or [canBeReflected] | 354 // here if the method [canBeApplied] or [canBeReflected] |
| 354 final int requiredParameterCount; | 355 final int requiredParameterCount; |
| 355 final /* Map | List */ optionalParameterDefaultValues; | 356 final /* Map | List */ optionalParameterDefaultValues; |
| 356 | 357 |
| 357 // If this method can be torn off, contains the name of the corresponding | 358 // If this method can be torn off, contains the name of the corresponding |
| 358 // call method. For example, for the member `foo$1$name` it would be | 359 // call method. For example, for the member `foo$1$name` it would be |
| 359 // `call$1$name` (in unminified mode). | 360 // `call$1$name` (in unminified mode). |
| 360 final String callName; | 361 final String callName; |
| 361 | 362 |
| 362 DartMethod(Element element, String name, js.Expression code, | 363 DartMethod(Element element, String name, js.Expression code, |
| 363 this.parameterStubs, this.callName, this.type, | 364 this.parameterStubs, this.callName, this.type, |
| 364 {this.needsTearOff, this.tearOffName, this.canBeApplied, | 365 {this.needsTearOff, this.tearOffName, this.canBeApplied, |
| 365 this.canBeReflected, this.requiredParameterCount, | 366 this.canBeReflected, this.requiredParameterCount, |
| 366 this.optionalParameterDefaultValues}) | 367 this.optionalParameterDefaultValues, this.functionType}) |
| 367 : super(element, name, code) { | 368 : super(element, name, code) { |
| 368 assert(needsTearOff != null); | 369 assert(needsTearOff != null); |
| 369 assert(!needsTearOff || tearOffName != null); | 370 assert(!needsTearOff || tearOffName != null); |
| 370 assert(canBeApplied != null); | 371 assert(canBeApplied != null); |
| 371 assert(canBeReflected != null); | 372 assert(canBeReflected != null); |
| 372 assert((!canBeReflected && !canBeApplied) || | 373 assert((!canBeReflected && !canBeApplied) || |
| 373 (requiredParameterCount != null && | 374 (requiredParameterCount != null && |
| 374 optionalParameterDefaultValues != null)); | 375 optionalParameterDefaultValues != null)); |
| 375 } | 376 } |
| 376 } | 377 } |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 387 InstanceMethod(Element element, String name, js.Expression code, | 388 InstanceMethod(Element element, String name, js.Expression code, |
| 388 List<ParameterStubMethod> parameterStubs, | 389 List<ParameterStubMethod> parameterStubs, |
| 389 String callName, DartType type, | 390 String callName, DartType type, |
| 390 {bool needsTearOff, | 391 {bool needsTearOff, |
| 391 String tearOffName, | 392 String tearOffName, |
| 392 this.aliasName, | 393 this.aliasName, |
| 393 bool canBeApplied, | 394 bool canBeApplied, |
| 394 bool canBeReflected, | 395 bool canBeReflected, |
| 395 int requiredParameterCount, | 396 int requiredParameterCount, |
| 396 /* List | Map */ optionalParameterDefaultValues, | 397 /* List | Map */ optionalParameterDefaultValues, |
| 397 this.isClosure}) | 398 this.isClosure, |
| 399 js.Expression functionType}) | |
| 398 : super(element, name, code, parameterStubs, callName, type, | 400 : super(element, name, code, parameterStubs, callName, type, |
| 399 needsTearOff: needsTearOff, | 401 needsTearOff: needsTearOff, |
| 400 tearOffName: tearOffName, | 402 tearOffName: tearOffName, |
| 401 canBeApplied: canBeApplied, | 403 canBeApplied: canBeApplied, |
| 402 canBeReflected: canBeReflected, | 404 canBeReflected: canBeReflected, |
| 403 requiredParameterCount: requiredParameterCount, | 405 requiredParameterCount: requiredParameterCount, |
| 404 optionalParameterDefaultValues: optionalParameterDefaultValues) { | 406 optionalParameterDefaultValues: optionalParameterDefaultValues, |
| 407 functionType: functionType) { | |
| 405 assert(isClosure != null); | 408 assert(isClosure != null); |
| 406 } | 409 } |
| 407 } | 410 } |
| 408 | 411 |
| 409 /// A method that is generated by the backend and has not direct correspondence | 412 /// A method that is generated by the backend and has not direct correspondence |
| 410 /// to a method in the original Dart program. Examples are getter and setter | 413 /// to a method in the original Dart program. Examples are getter and setter |
| 411 /// stubs and stubs to dispatch calls to methods with optional parameters. | 414 /// stubs and stubs to dispatch calls to methods with optional parameters. |
| 412 class StubMethod extends Method { | 415 class StubMethod extends Method { |
| 413 StubMethod(String name, js.Expression code, | 416 StubMethod(String name, js.Expression code, |
| 414 {Element element}) | 417 {Element element}) |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 441 } | 444 } |
| 442 | 445 |
| 443 class StaticDartMethod extends DartMethod implements StaticMethod { | 446 class StaticDartMethod extends DartMethod implements StaticMethod { |
| 444 final Holder holder; | 447 final Holder holder; |
| 445 | 448 |
| 446 StaticDartMethod(Element element, String name, this.holder, | 449 StaticDartMethod(Element element, String name, this.holder, |
| 447 js.Expression code, List<ParameterStubMethod> parameterStubs, | 450 js.Expression code, List<ParameterStubMethod> parameterStubs, |
| 448 String callName, DartType type, | 451 String callName, DartType type, |
| 449 {bool needsTearOff, String tearOffName, bool canBeApplied, | 452 {bool needsTearOff, String tearOffName, bool canBeApplied, |
| 450 bool canBeReflected, int requiredParameterCount, | 453 bool canBeReflected, int requiredParameterCount, |
| 451 /* List | Map */ optionalParameterDefaultValues}) | 454 /* List | Map */ optionalParameterDefaultValues, |
| 455 js.Expression functionType}) | |
| 452 : super(element, name, code, parameterStubs, callName, type, | 456 : super(element, name, code, parameterStubs, callName, type, |
| 453 needsTearOff: needsTearOff, | 457 needsTearOff: needsTearOff, |
| 454 tearOffName : tearOffName, | 458 tearOffName : tearOffName, |
| 455 canBeApplied : canBeApplied, | 459 canBeApplied : canBeApplied, |
| 456 canBeReflected : canBeReflected, | 460 canBeReflected : canBeReflected, |
| 457 requiredParameterCount: requiredParameterCount, | 461 requiredParameterCount: requiredParameterCount, |
| 458 optionalParameterDefaultValues: optionalParameterDefaultValues); | 462 optionalParameterDefaultValues: optionalParameterDefaultValues, |
| 463 functionType: functionType); | |
| 459 } | 464 } |
| 460 | 465 |
| 461 class StaticStubMethod extends StubMethod implements StaticMethod { | 466 class StaticStubMethod extends StubMethod implements StaticMethod { |
| 462 Holder holder; | 467 Holder holder; |
| 463 StaticStubMethod(String name, this.holder, js.Expression code) | 468 StaticStubMethod(String name, this.holder, js.Expression code) |
| 464 : super(name, code); | 469 : super(name, code); |
| 465 } | 470 } |
| OLD | NEW |