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

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

Issue 2767533002: Revert "Fix observatory tests broken by running dartfmt." (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 = new internal.Symbol.unvalidated(_functionName.substring(4)); 43 _memberName =
44 new internal.Symbol.unvalidated(_functionName.substring(4));
44 } else if (_functionName.startsWith("set:")) { 45 } else if (_functionName.startsWith("set:")) {
45 _type = _SETTER; 46 _type = _SETTER;
46 _memberName = 47 _memberName =
47 new internal.Symbol.unvalidated(_functionName.substring(4) + "="); 48 new internal.Symbol.unvalidated(
49 _functionName.substring(4) + "=");
48 } else { 50 } else {
49 _type = _isSuperInvocation ? (_SUPER << _CALL_SHIFT) | _METHOD : _METHOD; 51 _type = _isSuperInvocation ? (_SUPER << _CALL_SHIFT) | _METHOD : _METHOD;
50 _memberName = new internal.Symbol.unvalidated(_functionName); 52 _memberName = new internal.Symbol.unvalidated(_functionName);
51 } 53 }
52 } 54 }
53 55
54 Symbol get memberName { 56 Symbol get memberName {
55 if (_memberName == null) { 57 if (_memberName == null) {
56 _setMemberNameAndType(); 58 _setMemberNameAndType();
57 } 59 }
58 return _memberName; 60 return _memberName;
59 } 61 }
60 62
61 List get positionalArguments { 63 List get positionalArguments {
62 if (_positionalArguments == null) { 64 if (_positionalArguments == null) {
63 int numPositionalArguments = _argumentsDescriptor[1]; 65 int numPositionalArguments = _argumentsDescriptor[1];
64 // Don't count receiver. 66 // Don't count receiver.
65 if (numPositionalArguments == 1) { 67 if (numPositionalArguments == 1) {
66 return _positionalArguments = const []; 68 return _positionalArguments = const [];
67 } 69 }
68 // Exclude receiver. 70 // Exclude receiver.
69 _positionalArguments = 71 _positionalArguments =
70 new _ImmutableList._from(_arguments, 1, numPositionalArguments - 1); 72 new _ImmutableList._from(_arguments, 1, numPositionalArguments - 1);
71 } 73 }
72 return _positionalArguments; 74 return _positionalArguments;
73 } 75 }
74 76
75 Map<Symbol, dynamic> get namedArguments { 77 Map<Symbol, dynamic> get namedArguments {
76 if (_namedArguments == null) { 78 if (_namedArguments == null) {
77 int numArguments = _argumentsDescriptor[0] - 1; // Exclude receiver. 79 int numArguments = _argumentsDescriptor[0] - 1; // Exclude receiver.
78 int numPositionalArguments = _argumentsDescriptor[1] - 1; 80 int numPositionalArguments = _argumentsDescriptor[1] - 1;
79 int numNamedArguments = numArguments - numPositionalArguments; 81 int numNamedArguments = numArguments - numPositionalArguments;
80 if (numNamedArguments == 0) { 82 if (numNamedArguments == 0) {
81 return _namedArguments = const {}; 83 return _namedArguments = const {};
82 } 84 }
83 _namedArguments = new Map<Symbol, dynamic>(); 85 _namedArguments = new Map<Symbol, dynamic>();
84 for (int i = 0; i < numNamedArguments; i++) { 86 for (int i = 0; i < numNamedArguments; i++) {
85 String arg_name = _argumentsDescriptor[2 + 2 * i]; 87 String arg_name = _argumentsDescriptor[2 + 2*i];
86 var arg_value = _arguments[_argumentsDescriptor[3 + 2 * i]]; 88 var arg_value = _arguments[_argumentsDescriptor[3 + 2*i]];
87 _namedArguments[new internal.Symbol.unvalidated(arg_name)] = arg_value; 89 _namedArguments[new internal.Symbol.unvalidated(arg_name)] =
90 arg_value;
88 } 91 }
89 _namedArguments = new Map.unmodifiable(_namedArguments); 92 _namedArguments = new Map.unmodifiable(_namedArguments);
90 } 93 }
91 return _namedArguments; 94 return _namedArguments;
92 } 95 }
93 96
94 bool get isMethod { 97 bool get isMethod {
95 if (_type == null) { 98 if (_type == null) {
96 _setMemberNameAndType(); 99 _setMemberNameAndType();
97 } 100 }
(...skipping 14 matching lines...) Expand all
112 return (_type & _TYPE_MASK) == _GETTER; 115 return (_type & _TYPE_MASK) == _GETTER;
113 } 116 }
114 117
115 bool get isSetter { 118 bool get isSetter {
116 if (_type == null) { 119 if (_type == null) {
117 _setMemberNameAndType(); 120 _setMemberNameAndType();
118 } 121 }
119 return (_type & _TYPE_MASK) == _SETTER; 122 return (_type & _TYPE_MASK) == _SETTER;
120 } 123 }
121 124
122 _InvocationMirror(this._functionName, this._argumentsDescriptor, 125 _InvocationMirror(this._functionName,
123 this._arguments, this._isSuperInvocation); 126 this._argumentsDescriptor,
127 this._arguments,
128 this._isSuperInvocation);
124 129
125 static _allocateInvocationMirror(String functionName, 130 static _allocateInvocationMirror(String functionName,
126 List argumentsDescriptor, List arguments, bool isSuperInvocation) { 131 List argumentsDescriptor,
127 return new _InvocationMirror( 132 List arguments,
128 functionName, argumentsDescriptor, arguments, isSuperInvocation); 133 bool isSuperInvocation) {
134 return new _InvocationMirror(functionName,
135 argumentsDescriptor,
136 arguments,
137 isSuperInvocation);
129 } 138 }
130 } 139 }
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