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

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

Issue 12220011: Handle malformed types in catch-on. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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/co19/co19-dart2js.status » ('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 4433 matching lines...) Expand 10 before | Expand all | Expand 10 after
4444 4444
4445 pushInvokeHelper1(backend.getExceptionUnwrapper(), exception); 4445 pushInvokeHelper1(backend.getExceptionUnwrapper(), exception);
4446 HInvokeStatic unwrappedException = pop(); 4446 HInvokeStatic unwrappedException = pop();
4447 tryInstruction.exception = exception; 4447 tryInstruction.exception = exception;
4448 Link<Node> link = node.catchBlocks.nodes; 4448 Link<Node> link = node.catchBlocks.nodes;
4449 4449
4450 void pushCondition(CatchBlock catchBlock) { 4450 void pushCondition(CatchBlock catchBlock) {
4451 if (catchBlock.onKeyword != null) { 4451 if (catchBlock.onKeyword != null) {
4452 DartType type = elements.getType(catchBlock.type); 4452 DartType type = elements.getType(catchBlock.type);
4453 if (type == null) { 4453 if (type == null) {
4454 compiler.cancel('On with unresolved type', 4454 compiler.cancel('On with no type',
ngeoffray 2013/02/05 09:43:46 Fits in one line?
Johnni Winther 2013/02/18 14:51:43 Done.
4455 node: catchBlock.type); 4455 node: catchBlock.type);
4456 } 4456 }
4457 HInstruction condition = 4457 if (type.isMalformed) {
4458 new HIs(type, <HInstruction>[unwrappedException]); 4458 HInstruction condition =
4459 push(condition); 4459 graph.addConstantBool(false, constantSystem);
ngeoffray 2013/02/05 09:43:46 Fits in one line?
Johnni Winther 2013/02/18 14:51:43 :( No.
4460 stack.add(condition);
ahe 2013/02/05 09:58:39 Am I understanding this correctly: the specificati
karlklose 2013/02/05 10:21:45 Shouldn't we treat any malformed type as dynamic a
4461 } else {
4462 HInstruction condition =
4463 new HIs(type, <HInstruction>[unwrappedException]);
4464 push(condition);
4465 }
4460 } 4466 }
4461 else { 4467 else {
4462 VariableDefinitions declaration = catchBlock.formals.nodes.head; 4468 VariableDefinitions declaration = catchBlock.formals.nodes.head;
4463 HInstruction condition = null; 4469 HInstruction condition = null;
4464 if (declaration.type == null) { 4470 if (declaration.type == null) {
4465 condition = graph.addConstantBool(true, constantSystem); 4471 condition = graph.addConstantBool(true, constantSystem);
4466 stack.add(condition); 4472 stack.add(condition);
4467 } else { 4473 } else {
4468 // TODO(aprelev@gmail.com): Once old catch syntax is removed 4474 // TODO(aprelev@gmail.com): Once old catch syntax is removed
4469 // "if" condition above and this "else" branch should be deleted as 4475 // "if" condition above and this "else" branch should be deleted as
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
5001 new HSubGraphBlockInformation(elseBranch.graph)); 5007 new HSubGraphBlockInformation(elseBranch.graph));
5002 5008
5003 HBasicBlock conditionStartBlock = conditionBranch.block; 5009 HBasicBlock conditionStartBlock = conditionBranch.block;
5004 conditionStartBlock.setBlockFlow(info, joinBlock); 5010 conditionStartBlock.setBlockFlow(info, joinBlock);
5005 SubGraph conditionGraph = conditionBranch.graph; 5011 SubGraph conditionGraph = conditionBranch.graph;
5006 HIf branch = conditionGraph.end.last; 5012 HIf branch = conditionGraph.end.last;
5007 assert(branch is HIf); 5013 assert(branch is HIf);
5008 branch.blockInformation = conditionStartBlock.blockFlow; 5014 branch.blockInformation = conditionStartBlock.blockFlow;
5009 } 5015 }
5010 } 5016 }
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698