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

Side by Side Diff: frog/element.dart

Issue 8789008: Fix "extends" checks. Move them out of resolve phase and do them on demand. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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
« no previous file with comments | « no previous file | frog/minfrog » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** 5 /**
6 * Any abstract representation of a dart element. This includes 6 * Any abstract representation of a dart element. This includes
7 * [Library], [Type] and [Member]. 7 * [Library], [Type] and [Member].
8 */ 8 */
9 class Element implements Hashable { 9 class Element implements Hashable {
10 // TODO(jimhug): Make name final when we can do it for Library. 10 // TODO(jimhug): Make name final when we can do it for Library.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 if (!baseType.isGeneric) { 96 if (!baseType.isGeneric) {
97 world.error('${baseType.name} is not generic', typeRef.span); 97 world.error('${baseType.name} is not generic', typeRef.span);
98 return null; 98 return null;
99 } 99 }
100 if (typeRef.typeArguments.length != baseType.typeParameters.length) { 100 if (typeRef.typeArguments.length != baseType.typeParameters.length) {
101 world.error('wrong number of type arguments', typeRef.span); 101 world.error('wrong number of type arguments', typeRef.span);
102 return null; 102 return null;
103 } 103 }
104 var typeArgs = []; 104 var typeArgs = [];
105 for (int i=0; i < typeRef.typeArguments.length; i++) { 105 for (int i=0; i < typeRef.typeArguments.length; i++) {
106 var extendsType = baseType.typeParameters[i].extendsType; 106 typeArgs.add(resolveType(typeRef.typeArguments[i], typeErrors));
107 var typeArg = resolveType(typeRef.typeArguments[i], typeErrors);
108 typeArgs.add(typeArg);
109
110 if (extendsType != null && typeArg is! ParameterType) {
111 typeArg.ensureSubtypeOf(extendsType,
112 typeRef.typeArguments[i].span, typeErrors);
113 }
114 } 107 }
115 typeRef.type = baseType.getOrMakeConcreteType(typeArgs); 108 typeRef.type = baseType.getOrMakeConcreteType(typeArgs);
116 } else if (node is FunctionTypeReference) { 109 } else if (node is FunctionTypeReference) {
117 FunctionTypeReference typeRef = node; 110 FunctionTypeReference typeRef = node;
118 var name = ''; 111 var name = '';
119 if (typeRef.func.name != null) { 112 if (typeRef.func.name != null) {
120 name = typeRef.func.name.name; 113 name = typeRef.func.name.name;
121 } 114 }
122 // Totally bogus! 115 // Totally bogus!
123 typeRef.type = library.getOrAddFunctionType(this, name, typeRef.func); 116 typeRef.type = library.getOrAddFunctionType(this, name, typeRef.func);
124 } else { 117 } else {
125 world.internalError('unknown type reference', node.span); 118 world.internalError('unknown type reference', node.span);
126 } 119 }
127 return node.type; 120 return node.type;
128 } 121 }
129 } 122 }
OLDNEW
« no previous file with comments | « no previous file | frog/minfrog » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698