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

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

Issue 32203002: Fix crash https://code.google.com/p/dart/issues/detail?id=14014: remove what seems to be obsolete c… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 library closureToClassMapper; 5 library closureToClassMapper;
6 6
7 import "elements/elements.dart"; 7 import "elements/elements.dart";
8 import "dart2jslib.dart"; 8 import "dart2jslib.dart";
9 import "dart_types.dart"; 9 import "dart_types.dart";
10 import "scanner/scannerlib.dart" show Token; 10 import "scanner/scannerlib.dart" show Token;
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 compiler.backend.classNeedsRti(currentElement.enclosingElement)) { 763 compiler.backend.classNeedsRti(currentElement.enclosingElement)) {
764 // Declare the type parameters in the scope. Generative 764 // Declare the type parameters in the scope. Generative
765 // constructors just use 'this'. 765 // constructors just use 'this'.
766 ClassElement cls = currentElement.enclosingElement; 766 ClassElement cls = currentElement.enclosingElement;
767 cls.typeVariables.forEach((TypeVariableType typeVariable) { 767 cls.typeVariables.forEach((TypeVariableType typeVariable) {
768 declareLocal(typeVariable.element); 768 declareLocal(typeVariable.element);
769 }); 769 });
770 } 770 }
771 771
772 DartType type = element.computeType(compiler); 772 DartType type = element.computeType(compiler);
773 // Compute the function type and check for type variables in return or 773 // If the method needs RTI, or checked mode is set, we need to
774 // parameter types. 774 // escape the potential type variables used in that closure.
775 if (type.containsTypeVariables) { 775 if (element is FunctionElement
776 registerNeedsThis(); 776 && (compiler.backend.methodNeedsRti(element) ||
777 } 777 compiler.enableTypeAssertions)) {
778 // Ensure that closure that need runtime type information has access to 778 analyzeTypeVariables(type);
779 // this of the enclosing class.
780 if (element is FunctionElement &&
781 closureData.thisElement != null &&
782 type.containsTypeVariables &&
783 compiler.backend.methodNeedsRti(element)) {
784 registerNeedsThis();
785 } 779 }
786 780
787 visitChildren(); 781 visitChildren();
788 }); 782 });
789 783
790 784
791 ClosureClassMap savedClosureData = closureData; 785 ClosureClassMap savedClosureData = closureData;
792 bool savedInsideClosure = insideClosure; 786 bool savedInsideClosure = insideClosure;
793 787
794 // Restore old values. 788 // Restore old values.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 } 828 }
835 829
836 visitTryStatement(TryStatement node) { 830 visitTryStatement(TryStatement node) {
837 // TODO(ngeoffray): implement finer grain state. 831 // TODO(ngeoffray): implement finer grain state.
838 bool oldInTryStatement = inTryStatement; 832 bool oldInTryStatement = inTryStatement;
839 inTryStatement = true; 833 inTryStatement = true;
840 node.visitChildren(this); 834 node.visitChildren(this);
841 inTryStatement = oldInTryStatement; 835 inTryStatement = oldInTryStatement;
842 } 836 }
843 } 837 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698