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

Unified Diff: sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart

Issue 18496004: Retain type annotations for function subtyping in minified mode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 | « no previous file | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
index 358ecab681f0e8445afc1f0b4eb7f359e2be1d22..d086c19df296a3e3966ef4c4316675dd02180210 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
@@ -149,63 +149,17 @@ class DartBackend extends Backend {
return false;
}
- void processTypeArguments(Element classElement, NodeList typeArguments) {
- if (typeArguments == null) return;
- for (Node typeArgument in typeArguments.nodes) {
- if (typeArgument is TypeVariable) {
- TypeVariable typeVariable = typeArgument;
- typeArgument = typeVariable.bound;
- }
- if (typeArgument == null) continue;
- assert(typeArgument is TypeAnnotation);
- DartType argumentType =
- compiler.resolveTypeAnnotation(classElement, typeArgument);
- assert(argumentType != null);
- workQueue.add(argumentType);
- }
- }
-
- void processTypeAnnotationList(Element classElement, NodeList annotations) {
- for (Link link = annotations.nodes; !link.isEmpty; link = link.tail) {
- TypeAnnotation typeAnnotation = link.head;
- NodeList typeArguments = typeAnnotation.typeArguments;
- processTypeArguments(classElement, typeArguments);
- }
- }
-
- void processSuperclassTypeArguments(Element classElement, Node superclass) {
- if (superclass == null) return;
- MixinApplication superMixinApplication = superclass.asMixinApplication();
- if (superMixinApplication != null) {
- processTypeAnnotationList(classElement, superMixinApplication.mixins);
- } else {
- TypeAnnotation typeAnnotation = superclass;
- NodeList typeArguments = typeAnnotation.typeArguments;
- processTypeArguments(classElement, typeArguments);
- }
- }
-
while (!workQueue.isEmpty) {
DartType type = workQueue.removeLast();
if (processedTypes.contains(type)) continue;
processedTypes.add(type);
+ if (type is FunctionType) return false;
if (type is TypedefType) return false;
if (type is InterfaceType) {
+ InterfaceType interfaceType = type;
+ // Check all type arguments.
+ workQueue.addAll(interfaceType.typeArguments.toList());
ClassElement element = type.element;
- Node node = element.parseNode(compiler);
- if (node is ClassNode) {
- ClassNode classNode = node;
- processTypeArguments(element, classNode.typeParameters);
- processSuperclassTypeArguments(element, classNode.superclass);
Anton Muhin 2013/07/02 11:39:03 do not you need to check superclass still?
Johnni Winther 2013/07/02 11:42:10 All superclasses of [type] are handled by adding t
Anton Muhin 2013/07/02 11:43:02 Thanks!
- processTypeAnnotationList(element, classNode.interfaces);
- } else {
- MixinApplication mixinNode = node;
- processSuperclassTypeArguments(element, mixinNode.superclass);
- if (mixinNode is NamedMixinApplication) {
- NamedMixinApplication namedMixinNode = mixinNode;
- processTypeArguments(element, namedMixinNode.typeParameters);
- }
- }
// Check all supertypes.
if (element.allSupertypes != null) {
workQueue.addAll(element.allSupertypes.toList());
@@ -400,7 +354,7 @@ class DartBackend extends Backend {
// TODO(antonm): check with AAR team if there is better approach.
// As an idea: provide template as a Dart code---class C { C.name(); }---
// and then overwrite necessary parts.
- ClassNode classNode = classElement.parseNode(compiler);
+ var classNode = classElement.parseNode(compiler);
Johnni Winther 2013/07/02 11:33:51 This can also be NamedMixinApplication nodes.
karlklose 2013/07/02 12:16:39 Could we let them share common base class (the Mix
Johnni Winther 2013/07/03 05:41:57 We could but the only thing used here is their [na
SynthesizedConstructorElementX constructor =
new SynthesizedConstructorElementX(classElement);
constructor.type = new FunctionType(
« no previous file with comments | « no previous file | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698