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

Side by Side Diff: dart/lib/compiler/implementation/universe.dart

Issue 10892005: Revert "Support unary - operator." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
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 Universe { 5 class Universe {
6 Map<Element, CodeBuffer> generatedCode; 6 Map<Element, CodeBuffer> generatedCode;
7 Map<Element, CodeBuffer> generatedBailoutCode; 7 Map<Element, CodeBuffer> generatedBailoutCode;
8 final Set<ClassElement> instantiatedClasses; 8 final Set<ClassElement> instantiatedClasses;
9 final Set<SourceString> instantiatedClassInstanceFields; 9 final Set<SourceString> instantiatedClassInstanceFields;
10 final Set<FunctionElement> staticFunctionsNeedingGetter; 10 final Set<FunctionElement> staticFunctionsNeedingGetter;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 Selector.getter(SourceString name, LibraryElement library) 110 Selector.getter(SourceString name, LibraryElement library)
111 : this(SelectorKind.GETTER, name, library, 0); 111 : this(SelectorKind.GETTER, name, library, 0);
112 112
113 Selector.getterFrom(Selector selector) 113 Selector.getterFrom(Selector selector)
114 : this(SelectorKind.GETTER, selector.name, selector.library, 0); 114 : this(SelectorKind.GETTER, selector.name, selector.library, 0);
115 115
116 Selector.setter(SourceString name, LibraryElement library) 116 Selector.setter(SourceString name, LibraryElement library)
117 : this(SelectorKind.SETTER, name, library, 1); 117 : this(SelectorKind.SETTER, name, library, 1);
118 118
119 Selector.unaryOperator(SourceString name) 119 Selector.unaryOperator(SourceString name)
120 : this(SelectorKind.OPERATOR, 120 : this(SelectorKind.OPERATOR, operatorName(name, true), null, 0);
121 Elements.constructOperatorName(name, true),
122 null, 0);
123 121
124 Selector.binaryOperator(SourceString name) 122 Selector.binaryOperator(SourceString name)
125 : this(SelectorKind.OPERATOR, 123 : this(SelectorKind.OPERATOR, operatorName(name, false), null, 1);
126 Elements.constructOperatorName(name, false),
127 null, 1);
128 124
129 Selector.index() 125 Selector.index()
130 : this(SelectorKind.INDEX, 126 : this(SelectorKind.INDEX, indexName(), null, 1);
131 Elements.constructOperatorName(const SourceString("[]"), false),
132 null, 1);
133 127
134 Selector.indexSet() 128 Selector.indexSet()
135 : this(SelectorKind.INDEX, 129 : this(SelectorKind.INDEX, indexSetName(), null, 2);
136 Elements.constructOperatorName(const SourceString("[]="), false),
137 null, 2);
138 130
139 Selector.call(SourceString name, 131 Selector.call(SourceString name,
140 LibraryElement library, 132 LibraryElement library,
141 int arity, 133 int arity,
142 [List<SourceString> named = const []]) 134 [List<SourceString> named = const []])
143 : this(SelectorKind.CALL, name, library, arity, named); 135 : this(SelectorKind.CALL, name, library, arity, named);
144 136
145 Selector.callClosure(int arity, [List<SourceString> named = const []]) 137 Selector.callClosure(int arity, [List<SourceString> named = const []])
146 : this(SelectorKind.CALL, Namer.CLOSURE_INVOCATION_NAME, null, 138 : this(SelectorKind.CALL, Namer.CLOSURE_INVOCATION_NAME, null,
147 arity, named); 139 arity, named);
(...skipping 10 matching lines...) Expand all
158 bool isSetter() => kind === SelectorKind.SETTER; 150 bool isSetter() => kind === SelectorKind.SETTER;
159 bool isCall() => kind === SelectorKind.CALL; 151 bool isCall() => kind === SelectorKind.CALL;
160 152
161 bool isIndex() => kind === SelectorKind.INDEX && argumentCount == 1; 153 bool isIndex() => kind === SelectorKind.INDEX && argumentCount == 1;
162 bool isIndexSet() => kind === SelectorKind.INDEX && argumentCount == 2; 154 bool isIndexSet() => kind === SelectorKind.INDEX && argumentCount == 2;
163 155
164 bool isOperator() => kind === SelectorKind.OPERATOR; 156 bool isOperator() => kind === SelectorKind.OPERATOR;
165 bool isUnaryOperator() => isOperator() && argumentCount == 0; 157 bool isUnaryOperator() => isOperator() && argumentCount == 0;
166 bool isBinaryOperator() => isOperator() && argumentCount == 1; 158 bool isBinaryOperator() => isOperator() && argumentCount == 1;
167 159
160 static SourceString operatorName(SourceString name, bool isUnary)
161 => Elements.constructOperatorName(
162 const SourceString('operator'), name, isUnary);
163
164 static SourceString indexName()
165 => operatorName(const SourceString('[]'), false);
166
167 static SourceString indexSetName()
168 => operatorName(const SourceString('[]='), false);
169
168 int hashCode() => argumentCount + 1000 * namedArguments.length; 170 int hashCode() => argumentCount + 1000 * namedArguments.length;
169 int get namedArgumentCount => namedArguments.length; 171 int get namedArgumentCount => namedArguments.length;
170 int get positionalArgumentCount => argumentCount - namedArgumentCount; 172 int get positionalArgumentCount => argumentCount - namedArgumentCount;
171 Type get receiverType => null; 173 Type get receiverType => null;
172 174
173 bool applies(Element element, Compiler compiler) 175 bool applies(Element element, Compiler compiler)
174 => appliesUntyped(element, compiler); 176 => appliesUntyped(element, compiler);
175 177
176 bool appliesUntyped(Element element, Compiler compiler) { 178 bool appliesUntyped(Element element, Compiler compiler) {
177 if (element.isSetter()) return isSetter(); 179 if (element.isSetter()) return isSetter();
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 } 389 }
388 390
389 return false; 391 return false;
390 } 392 }
391 393
392 toString() { 394 toString() {
393 return 'Selector($kind, "${name.slowToString()}", ' 395 return 'Selector($kind, "${name.slowToString()}", '
394 '$argumentCount, type=$receiverType)'; 396 '$argumentCount, type=$receiverType)';
395 } 397 }
396 } 398 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/ssa/builder.dart ('k') | dart/pkg/dartdoc/mirrors/dart2js_mirror.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698