| 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 class Interceptors { | 5 class Interceptors { |
| 6 Compiler compiler; | 6 Compiler compiler; |
| 7 Interceptors(Compiler this.compiler); | 7 Interceptors(Compiler this.compiler); |
| 8 | 8 |
| 9 SourceString mapOperatorToMethodName(Operator op) { | 9 SourceString mapOperatorToMethodName(Operator op) { |
| 10 String name = op.source.stringValue; | 10 String name = op.source.stringValue; |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 * Run through the initializers and inline all field initializers. Returns the | 540 * Run through the initializers and inline all field initializers. Returns the |
| 541 * next constructor to analyze. | 541 * next constructor to analyze. |
| 542 */ | 542 */ |
| 543 FunctionElement analyzeInitializers(Link<Node> initializers) { | 543 FunctionElement analyzeInitializers(Link<Node> initializers) { |
| 544 FunctionElement nextConstructor; | 544 FunctionElement nextConstructor; |
| 545 for (Link<Node> link = initializers; !link.isEmpty(); link = link.tail) { | 545 for (Link<Node> link = initializers; !link.isEmpty(); link = link.tail) { |
| 546 assert(link.head is Send); | 546 assert(link.head is Send); |
| 547 if (link.head is !SendSet) { | 547 if (link.head is !SendSet) { |
| 548 // A super initializer or constructor redirection. | 548 // A super initializer or constructor redirection. |
| 549 Send call = link.head; | 549 Send call = link.head; |
| 550 if (Initializers.isSuperConstructorCall(call)) { | 550 assert(Initializers.isSuperConstructorCall(call) || |
| 551 assert(nextConstructor === null); | 551 Initializers.isConstructorRedirect(call)); |
| 552 nextConstructor = elements[call]; | 552 assert(nextConstructor === null); |
| 553 // Visit arguments and map the corresponding parameter value to | 553 nextConstructor = elements[call]; |
| 554 // the resulting HInstruction value. | 554 // Visit arguments and map the corresponding parameter value to |
| 555 forEachArgument(call, nextConstructor, (parameter, node) { | 555 // the resulting HInstruction value. |
| 556 visit(node); | 556 forEachArgument(call, nextConstructor, (parameter, node) { |
| 557 HInstruction value = pop(); | 557 visit(node); |
| 558 localsHandler.updateLocal(parameter, value); | 558 HInstruction value = pop(); |
| 559 }); | 559 localsHandler.updateLocal(parameter, value); |
| 560 } else { | 560 }); |
| 561 compiler.unimplemented('SsaBuilder.buildFactory redirect'); | |
| 562 } | |
| 563 } else { | 561 } else { |
| 564 // A field initializer. | 562 // A field initializer. |
| 565 SendSet init = link.head; | 563 SendSet init = link.head; |
| 566 Link<Node> arguments = init.arguments; | 564 Link<Node> arguments = init.arguments; |
| 567 assert(!arguments.isEmpty() && arguments.tail.isEmpty()); | 565 assert(!arguments.isEmpty() && arguments.tail.isEmpty()); |
| 568 visit(arguments.head); | 566 visit(arguments.head); |
| 569 // We treat the init field-elements like locals. In the context of | 567 // We treat the init field-elements like locals. In the context of |
| 570 // the factory this is correct, and simplifies dealing with | 568 // the factory this is correct, and simplifies dealing with |
| 571 // parameter-initializers (like A(this.x)). | 569 // parameter-initializers (like A(this.x)). |
| 572 localsHandler.updateLocal(elements[init], pop()); | 570 localsHandler.updateLocal(elements[init], pop()); |
| (...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1967 } | 1965 } |
| 1968 | 1966 |
| 1969 visitCatchBlock(CatchBlock node) { | 1967 visitCatchBlock(CatchBlock node) { |
| 1970 visit(node.block); | 1968 visit(node.block); |
| 1971 } | 1969 } |
| 1972 | 1970 |
| 1973 visitTypedef(Typedef node) { | 1971 visitTypedef(Typedef node) { |
| 1974 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); | 1972 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); |
| 1975 } | 1973 } |
| 1976 } | 1974 } |
| OLD | NEW |