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

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

Issue 17112020: Fix an off by one AST node error, when fetching the type of a new List constructor. (Closed) Base URL: http://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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/compiler/dart2js/list_tracer_node_type_test.dart » ('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) 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 3333 matching lines...) Expand 10 before | Expand all | Expand 10 after
3344 assert(invariant(send, 3344 assert(invariant(send,
3345 !compiler.enableTypeAssertions || !type.isMalformed, 3345 !compiler.enableTypeAssertions || !type.isMalformed,
3346 message: '$type is malformed in checked mode')); 3346 message: '$type is malformed in checked mode'));
3347 bool isListConstructor = false; 3347 bool isListConstructor = false;
3348 computeType(element) { 3348 computeType(element) {
3349 Element originalElement = elements[send]; 3349 Element originalElement = elements[send];
3350 if (Elements.isFixedListConstructorCall( 3350 if (Elements.isFixedListConstructorCall(
3351 originalElement, send, compiler)) { 3351 originalElement, send, compiler)) {
3352 isListConstructor = true; 3352 isListConstructor = true;
3353 HType inferred = 3353 HType inferred =
3354 new HType.inferredForNode(currentElement, node, compiler); 3354 new HType.inferredForNode(currentElement, send, compiler);
3355 return inferred.isUnknown() ? backend.fixedArrayType : inferred; 3355 return inferred.isUnknown() ? backend.fixedArrayType : inferred;
3356 } else if (Elements.isGrowableListConstructorCall( 3356 } else if (Elements.isGrowableListConstructorCall(
3357 originalElement, send, compiler)) { 3357 originalElement, send, compiler)) {
3358 isListConstructor = true; 3358 isListConstructor = true;
3359 HType inferred = 3359 HType inferred =
3360 new HType.inferredForNode(currentElement, node, compiler); 3360 new HType.inferredForNode(currentElement, send, compiler);
3361 return inferred.isUnknown() ? backend.extendableArrayType : inferred; 3361 return inferred.isUnknown() ? backend.extendableArrayType : inferred;
3362 } else if (element.isGenerativeConstructor()) { 3362 } else if (element.isGenerativeConstructor()) {
3363 ClassElement cls = element.getEnclosingClass(); 3363 ClassElement cls = element.getEnclosingClass();
3364 return new HType.nonNullExact(cls.thisType, compiler); 3364 return new HType.nonNullExact(cls.thisType, compiler);
3365 } else { 3365 } else {
3366 return new HType.inferredTypeForElement(originalElement, compiler); 3366 return new HType.inferredTypeForElement(originalElement, compiler);
3367 } 3367 }
3368 } 3368 }
3369 3369
3370 Element constructor = elements[send]; 3370 Element constructor = elements[send];
(...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after
5397 new HSubGraphBlockInformation(elseBranch.graph)); 5397 new HSubGraphBlockInformation(elseBranch.graph));
5398 5398
5399 HBasicBlock conditionStartBlock = conditionBranch.block; 5399 HBasicBlock conditionStartBlock = conditionBranch.block;
5400 conditionStartBlock.setBlockFlow(info, joinBlock); 5400 conditionStartBlock.setBlockFlow(info, joinBlock);
5401 SubGraph conditionGraph = conditionBranch.graph; 5401 SubGraph conditionGraph = conditionBranch.graph;
5402 HIf branch = conditionGraph.end.last; 5402 HIf branch = conditionGraph.end.last;
5403 assert(branch is HIf); 5403 assert(branch is HIf);
5404 branch.blockInformation = conditionStartBlock.blockFlow; 5404 branch.blockInformation = conditionStartBlock.blockFlow;
5405 } 5405 }
5406 } 5406 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/list_tracer_node_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698