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

Unified Diff: lib/compiler/implementation/elements/elements.dart

Issue 10270010: Remove getType; use the resolver instead. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/compiler.dart ('k') | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/elements/elements.dart
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart
index 634ad99ac94c3a55602b7d21721c50f855cb675c..e18f1888a16f531db3e7006d9a7af637d43eaa05 100644
--- a/lib/compiler/implementation/elements/elements.dart
+++ b/lib/compiler/implementation/elements/elements.dart
@@ -446,7 +446,7 @@ class VariableListElement extends Element {
Type computeType(Compiler compiler) {
if (type != null) return type;
- type = getType(parseNode(compiler).type, compiler, getLibrary());
+ type = compiler.resolveTypeAnnotation(this, parseNode(compiler).type);
return type;
}
@@ -500,47 +500,6 @@ class AbstractFieldElement extends Element {
}
}
-/** DEPRECATED. */
-Type getType(TypeAnnotation typeAnnotation,
- Compiler compiler,
- LibraryElement library) {
- // TODO(karlklose,ngeoffray): This method should be removed and the
- // information should be computed by the resolver.
-
- if (typeAnnotation == null || typeAnnotation.typeName == null) {
- return compiler.types.dynamicType;
- }
- Identifier identifier = typeAnnotation.typeName.asIdentifier();
- if (identifier === null) {
- compiler.reportWarning(
- typeAnnotation.typeName,
- new ResolutionWarning(MessageKind.GENERIC,
- ['library prefixes not handled']));
- return compiler.types.dynamicType;
- }
- SourceString name = identifier.source;
- Element element = library.find(name);
- if (element !== null) {
- if (element.isTypedef()) {
- // TODO(ngeoffray): This is a hack to help us get support for the
- // DOM library.
- // TODO(ngeoffray): The list of types for the argument is wrong.
- return new FunctionType(compiler.types.dynamicType,
- const EmptyLink<Type>(),
- element);
- }
- if (element.isClass()) {
- // TODO(karlklose): substitute type parameters.
- return element.computeType(compiler);
- }
- }
- Type type = compiler.types.lookup(name);
- if (type === null) {
- type = compiler.types.dynamicType;
- }
- return type;
-}
-
class FunctionParameters {
Link<Element> requiredParameters;
Link<Element> optionalParameters;
@@ -644,8 +603,7 @@ class FunctionElement extends Element {
Types types = compiler.types;
FunctionExpression node =
compiler.parser.measure(() => parseNode(compiler));
- Type returnType = getType(node.returnType, compiler, getLibrary());
- if (returnType === null) returnType = types.dynamicType;
+ Type returnType = compiler.resolveTypeAnnotation(this, node.returnType);
LinkBuilder<Type> parameterTypes = new LinkBuilder<Type>();
for (Link<Element> link = parameters.requiredParameters;
« no previous file with comments | « lib/compiler/implementation/compiler.dart ('k') | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698