Chromium Code Reviews| 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 3471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3482 existingArguments.add(parameter.name.slowToString()); | 3482 existingArguments.add(parameter.name.slowToString()); |
| 3483 }); | 3483 }); |
| 3484 generateThrowNoSuchMethod(diagnosticNode, | 3484 generateThrowNoSuchMethod(diagnosticNode, |
| 3485 function.name.slowToString(), | 3485 function.name.slowToString(), |
| 3486 argumentNodes: argumentNodes, | 3486 argumentNodes: argumentNodes, |
| 3487 existingArguments: existingArguments); | 3487 existingArguments: existingArguments); |
| 3488 } | 3488 } |
| 3489 | 3489 |
| 3490 visitNewExpression(NewExpression node) { | 3490 visitNewExpression(NewExpression node) { |
| 3491 Element element = elements[node.send]; | 3491 Element element = elements[node.send]; |
| 3492 if (!Elements.isErroneousElement(element)) { | 3492 if (!Elements.isErroneousElement(element) && |
| 3493 !Elements.isMalformedElement(element)) { | |
| 3493 FunctionElement function = element; | 3494 FunctionElement function = element; |
| 3494 element = function.redirectionTarget; | 3495 element = function.redirectionTarget; |
| 3495 } | 3496 } |
| 3496 if (Elements.isErroneousElement(element)) { | 3497 if (Elements.isErroneousElement(element)) { |
| 3497 ErroneousElement error = element; | 3498 ErroneousElement error = element; |
| 3498 if (error.messageKind == MessageKind.CANNOT_FIND_CONSTRUCTOR) { | 3499 if (error.messageKind == MessageKind.CANNOT_FIND_CONSTRUCTOR) { |
| 3499 generateThrowNoSuchMethod(node.send, | 3500 generateThrowNoSuchMethod(node.send, |
| 3500 getTargetName(error, 'constructor'), | 3501 getTargetName(error, 'constructor'), |
| 3501 argumentNodes: node.send.arguments); | 3502 argumentNodes: node.send.arguments); |
| 3502 } else if (error.messageKind == MessageKind.CANNOT_RESOLVE) { | 3503 } else if (error.messageKind == MessageKind.CANNOT_RESOLVE) { |
| 3503 Message message = error.messageKind.message(error.messageArguments); | 3504 Message message = error.messageKind.message(error.messageArguments); |
| 3504 generateRuntimeError(node.send, message.toString()); | 3505 generateRuntimeError(node.send, message.toString()); |
| 3505 } else { | 3506 } else { |
| 3506 compiler.internalError('unexpected unresolved constructor call', | 3507 compiler.internalError('unexpected unresolved constructor call', |
| 3507 node: node); | 3508 node: node); |
| 3508 } | 3509 } |
| 3509 } else if (node.isConst()) { | 3510 } else if (node.isConst()) { |
| 3510 // TODO(karlklose): add type representation | 3511 // TODO(karlklose): add type representation |
| 3511 ConstantHandler handler = compiler.constantHandler; | 3512 ConstantHandler handler = compiler.constantHandler; |
| 3512 Constant constant = handler.compileNodeWithDefinitions(node, elements); | 3513 Constant constant = handler.compileNodeWithDefinitions(node, elements); |
| 3513 stack.add(graph.addConstant(constant)); | 3514 stack.add(graph.addConstant(constant)); |
| 3515 } else if (Elements.isMalformedElement(element)) { | |
| 3516 Message message = new ResolutionWarning(MessageKind.TYPE_VARIABLE_WITHIN_S TATIC_MEMBER, | |
|
ahe
2012/11/22 12:41:30
Long line.
ahe
2012/11/22 12:41:30
Alternatively:
MessageKind.TYPE_VARIABLE_WITHIN_S
aam-me
2012/11/23 02:16:47
Done.
| |
| 3517 [element]); | |
| 3518 generateRuntimeError(node.send, message.toString()); | |
| 3514 } else { | 3519 } else { |
| 3515 visitNewSend(node.send, elements.getType(node)); | 3520 visitNewSend(node.send, elements.getType(node)); |
| 3516 } | 3521 } |
| 3517 } | 3522 } |
| 3518 | 3523 |
| 3519 visitSendSet(SendSet node) { | 3524 visitSendSet(SendSet node) { |
| 3520 Element element = elements[node]; | 3525 Element element = elements[node]; |
| 3521 if (!Elements.isUnresolved(element) && element.impliesType()) { | 3526 if (!Elements.isUnresolved(element) && element.impliesType()) { |
| 3522 Identifier selector = node.selector; | 3527 Identifier selector = node.selector; |
| 3523 generateThrowNoSuchMethod(node, selector.source.slowToString(), | 3528 generateThrowNoSuchMethod(node, selector.source.slowToString(), |
| (...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4959 new HSubGraphBlockInformation(elseBranch.graph)); | 4964 new HSubGraphBlockInformation(elseBranch.graph)); |
| 4960 | 4965 |
| 4961 HBasicBlock conditionStartBlock = conditionBranch.block; | 4966 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 4962 conditionStartBlock.setBlockFlow(info, joinBlock); | 4967 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 4963 SubGraph conditionGraph = conditionBranch.graph; | 4968 SubGraph conditionGraph = conditionBranch.graph; |
| 4964 HIf branch = conditionGraph.end.last; | 4969 HIf branch = conditionGraph.end.last; |
| 4965 assert(branch is HIf); | 4970 assert(branch is HIf); |
| 4966 branch.blockInformation = conditionStartBlock.blockFlow; | 4971 branch.blockInformation = conditionStartBlock.blockFlow; |
| 4967 } | 4972 } |
| 4968 } | 4973 } |
| OLD | NEW |