Chromium Code Reviews| Index: runtime/lib/invocation_mirror_patch.dart |
| diff --git a/runtime/lib/invocation_mirror_patch.dart b/runtime/lib/invocation_mirror_patch.dart |
| index 7a1422efa0712b9b51d2607ac1c67a792e741c10..619fb68637fb4df7ca35ac01ea0759178e0cdfff 100644 |
| --- a/runtime/lib/invocation_mirror_patch.dart |
| +++ b/runtime/lib/invocation_mirror_patch.dart |
| @@ -25,6 +25,12 @@ class _InvocationMirror implements Invocation { |
| static const int _CALL_BITS = 3; |
| static const int _CALL_MASK = (1 << _CALL_BITS) - 1; |
| + // ArgumentsDescriptor layout. Keep in sync with enum in dart_entry.h. |
| + static const int _TYPE_ARGS_LEN = 0; |
| + static const int _COUNT = 1; |
| + static const int _POSITIONAL_COUNT = 2; |
| + static const int _FIRST_NAMED_ENTRY = 3; |
| + |
| // Internal representation of the invocation mirror. |
| final String _functionName; |
| final List _argumentsDescriptor; |
| @@ -60,7 +66,7 @@ class _InvocationMirror implements Invocation { |
| List get positionalArguments { |
| if (_positionalArguments == null) { |
| - int numPositionalArguments = _argumentsDescriptor[1]; |
| + int numPositionalArguments = _argumentsDescriptor[_POSITIONAL_COUNT]; |
|
zra
2017/05/11 04:14:20
Just checking that it is intentional that the inde
regis
2017/05/11 09:55:10
Yes, a new entry was inserted at index 0 to repres
|
| // Don't count receiver. |
| if (numPositionalArguments == 1) { |
| return _positionalArguments = const []; |
| @@ -74,16 +80,17 @@ class _InvocationMirror implements Invocation { |
| Map<Symbol, dynamic> get namedArguments { |
| if (_namedArguments == null) { |
| - int numArguments = _argumentsDescriptor[0] - 1; // Exclude receiver. |
| - int numPositionalArguments = _argumentsDescriptor[1] - 1; |
| + int numArguments = _argumentsDescriptor[_COUNT] - 1; // Exclude receiver. |
| + int numPositionalArguments = _argumentsDescriptor[_POSITIONAL_COUNT] - 1; |
| int numNamedArguments = numArguments - numPositionalArguments; |
| if (numNamedArguments == 0) { |
| return _namedArguments = const {}; |
| } |
| _namedArguments = new Map<Symbol, dynamic>(); |
| for (int i = 0; i < numNamedArguments; i++) { |
| - String arg_name = _argumentsDescriptor[2 + 2 * i]; |
| - var arg_value = _arguments[_argumentsDescriptor[3 + 2 * i]]; |
| + int namedEntryIndex = _FIRST_NAMED_ENTRY + 2 * i; |
| + String arg_name = _argumentsDescriptor[namedEntryIndex]; |
| + var arg_value = _arguments[_argumentsDescriptor[namedEntryIndex + 1]]; |
| _namedArguments[new internal.Symbol.unvalidated(arg_name)] = arg_value; |
| } |
| _namedArguments = new Map.unmodifiable(_namedArguments); |