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

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

Issue 12431003: Fix issue 8848: access to type variable inside a closure declared in a field initializer must use t… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 ssa; 5 part of ssa;
6 6
7 /** 7 /**
8 * A special element for the extra parameter taken by intercepted 8 * A special element for the extra parameter taken by intercepted
9 * methods. We need to override [Element.computeType] because our 9 * methods. We need to override [Element.computeType] because our
10 * optimizers may look at its declared type. 10 * optimizers may look at its declared type.
(...skipping 3137 matching lines...) Expand 10 before | Expand all | Expand 10 after
3148 /** 3148 /**
3149 * Helper to create an instruction that gets the value of a type variable. 3149 * Helper to create an instruction that gets the value of a type variable.
3150 */ 3150 */
3151 HInstruction addTypeVariableReference(TypeVariableType type) { 3151 HInstruction addTypeVariableReference(TypeVariableType type) {
3152 Element member = currentElement; 3152 Element member = currentElement;
3153 if (member.enclosingElement.isClosure()) { 3153 if (member.enclosingElement.isClosure()) {
3154 ClosureClassElement closureClass = member.enclosingElement; 3154 ClosureClassElement closureClass = member.enclosingElement;
3155 member = closureClass.methodElement; 3155 member = closureClass.methodElement;
3156 member = member.getOutermostEnclosingMemberOrTopLevel(); 3156 member = member.getOutermostEnclosingMemberOrTopLevel();
3157 } 3157 }
3158 if (member.isConstructor() || member.isGenerativeConstructorBody()) { 3158 if (member.isConstructor()
3159 || member.isGenerativeConstructorBody()
3160 || member.isField()) {
3159 // The type variable is stored in a parameter of the method. 3161 // The type variable is stored in a parameter of the method.
3160 return localsHandler.readLocal(type.element); 3162 return localsHandler.readLocal(type.element);
3161 } else if (member.isInstanceMember()) { 3163 } else if (member.isInstanceMember()) {
3162 // The type variable is stored on the object. Generate code to extract 3164 // The type variable is stored on the object. Generate code to extract
3163 // the type arguments from the object, substitute them as an instance 3165 // the type arguments from the object, substitute them as an instance
3164 // of the type we are testing against (if necessary), and extract the 3166 // of the type we are testing against (if necessary), and extract the
3165 // type argument by the index of the variable in the list of type 3167 // type argument by the index of the variable in the list of type
3166 // variables for that class. 3168 // variables for that class.
3167 int index = RuntimeTypeInformation.getTypeVariableIndex(type); 3169 int index = RuntimeTypeInformation.getTypeVariableIndex(type);
3168 HInstruction thisObject = localsHandler.readThis(); 3170 HInstruction thisObject = localsHandler.readThis();
(...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after
5082 new HSubGraphBlockInformation(elseBranch.graph)); 5084 new HSubGraphBlockInformation(elseBranch.graph));
5083 5085
5084 HBasicBlock conditionStartBlock = conditionBranch.block; 5086 HBasicBlock conditionStartBlock = conditionBranch.block;
5085 conditionStartBlock.setBlockFlow(info, joinBlock); 5087 conditionStartBlock.setBlockFlow(info, joinBlock);
5086 SubGraph conditionGraph = conditionBranch.graph; 5088 SubGraph conditionGraph = conditionBranch.graph;
5087 HIf branch = conditionGraph.end.last; 5089 HIf branch = conditionGraph.end.last;
5088 assert(branch is HIf); 5090 assert(branch is HIf);
5089 branch.blockInformation = conditionStartBlock.blockFlow; 5091 branch.blockInformation = conditionStartBlock.blockFlow;
5090 } 5092 }
5091 } 5093 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/closure.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698