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

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

Issue 10911007: Rename Type to DartType to avoid conflicts with the class Type in the core library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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;
11 final Map<SourceString, Set<Selector>> invokedNames; 11 final Map<SourceString, Set<Selector>> invokedNames;
12 final Map<SourceString, Set<Selector>> invokedGetters; 12 final Map<SourceString, Set<Selector>> invokedGetters;
13 final Map<SourceString, Set<Selector>> invokedSetters; 13 final Map<SourceString, Set<Selector>> invokedSetters;
14 final Map<SourceString, Set<Selector>> fieldGetters; 14 final Map<SourceString, Set<Selector>> fieldGetters;
15 final Map<SourceString, Set<Selector>> fieldSetters; 15 final Map<SourceString, Set<Selector>> fieldSetters;
16 // TODO(ngeoffray): This should be a Set<Type>. 16 // TODO(ngeoffray): This should be a Set<DartType>.
17 final Set<Element> isChecks; 17 final Set<Element> isChecks;
18 final RuntimeTypeInformation rti; 18 final RuntimeTypeInformation rti;
19 19
20 Universe() : generatedCode = new Map<Element, CodeBuffer>(), 20 Universe() : generatedCode = new Map<Element, CodeBuffer>(),
21 generatedBailoutCode = new Map<Element, CodeBuffer>(), 21 generatedBailoutCode = new Map<Element, CodeBuffer>(),
22 instantiatedClasses = new Set<ClassElement>(), 22 instantiatedClasses = new Set<ClassElement>(),
23 instantiatedClassInstanceFields = new Set<SourceString>(), 23 instantiatedClassInstanceFields = new Set<SourceString>(),
24 staticFunctionsNeedingGetter = new Set<FunctionElement>(), 24 staticFunctionsNeedingGetter = new Set<FunctionElement>(),
25 invokedNames = new Map<SourceString, Set<Selector>>(), 25 invokedNames = new Map<SourceString, Set<Selector>>(),
26 invokedGetters = new Map<SourceString, Set<Selector>>(), 26 invokedGetters = new Map<SourceString, Set<Selector>>(),
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 bool isIndex() => kind === SelectorKind.INDEX && argumentCount == 1; 161 bool isIndex() => kind === SelectorKind.INDEX && argumentCount == 1;
162 bool isIndexSet() => kind === SelectorKind.INDEX && argumentCount == 2; 162 bool isIndexSet() => kind === SelectorKind.INDEX && argumentCount == 2;
163 163
164 bool isOperator() => kind === SelectorKind.OPERATOR; 164 bool isOperator() => kind === SelectorKind.OPERATOR;
165 bool isUnaryOperator() => isOperator() && argumentCount == 0; 165 bool isUnaryOperator() => isOperator() && argumentCount == 0;
166 bool isBinaryOperator() => isOperator() && argumentCount == 1; 166 bool isBinaryOperator() => isOperator() && argumentCount == 1;
167 167
168 int hashCode() => argumentCount + 1000 * namedArguments.length; 168 int hashCode() => argumentCount + 1000 * namedArguments.length;
169 int get namedArgumentCount => namedArguments.length; 169 int get namedArgumentCount => namedArguments.length;
170 int get positionalArgumentCount => argumentCount - namedArgumentCount; 170 int get positionalArgumentCount => argumentCount - namedArgumentCount;
171 Type get receiverType => null; 171 DartType get receiverType => null;
172 172
173 bool applies(Element element, Compiler compiler) 173 bool applies(Element element, Compiler compiler)
174 => appliesUntyped(element, compiler); 174 => appliesUntyped(element, compiler);
175 175
176 bool appliesUntyped(Element element, Compiler compiler) { 176 bool appliesUntyped(Element element, Compiler compiler) {
177 if (element.isSetter()) return isSetter(); 177 if (element.isSetter()) return isSetter();
178 if (element.isGetter()) return isGetter() || isCall(); 178 if (element.isGetter()) return isGetter() || isCall();
179 if (element.isField()) return isGetter() || isSetter() || isCall(); 179 if (element.isField()) return isGetter() || isSetter() || isCall();
180 if (isGetter()) return true; 180 if (isGetter()) return true;
181 181
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 } 323 }
324 324
325 toString() => 'Selector($kind, $name, $argumentCount)'; 325 toString() => 'Selector($kind, $name, $argumentCount)';
326 } 326 }
327 327
328 class TypedSelector extends Selector { 328 class TypedSelector extends Selector {
329 /** 329 /**
330 * The type of the receiver. Any subtype of that type can be the 330 * The type of the receiver. Any subtype of that type can be the
331 * target of the invocation. 331 * target of the invocation.
332 */ 332 */
333 final Type receiverType; 333 final DartType receiverType;
334 334
335 TypedSelector(this.receiverType, Selector selector) 335 TypedSelector(this.receiverType, Selector selector)
336 : super(selector.kind, 336 : super(selector.kind,
337 selector.name, 337 selector.name,
338 selector.library, 338 selector.library,
339 selector.argumentCount, 339 selector.argumentCount,
340 selector.namedArguments); 340 selector.namedArguments);
341 341
342 /** 342 /**
343 * Check if [element] will be the one used at runtime when being 343 * Check if [element] will be the one used at runtime when being
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 } 386 }
387 387
388 return false; 388 return false;
389 } 389 }
390 390
391 toString() { 391 toString() {
392 return 'Selector($kind, "${name.slowToString()}", ' 392 return 'Selector($kind, "${name.slowToString()}", '
393 '$argumentCount, type=$receiverType)'; 393 '$argumentCount, type=$receiverType)';
394 } 394 }
395 } 395 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698