| 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 /// A method that corresponds to a method in the original Dart program. | 330 /// A method that corresponds to a method in the original Dart program. |
| 331 class DartMethod extends Method { | 331 class DartMethod extends Method { |
| 332 final bool needsTearOff; | 332 final bool needsTearOff; |
| 333 final String tearOffName; | 333 final String tearOffName; |
| 334 // TODO(herhut): Directly store stubs instead/ | 334 // TODO(herhut): Directly store stubs instead/ |
| 335 final bool needsStubs; | 335 final bool needsStubs; |
| 336 // TODO(herhut): Directly store aliases instead. | 336 // TODO(herhut): Directly store aliases instead. |
| 337 final bool canBeApplied; | 337 final bool canBeApplied; |
| 338 final bool canBeReflected; | 338 final bool canBeReflected; |
| 339 | 339 |
| 340 final List<AdapterStubMethod> adapterStubs; |
| 341 |
| 342 // If this method can be torn off, contains the name of the corresponding |
| 343 // call method. For example, for the member `foo$1$name` it would be |
| 344 // `call$1$name` (in unminified mode). |
| 345 final String callName; |
| 346 |
| 340 DartMethod(Element element, String name, js.Expression code, | 347 DartMethod(Element element, String name, js.Expression code, |
| 341 {this.needsTearOff, this.tearOffName, this.needsStubs, this.canBeApplied, | 348 this.adapterStubs, this.callName, |
| 342 this.canBeReflected}) | 349 {this.needsTearOff, this.tearOffName, this.needsStubs, |
| 350 this.canBeApplied, this.canBeReflected}) |
| 343 : super(element, name, code) { | 351 : super(element, name, code) { |
| 344 assert(needsTearOff != null); | 352 assert(needsTearOff != null); |
| 345 assert(!needsTearOff || tearOffName != null); | 353 assert(!needsTearOff || tearOffName != null); |
| 346 assert(canBeApplied != null); | 354 assert(canBeApplied != null); |
| 347 assert(canBeReflected != null); | 355 assert(canBeReflected != null); |
| 348 assert(needsStubs != null); | 356 assert(needsStubs != null); |
| 349 } | 357 } |
| 350 } | 358 } |
| 351 | 359 |
| 352 class InstanceMethod extends DartMethod { | 360 class InstanceMethod extends DartMethod { |
| 353 // TODO(herhut): Directly store aliases instead. | 361 // TODO(herhut): Directly store aliases instead. |
| 354 final bool hasSuperAlias; | 362 final bool hasSuperAlias; |
| 355 final bool isClosure; | 363 final bool isClosure; |
| 356 | 364 |
| 357 InstanceMethod(element, name, code, | 365 InstanceMethod(Element element, String name, js.Expression code, |
| 358 {bool needsTearOff, | 366 List<AdapterStubMethod> adapterStubs, |
| 359 String tearOffName, | 367 String callName, |
| 360 this.hasSuperAlias, | 368 {bool needsTearOff, |
| 361 bool canBeApplied, | 369 String tearOffName, |
| 362 bool canBeReflected, | 370 this.hasSuperAlias, |
| 363 this.isClosure, | 371 bool canBeApplied, |
| 364 bool needsStubs}) | 372 bool canBeReflected, |
| 365 : super(element, name, code, | 373 this.isClosure, |
| 374 bool needsStubs}) |
| 375 : super(element, name, code, adapterStubs, callName, |
| 366 needsTearOff: needsTearOff, | 376 needsTearOff: needsTearOff, |
| 367 tearOffName: tearOffName, | 377 tearOffName: tearOffName, |
| 368 canBeApplied: canBeApplied, | 378 canBeApplied: canBeApplied, |
| 369 canBeReflected: canBeReflected, | 379 canBeReflected: canBeReflected, |
| 370 needsStubs: needsStubs) { | 380 needsStubs: needsStubs) { |
| 371 assert(hasSuperAlias != null); | 381 assert(hasSuperAlias != null); |
| 372 assert(isClosure != null); | 382 assert(isClosure != null); |
| 373 } | 383 } |
| 374 } | 384 } |
| 375 | 385 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 404 } | 414 } |
| 405 | 415 |
| 406 abstract class StaticMethod implements Method { | 416 abstract class StaticMethod implements Method { |
| 407 Holder get holder; | 417 Holder get holder; |
| 408 } | 418 } |
| 409 | 419 |
| 410 class StaticDartMethod extends DartMethod implements StaticMethod { | 420 class StaticDartMethod extends DartMethod implements StaticMethod { |
| 411 final Holder holder; | 421 final Holder holder; |
| 412 | 422 |
| 413 StaticDartMethod(Element element, String name, this.holder, | 423 StaticDartMethod(Element element, String name, this.holder, |
| 414 js.Expression code, | 424 js.Expression code, List<AdapterStubMethod> adapterStubs, |
| 425 String callName, |
| 415 {bool needsTearOff, String tearOffName, bool canBeApplied, | 426 {bool needsTearOff, String tearOffName, bool canBeApplied, |
| 416 bool canBeReflected, bool needsStubs}) | 427 bool canBeReflected, bool needsStubs}) |
| 417 : super(element, name, code, | 428 : super(element, name, code, adapterStubs, callName, |
| 418 needsTearOff: needsTearOff, | 429 needsTearOff: needsTearOff, |
| 419 tearOffName : tearOffName, | 430 tearOffName : tearOffName, |
| 420 canBeApplied : canBeApplied, | 431 canBeApplied : canBeApplied, |
| 421 canBeReflected : canBeReflected, | 432 canBeReflected : canBeReflected, |
| 422 needsStubs : needsStubs); | 433 needsStubs : needsStubs); |
| 423 } | 434 } |
| 424 | 435 |
| 425 class StaticStubMethod extends StubMethod implements StaticMethod { | 436 class StaticStubMethod extends StubMethod implements StaticMethod { |
| 426 Holder holder; | 437 Holder holder; |
| 427 StaticStubMethod(String name, this.holder, js.Expression code) | 438 StaticStubMethod(String name, this.holder, js.Expression code) |
| 428 : super(name, code); | 439 : super(name, code); |
| 429 } | 440 } |
| OLD | NEW |