Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: runtime/lib/invocation_mirror_patch.dart

Issue 2759973004: Fix observatory tests broken by running dartfmt. Temporarily reverted formatting for evaluate_activ… (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/lib/internal_patch.dart ('k') | runtime/lib/isolate_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
33 33
34 // External representation of the invocation mirror; populated on demand. 34 // External representation of the invocation mirror; populated on demand.
35 Symbol _memberName; 35 Symbol _memberName;
36 int _type; 36 int _type;
37 List _positionalArguments; 37 List _positionalArguments;
38 Map<Symbol, dynamic> _namedArguments; 38 Map<Symbol, dynamic> _namedArguments;
39 39
40 void _setMemberNameAndType() { 40 void _setMemberNameAndType() {
41 if (_functionName.startsWith("get:")) { 41 if (_functionName.startsWith("get:")) {
42 _type = _GETTER; 42 _type = _GETTER;
43 _memberName = 43 _memberName = new internal.Symbol.unvalidated(_functionName.substring(4));
44 new internal.Symbol.unvalidated(_functionName.substring(4));
45 } else if (_functionName.startsWith("set:")) { 44 } else if (_functionName.startsWith("set:")) {
46 _type = _SETTER; 45 _type = _SETTER;
47 _memberName = 46 _memberName =
48 new internal.Symbol.unvalidated( 47 new internal.Symbol.unvalidated(_functionName.substring(4) + "=");
49 _functionName.substring(4) + "=");
50 } else { 48 } else {
51 _type = _isSuperInvocation ? (_SUPER << _CALL_SHIFT) | _METHOD : _METHOD; 49 _type = _isSuperInvocation ? (_SUPER << _CALL_SHIFT) | _METHOD : _METHOD;
52 _memberName = new internal.Symbol.unvalidated(_functionName); 50 _memberName = new internal.Symbol.unvalidated(_functionName);
53 } 51 }
54 } 52 }
55 53
56 Symbol get memberName { 54 Symbol get memberName {
57 if (_memberName == null) { 55 if (_memberName == null) {
58 _setMemberNameAndType(); 56 _setMemberNameAndType();
59 } 57 }
60 return _memberName; 58 return _memberName;
61 } 59 }
62 60
63 List get positionalArguments { 61 List get positionalArguments {
64 if (_positionalArguments == null) { 62 if (_positionalArguments == null) {
65 int numPositionalArguments = _argumentsDescriptor[1]; 63 int numPositionalArguments = _argumentsDescriptor[1];
66 // Don't count receiver. 64 // Don't count receiver.
67 if (numPositionalArguments == 1) { 65 if (numPositionalArguments == 1) {
68 return _positionalArguments = const []; 66 return _positionalArguments = const [];
69 } 67 }
70 // Exclude receiver. 68 // Exclude receiver.
71 _positionalArguments = 69 _positionalArguments =
72 new _ImmutableList._from(_arguments, 1, numPositionalArguments - 1); 70 new _ImmutableList._from(_arguments, 1, numPositionalArguments - 1);
73 } 71 }
74 return _positionalArguments; 72 return _positionalArguments;
75 } 73 }
76 74
77 Map<Symbol, dynamic> get namedArguments { 75 Map<Symbol, dynamic> get namedArguments {
78 if (_namedArguments == null) { 76 if (_namedArguments == null) {
79 int numArguments = _argumentsDescriptor[0] - 1; // Exclude receiver. 77 int numArguments = _argumentsDescriptor[0] - 1; // Exclude receiver.
80 int numPositionalArguments = _argumentsDescriptor[1] - 1; 78 int numPositionalArguments = _argumentsDescriptor[1] - 1;
81 int numNamedArguments = numArguments - numPositionalArguments; 79 int numNamedArguments = numArguments - numPositionalArguments;
82 if (numNamedArguments == 0) { 80 if (numNamedArguments == 0) {
83 return _namedArguments = const {}; 81 return _namedArguments = const {};
84 } 82 }
85 _namedArguments = new Map<Symbol, dynamic>(); 83 _namedArguments = new Map<Symbol, dynamic>();
86 for (int i = 0; i < numNamedArguments; i++) { 84 for (int i = 0; i < numNamedArguments; i++) {
87 String arg_name = _argumentsDescriptor[2 + 2*i]; 85 String arg_name = _argumentsDescriptor[2 + 2 * i];
88 var arg_value = _arguments[_argumentsDescriptor[3 + 2*i]]; 86 var arg_value = _arguments[_argumentsDescriptor[3 + 2 * i]];
89 _namedArguments[new internal.Symbol.unvalidated(arg_name)] = 87 _namedArguments[new internal.Symbol.unvalidated(arg_name)] = arg_value;
90 arg_value;
91 } 88 }
92 _namedArguments = new Map.unmodifiable(_namedArguments); 89 _namedArguments = new Map.unmodifiable(_namedArguments);
93 } 90 }
94 return _namedArguments; 91 return _namedArguments;
95 } 92 }
96 93
97 bool get isMethod { 94 bool get isMethod {
98 if (_type == null) { 95 if (_type == null) {
99 _setMemberNameAndType(); 96 _setMemberNameAndType();
100 } 97 }
(...skipping 14 matching lines...) Expand all
115 return (_type & _TYPE_MASK) == _GETTER; 112 return (_type & _TYPE_MASK) == _GETTER;
116 } 113 }
117 114
118 bool get isSetter { 115 bool get isSetter {
119 if (_type == null) { 116 if (_type == null) {
120 _setMemberNameAndType(); 117 _setMemberNameAndType();
121 } 118 }
122 return (_type & _TYPE_MASK) == _SETTER; 119 return (_type & _TYPE_MASK) == _SETTER;
123 } 120 }
124 121
125 _InvocationMirror(this._functionName, 122 _InvocationMirror(this._functionName, this._argumentsDescriptor,
126 this._argumentsDescriptor, 123 this._arguments, this._isSuperInvocation);
127 this._arguments,
128 this._isSuperInvocation);
129 124
130 static _allocateInvocationMirror(String functionName, 125 static _allocateInvocationMirror(String functionName,
131 List argumentsDescriptor, 126 List argumentsDescriptor, List arguments, bool isSuperInvocation) {
132 List arguments, 127 return new _InvocationMirror(
133 bool isSuperInvocation) { 128 functionName, argumentsDescriptor, arguments, isSuperInvocation);
134 return new _InvocationMirror(functionName,
135 argumentsDescriptor,
136 arguments,
137 isSuperInvocation);
138 } 129 }
139 } 130 }
OLDNEW
« no previous file with comments | « runtime/lib/internal_patch.dart ('k') | runtime/lib/isolate_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698