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 '../constants/values.dart' show ConstantValue; | 7 import '../constants/values.dart' show ConstantValue; |
8 import '../deferred_load.dart' show OutputUnit; | 8 import '../deferred_load.dart' show OutputUnit; |
9 import '../elements/entities.dart'; | 9 import '../elements/entities.dart'; |
10 import '../js/js.dart' as js show Expression, Name, Statement, TokenFinalizer; | 10 import '../js/js.dart' as js show Expression, Name, Statement, TokenFinalizer; |
| 11 import '../js/js_debug.dart' as js show nodeToString; |
11 import 'js_emitter.dart' show MetadataCollector; | 12 import 'js_emitter.dart' show MetadataCollector; |
12 | 13 |
13 class Program { | 14 class Program { |
14 final List<Fragment> fragments; | 15 final List<Fragment> fragments; |
15 final List<Holder> holders; | 16 final List<Holder> holders; |
16 final bool outputContainsConstantList; | 17 final bool outputContainsConstantList; |
17 final bool needsNativeSupport; | 18 final bool needsNativeSupport; |
18 final bool hasIsolateSupport; | 19 final bool hasIsolateSupport; |
19 final bool hasSoftDeferredClasses; | 20 final bool hasSoftDeferredClasses; |
20 | 21 |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 | 477 |
477 bool get isStatic => false; | 478 bool get isStatic => false; |
478 } | 479 } |
479 | 480 |
480 /// A method that is generated by the backend and has not direct correspondence | 481 /// A method that is generated by the backend and has not direct correspondence |
481 /// to a method in the original Dart program. Examples are getter and setter | 482 /// to a method in the original Dart program. Examples are getter and setter |
482 /// stubs and stubs to dispatch calls to methods with optional parameters. | 483 /// stubs and stubs to dispatch calls to methods with optional parameters. |
483 class StubMethod extends Method { | 484 class StubMethod extends Method { |
484 StubMethod(js.Name name, js.Expression code, {MemberEntity element}) | 485 StubMethod(js.Name name, js.Expression code, {MemberEntity element}) |
485 : super(element, name, code); | 486 : super(element, name, code); |
| 487 |
| 488 String toString() { |
| 489 return 'stub[name=${name},element=${element},code=${js.nodeToString(code)}]'
; |
| 490 } |
486 } | 491 } |
487 | 492 |
488 /// A stub that adapts and redirects to the main method (the one containing) | 493 /// A stub that adapts and redirects to the main method (the one containing) |
489 /// the actual code. | 494 /// the actual code. |
490 /// | 495 /// |
491 /// For example, given a method `foo$2(x, [y: 499])` a possible parameter | 496 /// For example, given a method `foo$2(x, [y: 499])` a possible parameter |
492 /// stub-method could be `foo$1(x) => foo$2(x, 499)`. | 497 /// stub-method could be `foo$1(x) => foo$2(x, 499)`. |
493 /// | 498 /// |
494 /// ParameterStubMethods are always attached to (static or instance) methods. | 499 /// ParameterStubMethods are always attached to (static or instance) methods. |
495 class ParameterStubMethod extends StubMethod { | 500 class ParameterStubMethod extends StubMethod { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 : super(element, name, code, parameterStubs, callName, | 535 : super(element, name, code, parameterStubs, callName, |
531 needsTearOff: needsTearOff, | 536 needsTearOff: needsTearOff, |
532 tearOffName: tearOffName, | 537 tearOffName: tearOffName, |
533 canBeApplied: canBeApplied, | 538 canBeApplied: canBeApplied, |
534 canBeReflected: canBeReflected, | 539 canBeReflected: canBeReflected, |
535 requiredParameterCount: requiredParameterCount, | 540 requiredParameterCount: requiredParameterCount, |
536 optionalParameterDefaultValues: optionalParameterDefaultValues, | 541 optionalParameterDefaultValues: optionalParameterDefaultValues, |
537 functionType: functionType); | 542 functionType: functionType); |
538 | 543 |
539 bool get isStatic => true; | 544 bool get isStatic => true; |
| 545 |
| 546 String toString() { |
| 547 return 'static_method[name=${name},element=${element}}]'; |
| 548 } |
540 } | 549 } |
541 | 550 |
542 class StaticStubMethod extends StubMethod implements StaticMethod { | 551 class StaticStubMethod extends StubMethod implements StaticMethod { |
543 Holder holder; | 552 Holder holder; |
544 StaticStubMethod(js.Name name, this.holder, js.Expression code) | 553 StaticStubMethod(js.Name name, this.holder, js.Expression code) |
545 : super(name, code); | 554 : super(name, code); |
546 } | 555 } |
OLD | NEW |