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

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

Issue 11416144: Produce run-time error when type parameters are accessed from static context. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed redundant malformed type replacement with dynamic type. Created 8 years, 1 month 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 3425 matching lines...) Expand 10 before | Expand all | Expand 10 after
3436 existingArguments.add(parameter.name.slowToString()); 3436 existingArguments.add(parameter.name.slowToString());
3437 }); 3437 });
3438 generateThrowNoSuchMethod(diagnosticNode, 3438 generateThrowNoSuchMethod(diagnosticNode,
3439 function.name.slowToString(), 3439 function.name.slowToString(),
3440 argumentNodes: argumentNodes, 3440 argumentNodes: argumentNodes,
3441 existingArguments: existingArguments); 3441 existingArguments: existingArguments);
3442 } 3442 }
3443 3443
3444 visitNewExpression(NewExpression node) { 3444 visitNewExpression(NewExpression node) {
3445 Element element = elements[node.send]; 3445 Element element = elements[node.send];
3446 if (!Elements.isErroneousElement(element)) { 3446 if (!Elements.isErroneousElement(element) &&
3447 !Elements.isMalformedElement(element)) {
ngeoffray 2012/11/27 09:37:35 !Elements.isUnresolved ?
aam-me 2012/11/28 01:49:47 Yes, agree. Good idea.
3447 FunctionElement function = element; 3448 FunctionElement function = element;
3448 element = function.redirectionTarget; 3449 element = function.redirectionTarget;
3449 } 3450 }
3450 if (Elements.isErroneousElement(element)) { 3451 if (Elements.isErroneousElement(element)) {
3451 ErroneousElement error = element; 3452 ErroneousElement error = element;
3452 if (error.messageKind == MessageKind.CANNOT_FIND_CONSTRUCTOR) { 3453 if (error.messageKind == MessageKind.CANNOT_FIND_CONSTRUCTOR) {
3453 generateThrowNoSuchMethod(node.send, 3454 generateThrowNoSuchMethod(node.send,
3454 getTargetName(error, 'constructor'), 3455 getTargetName(error, 'constructor'),
3455 argumentNodes: node.send.arguments); 3456 argumentNodes: node.send.arguments);
3456 } else if (error.messageKind == MessageKind.CANNOT_RESOLVE) { 3457 } else if (error.messageKind == MessageKind.CANNOT_RESOLVE) {
3457 Message message = error.messageKind.message(error.messageArguments); 3458 Message message = error.messageKind.message(error.messageArguments);
3458 generateRuntimeError(node.send, message.toString()); 3459 generateRuntimeError(node.send, message.toString());
3459 } else { 3460 } else {
3460 compiler.internalError('unexpected unresolved constructor call', 3461 compiler.internalError('unexpected unresolved constructor call',
3461 node: node); 3462 node: node);
3462 } 3463 }
3463 } else if (node.isConst()) { 3464 } else if (node.isConst()) {
3464 // TODO(karlklose): add type representation 3465 // TODO(karlklose): add type representation
3465 ConstantHandler handler = compiler.constantHandler; 3466 ConstantHandler handler = compiler.constantHandler;
3466 Constant constant = handler.compileNodeWithDefinitions(node, elements); 3467 Constant constant = handler.compileNodeWithDefinitions(node, elements);
3467 stack.add(graph.addConstant(constant)); 3468 stack.add(graph.addConstant(constant));
3469 } else if (Elements.isMalformedElement(element)) {
3470 Message message =
3471 MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER.message([element]);
3472 generateRuntimeError(node.send, message.toString());
3468 } else { 3473 } else {
3469 visitNewSend(node.send, elements.getType(node)); 3474 visitNewSend(node.send, elements.getType(node));
3470 } 3475 }
3471 } 3476 }
3472 3477
3473 visitSendSet(SendSet node) { 3478 visitSendSet(SendSet node) {
3474 Element element = elements[node]; 3479 Element element = elements[node];
3475 if (!Elements.isUnresolved(element) && element.impliesType()) { 3480 if (!Elements.isUnresolved(element) && element.impliesType()) {
3476 Identifier selector = node.selector; 3481 Identifier selector = node.selector;
3477 generateThrowNoSuchMethod(node, selector.source.slowToString(), 3482 generateThrowNoSuchMethod(node, selector.source.slowToString(),
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
4910 new HSubGraphBlockInformation(elseBranch.graph)); 4915 new HSubGraphBlockInformation(elseBranch.graph));
4911 4916
4912 HBasicBlock conditionStartBlock = conditionBranch.block; 4917 HBasicBlock conditionStartBlock = conditionBranch.block;
4913 conditionStartBlock.setBlockFlow(info, joinBlock); 4918 conditionStartBlock.setBlockFlow(info, joinBlock);
4914 SubGraph conditionGraph = conditionBranch.graph; 4919 SubGraph conditionGraph = conditionBranch.graph;
4915 HIf branch = conditionGraph.end.last; 4920 HIf branch = conditionGraph.end.last;
4916 assert(branch is HIf); 4921 assert(branch is HIf);
4917 branch.blockInformation = conditionStartBlock.blockFlow; 4922 branch.blockInformation = conditionStartBlock.blockFlow;
4918 } 4923 }
4919 } 4924 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698