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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 12210142: Implement is-checks against type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 9 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 part of resolution; 5 part of resolution;
6 6
7 abstract class TreeElements { 7 abstract class TreeElements {
8 Element operator[](Node node); 8 Element operator[](Node node);
9 Selector getSelector(Send send); 9 Selector getSelector(Send send);
10 DartType getType(Node node); 10 DartType getType(Node node);
(...skipping 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after
2420 compiler.withCurrentElement(constructor, () { 2420 compiler.withCurrentElement(constructor, () {
2421 FunctionExpression tree = constructor.parseNode(compiler); 2421 FunctionExpression tree = constructor.parseNode(compiler);
2422 compiler.resolver.resolveConstructorImplementation(constructor, tree); 2422 compiler.resolver.resolveConstructorImplementation(constructor, tree);
2423 }); 2423 });
2424 // [constructor.defaultImplementation] might be the implementation element 2424 // [constructor.defaultImplementation] might be the implementation element
2425 // and only declaration elements may be registered. 2425 // and only declaration elements may be registered.
2426 world.registerStaticUse(constructor.defaultImplementation.declaration); 2426 world.registerStaticUse(constructor.defaultImplementation.declaration);
2427 ClassElement cls = constructor.defaultImplementation.getEnclosingClass(); 2427 ClassElement cls = constructor.defaultImplementation.getEnclosingClass();
2428 // [cls] might be the implementation element and only declaration elements 2428 // [cls] might be the implementation element and only declaration elements
2429 // may be registered. 2429 // may be registered.
2430 world.registerInstantiatedClass(cls.declaration); 2430 DartType type = mapping.getType(node);
2431 world.registerInstantiatedType(type);
2432 if (type.containsTypeVariable) {
2433 compiler.backend.registerGetRuntimeTypeArgument();
ngeoffray 2013/02/27 12:36:28 Why? If there is no is check, there is no need for
karlklose 2013/02/27 16:11:32 Obsolete.
2434 }
2431 if (cls.isAbstract(compiler)) { 2435 if (cls.isAbstract(compiler)) {
2432 compiler.backend.registerAbstractClassInstantiation(); 2436 compiler.backend.registerAbstractClassInstantiation();
2433 } 2437 }
2434 // [cls] might be the declaration element and we want to include injected 2438 // [cls] might be the declaration element and we want to include injected
2435 // members. 2439 // members.
2436 cls.implementation.forEachInstanceField( 2440 cls.implementation.forEachInstanceField(
2437 (ClassElement enclosingClass, Element member) { 2441 (ClassElement enclosingClass, Element member) {
2438 world.addToWorkList(member); 2442 world.addToWorkList(member);
2439 }, 2443 },
2440 includeBackendMembers: false, 2444 includeBackendMembers: false,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2490 if (inCheckContext) { 2494 if (inCheckContext) {
2491 compiler.enqueuer.resolution.registerIsCheck(type); 2495 compiler.enqueuer.resolution.registerIsCheck(type);
2492 } 2496 }
2493 if (typeRequired || inCheckContext) { 2497 if (typeRequired || inCheckContext) {
2494 if (type is InterfaceType) { 2498 if (type is InterfaceType) {
2495 InterfaceType itf = type; 2499 InterfaceType itf = type;
2496 itf.typeArguments.forEach((DartType argument) { 2500 itf.typeArguments.forEach((DartType argument) {
2497 analyzeTypeArgument(type, argument); 2501 analyzeTypeArgument(type, argument);
2498 }); 2502 });
2499 } 2503 }
2500 // TODO(ngeoffray): Also handle cases like: 2504 // TODO(ngeoffray): Also handle T a (in checked mode).
2501 // 1) a is T
2502 // 2) T a (in checked mode).
2503 } 2505 }
2504 return type; 2506 return type;
2505 } 2507 }
2506 2508
2507 visitModifiers(Modifiers node) { 2509 visitModifiers(Modifiers node) {
2508 // TODO(ngeoffray): Implement this. 2510 // TODO(ngeoffray): Implement this.
2509 unimplemented(node, 'modifiers'); 2511 unimplemented(node, 'modifiers');
2510 } 2512 }
2511 2513
2512 visitLiteralList(LiteralList node) { 2514 visitLiteralList(LiteralList node) {
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
3718 return e; 3720 return e;
3719 } 3721 }
3720 3722
3721 /// Assumed to be called by [resolveRedirectingFactory]. 3723 /// Assumed to be called by [resolveRedirectingFactory].
3722 Element visitReturn(Return node) { 3724 Element visitReturn(Return node) {
3723 Node expression = node.expression; 3725 Node expression = node.expression;
3724 return finishConstructorReference(visit(expression), 3726 return finishConstructorReference(visit(expression),
3725 expression, expression); 3727 expression, expression);
3726 } 3728 }
3727 } 3729 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698