OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of js_backend; | 5 part of js_backend; |
6 | 6 |
7 /** | 7 /** |
8 * A function element that represents a closure call. The signature is copied | 8 * A function element that represents a closure call. The signature is copied |
9 * from the given element. | 9 * from the given element. |
10 */ | 10 */ |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 // If the method is in an interceptor class, we need to also pass | 643 // If the method is in an interceptor class, we need to also pass |
644 // the actual receiver. | 644 // the actual receiver. |
645 int extraArgumentCount = isInterceptorClass ? 1 : 0; | 645 int extraArgumentCount = isInterceptorClass ? 1 : 0; |
646 // Use '$receiver' to avoid clashes with other parameter names. Using | 646 // Use '$receiver' to avoid clashes with other parameter names. Using |
647 // '$receiver' works because [:namer.safeName:] used for getting parameter | 647 // '$receiver' works because [:namer.safeName:] used for getting parameter |
648 // names never returns a name beginning with a single '$'. | 648 // names never returns a name beginning with a single '$'. |
649 String receiverArgumentName = r'$receiver'; | 649 String receiverArgumentName = r'$receiver'; |
650 | 650 |
651 // The parameters that this stub takes. | 651 // The parameters that this stub takes. |
652 List<jsAst.Parameter> parametersBuffer = | 652 List<jsAst.Parameter> parametersBuffer = |
653 new List<jsAst.Parameter>.fixedLength( | 653 new List<jsAst.Parameter>(selector.argumentCount + extraArgumentCount); |
654 selector.argumentCount + extraArgumentCount); | |
655 // The arguments that will be passed to the real method. | 654 // The arguments that will be passed to the real method. |
656 List<jsAst.Expression> argumentsBuffer = | 655 List<jsAst.Expression> argumentsBuffer = |
657 new List<jsAst.Expression>.fixedLength( | 656 new List<jsAst.Expression>( |
658 parameters.parameterCount + extraArgumentCount); | 657 parameters.parameterCount + extraArgumentCount); |
659 | 658 |
660 int count = 0; | 659 int count = 0; |
661 if (isInterceptorClass) { | 660 if (isInterceptorClass) { |
662 count++; | 661 count++; |
663 parametersBuffer[0] = new jsAst.Parameter(receiverArgumentName); | 662 parametersBuffer[0] = new jsAst.Parameter(receiverArgumentName); |
664 argumentsBuffer[0] = js[receiverArgumentName]; | 663 argumentsBuffer[0] = js[receiverArgumentName]; |
665 } | 664 } |
666 | 665 |
667 int indexOfLastOptionalArgumentInParameters = positionalArgumentCount - 1; | 666 int indexOfLastOptionalArgumentInParameters = positionalArgumentCount - 1; |
(...skipping 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2708 """; | 2707 """; |
2709 const String HOOKS_API_USAGE = """ | 2708 const String HOOKS_API_USAGE = """ |
2710 // The code supports the following hooks: | 2709 // The code supports the following hooks: |
2711 // dartPrint(message) - if this function is defined it is called | 2710 // dartPrint(message) - if this function is defined it is called |
2712 // instead of the Dart [print] method. | 2711 // instead of the Dart [print] method. |
2713 // dartMainRunner(main) - if this function is defined, the Dart [main] | 2712 // dartMainRunner(main) - if this function is defined, the Dart [main] |
2714 // method will not be invoked directly. | 2713 // method will not be invoked directly. |
2715 // Instead, a closure that will invoke [main] is | 2714 // Instead, a closure that will invoke [main] is |
2716 // passed to [dartMainRunner]. | 2715 // passed to [dartMainRunner]. |
2717 """; | 2716 """; |
OLD | NEW |