| 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 class _InvocationMirror implements Invocation { | 5 class _InvocationMirror implements Invocation { |
| 6 // Constants describing the invocation type. | 6 // Constants describing the invocation type. |
| 7 // _FIELD cannot be generated by regular invocation mirrors. | 7 // _FIELD cannot be generated by regular invocation mirrors. |
| 8 static const int _METHOD = 0; | 8 static const int _METHOD = 0; |
| 9 static const int _GETTER = 1; | 9 static const int _GETTER = 1; |
| 10 static const int _SETTER = 2; | 10 static const int _SETTER = 2; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // External representation of the invocation mirror; populated on demand. | 33 // External representation of the invocation mirror; populated on demand. |
| 34 Symbol _memberName; | 34 Symbol _memberName; |
| 35 int _type; | 35 int _type; |
| 36 List _positionalArguments; | 36 List _positionalArguments; |
| 37 Map<Symbol, dynamic> _namedArguments; | 37 Map<Symbol, dynamic> _namedArguments; |
| 38 | 38 |
| 39 void _setMemberNameAndType() { | 39 void _setMemberNameAndType() { |
| 40 if (_functionName.startsWith("get:")) { | 40 if (_functionName.startsWith("get:")) { |
| 41 _type = _GETTER; | 41 _type = _GETTER; |
| 42 _memberName = | 42 _memberName = |
| 43 new _collection_dev.Symbol.unvalidated(_functionName.substring(4)); | 43 new internal.Symbol.unvalidated(_functionName.substring(4)); |
| 44 } else if (_functionName.startsWith("set:")) { | 44 } else if (_functionName.startsWith("set:")) { |
| 45 _type = _SETTER; | 45 _type = _SETTER; |
| 46 _memberName = | 46 _memberName = |
| 47 new _collection_dev.Symbol.unvalidated( | 47 new internal.Symbol.unvalidated( |
| 48 _functionName.substring(4) + "="); | 48 _functionName.substring(4) + "="); |
| 49 } else { | 49 } else { |
| 50 _type = _isSuperInvocation ? (_SUPER << _CALL_SHIFT) | _METHOD : _METHOD; | 50 _type = _isSuperInvocation ? (_SUPER << _CALL_SHIFT) | _METHOD : _METHOD; |
| 51 _memberName = new _collection_dev.Symbol.unvalidated(_functionName); | 51 _memberName = new internal.Symbol.unvalidated(_functionName); |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 Symbol get memberName { | 55 Symbol get memberName { |
| 56 if (_memberName == null) { | 56 if (_memberName == null) { |
| 57 _setMemberNameAndType(); | 57 _setMemberNameAndType(); |
| 58 } | 58 } |
| 59 return _memberName; | 59 return _memberName; |
| 60 } | 60 } |
| 61 | 61 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 77 int numArguments = _argumentsDescriptor[0] - 1; // Exclude receiver. | 77 int numArguments = _argumentsDescriptor[0] - 1; // Exclude receiver. |
| 78 int numPositionalArguments = _argumentsDescriptor[1] - 1; | 78 int numPositionalArguments = _argumentsDescriptor[1] - 1; |
| 79 int numNamedArguments = numArguments - numPositionalArguments; | 79 int numNamedArguments = numArguments - numPositionalArguments; |
| 80 if (numNamedArguments == 0) { | 80 if (numNamedArguments == 0) { |
| 81 return _namedArguments = const <Symbol, dynamic>{}; | 81 return _namedArguments = const <Symbol, dynamic>{}; |
| 82 } | 82 } |
| 83 _namedArguments = new Map<Symbol, dynamic>(); | 83 _namedArguments = new Map<Symbol, dynamic>(); |
| 84 for (int i = 0; i < numNamedArguments; i++) { | 84 for (int i = 0; i < numNamedArguments; i++) { |
| 85 String arg_name = _argumentsDescriptor[2 + 2*i]; | 85 String arg_name = _argumentsDescriptor[2 + 2*i]; |
| 86 var arg_value = _arguments[_argumentsDescriptor[3 + 2*i]]; | 86 var arg_value = _arguments[_argumentsDescriptor[3 + 2*i]]; |
| 87 _namedArguments[new _collection_dev.Symbol.unvalidated(arg_name)] = | 87 _namedArguments[new internal.Symbol.unvalidated(arg_name)] = |
| 88 arg_value; | 88 arg_value; |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 return _namedArguments; | 91 return _namedArguments; |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool get isMethod { | 94 bool get isMethod { |
| 95 if (_type == null) { | 95 if (_type == null) { |
| 96 _setMemberNameAndType(); | 96 _setMemberNameAndType(); |
| 97 } | 97 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 127 static _allocateInvocationMirror(String functionName, | 127 static _allocateInvocationMirror(String functionName, |
| 128 List argumentsDescriptor, | 128 List argumentsDescriptor, |
| 129 List arguments, | 129 List arguments, |
| 130 bool isSuperInvocation) { | 130 bool isSuperInvocation) { |
| 131 return new _InvocationMirror(functionName, | 131 return new _InvocationMirror(functionName, |
| 132 argumentsDescriptor, | 132 argumentsDescriptor, |
| 133 arguments, | 133 arguments, |
| 134 isSuperInvocation); | 134 isSuperInvocation); |
| 135 } | 135 } |
| 136 } | 136 } |
| OLD | NEW |