| OLD | NEW |
| 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 3412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3423 existingArguments.add(parameter.name.slowToString()); | 3423 existingArguments.add(parameter.name.slowToString()); |
| 3424 }); | 3424 }); |
| 3425 generateThrowNoSuchMethod(diagnosticNode, | 3425 generateThrowNoSuchMethod(diagnosticNode, |
| 3426 function.name.slowToString(), | 3426 function.name.slowToString(), |
| 3427 argumentNodes: argumentNodes, | 3427 argumentNodes: argumentNodes, |
| 3428 existingArguments: existingArguments); | 3428 existingArguments: existingArguments); |
| 3429 } | 3429 } |
| 3430 | 3430 |
| 3431 visitNewExpression(NewExpression node) { | 3431 visitNewExpression(NewExpression node) { |
| 3432 Element element = elements[node.send]; | 3432 Element element = elements[node.send]; |
| 3433 if (!Elements.isErroneousElement(element) && | 3433 if (!Elements.isUnresolved(element)) { |
| 3434 !Elements.isMalformedElement(element)) { | |
| 3435 FunctionElement function = element; | 3434 FunctionElement function = element; |
| 3436 element = function.redirectionTarget; | 3435 element = function.redirectionTarget; |
| 3437 } | 3436 } |
| 3438 if (Elements.isErroneousElement(element)) { | 3437 if (Elements.isErroneousElement(element)) { |
| 3439 ErroneousElement error = element; | 3438 ErroneousElement error = element; |
| 3440 if (error.messageKind == MessageKind.CANNOT_FIND_CONSTRUCTOR) { | 3439 if (error.messageKind == MessageKind.CANNOT_FIND_CONSTRUCTOR) { |
| 3441 generateThrowNoSuchMethod(node.send, | 3440 generateThrowNoSuchMethod(node.send, |
| 3442 getTargetName(error, 'constructor'), | 3441 getTargetName(error, 'constructor'), |
| 3443 argumentNodes: node.send.arguments); | 3442 argumentNodes: node.send.arguments); |
| 3444 } else if (error.messageKind == MessageKind.CANNOT_RESOLVE) { | 3443 } else if (error.messageKind == MessageKind.CANNOT_RESOLVE) { |
| 3445 Message message = error.messageKind.message(error.messageArguments); | 3444 Message message = error.messageKind.message(error.messageArguments); |
| 3446 generateRuntimeError(node.send, message.toString()); | 3445 generateRuntimeError(node.send, message.toString()); |
| 3447 } else { | 3446 } else { |
| 3448 compiler.internalError('unexpected unresolved constructor call', | 3447 compiler.internalError('unexpected unresolved constructor call', |
| 3449 node: node); | 3448 node: node); |
| 3450 } | 3449 } |
| 3451 } else if (node.isConst()) { | 3450 } else if (node.isConst()) { |
| 3452 // TODO(karlklose): add type representation | 3451 // TODO(karlklose): add type representation |
| 3453 ConstantHandler handler = compiler.constantHandler; | 3452 ConstantHandler handler = compiler.constantHandler; |
| 3454 Constant constant = handler.compileNodeWithDefinitions(node, elements); | 3453 Constant constant = handler.compileNodeWithDefinitions(node, elements); |
| 3455 stack.add(graph.addConstant(constant)); | 3454 stack.add(graph.addConstant(constant)); |
| 3456 } else if (Elements.isMalformedElement(element)) { | |
| 3457 Message message = | |
| 3458 MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER.message([element]); | |
| 3459 generateRuntimeError(node.send, message.toString()); | |
| 3460 } else { | 3455 } else { |
| 3461 visitNewSend(node.send, elements.getType(node)); | 3456 DartType dartType = elements.getType(node); |
| 3457 if (dartType.kind == TypeKind.MALFORMED_TYPE && |
| 3458 compiler.enableTypeAssertions) { |
| 3459 Message message = MessageKind.MALFORMED_TYPE_REFERENCE.message([node]); |
| 3460 generateRuntimeError(node.send, message.toString()); |
| 3461 } else { |
| 3462 visitNewSend(node.send, dartType); |
| 3463 } |
| 3462 } | 3464 } |
| 3463 } | 3465 } |
| 3464 | 3466 |
| 3465 visitSendSet(SendSet node) { | 3467 visitSendSet(SendSet node) { |
| 3466 Element element = elements[node]; | 3468 Element element = elements[node]; |
| 3467 if (!Elements.isUnresolved(element) && element.impliesType()) { | 3469 if (!Elements.isUnresolved(element) && element.impliesType()) { |
| 3468 Identifier selector = node.selector; | 3470 Identifier selector = node.selector; |
| 3469 generateThrowNoSuchMethod(node, selector.source.slowToString(), | 3471 generateThrowNoSuchMethod(node, selector.source.slowToString(), |
| 3470 argumentNodes: node.arguments); | 3472 argumentNodes: node.arguments); |
| 3471 return; | 3473 return; |
| (...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4902 new HSubGraphBlockInformation(elseBranch.graph)); | 4904 new HSubGraphBlockInformation(elseBranch.graph)); |
| 4903 | 4905 |
| 4904 HBasicBlock conditionStartBlock = conditionBranch.block; | 4906 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 4905 conditionStartBlock.setBlockFlow(info, joinBlock); | 4907 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 4906 SubGraph conditionGraph = conditionBranch.graph; | 4908 SubGraph conditionGraph = conditionBranch.graph; |
| 4907 HIf branch = conditionGraph.end.last; | 4909 HIf branch = conditionGraph.end.last; |
| 4908 assert(branch is HIf); | 4910 assert(branch is HIf); |
| 4909 branch.blockInformation = conditionStartBlock.blockFlow; | 4911 branch.blockInformation = conditionStartBlock.blockFlow; |
| 4910 } | 4912 } |
| 4911 } | 4913 } |
| OLD | NEW |