| 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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 /** | 810 /** |
| 811 * Returns the constructor body associated with the given constructor or | 811 * Returns the constructor body associated with the given constructor or |
| 812 * creates a new constructor body, if none can be found. | 812 * creates a new constructor body, if none can be found. |
| 813 * | 813 * |
| 814 * Returns [:null:] if the constructor does not have a body. | 814 * Returns [:null:] if the constructor does not have a body. |
| 815 */ | 815 */ |
| 816 ConstructorBodyElement getConstructorBody(FunctionElement constructor) { | 816 ConstructorBodyElement getConstructorBody(FunctionElement constructor) { |
| 817 assert(constructor.kind === ElementKind.GENERATIVE_CONSTRUCTOR); | 817 assert(constructor.kind === ElementKind.GENERATIVE_CONSTRUCTOR); |
| 818 if (constructor is SynthesizedConstructorElement) return null; | 818 if (constructor is SynthesizedConstructorElement) return null; |
| 819 FunctionExpression node = constructor.parseNode(compiler); | 819 FunctionExpression node = constructor.parseNode(compiler); |
| 820 if (!node.hasBody()) return null; | 820 // If we know the body doesn't have any code, we don't generate |
| 821 // it. |
| 822 if (node.body.asBlock() !== null) { |
| 823 NodeList statements = node.body.asBlock().statements; |
| 824 if (statements.isEmpty()) return null; |
| 825 } |
| 821 ClassElement classElement = constructor.enclosingElement; | 826 ClassElement classElement = constructor.enclosingElement; |
| 822 ConstructorBodyElement bodyElement; | 827 ConstructorBodyElement bodyElement; |
| 823 for (Link<Element> backendMembers = classElement.backendMembers; | 828 for (Link<Element> backendMembers = classElement.backendMembers; |
| 824 !backendMembers.isEmpty(); | 829 !backendMembers.isEmpty(); |
| 825 backendMembers = backendMembers.tail) { | 830 backendMembers = backendMembers.tail) { |
| 826 Element backendMember = backendMembers.head; | 831 Element backendMember = backendMembers.head; |
| 827 if (backendMember.kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY) { | 832 if (backendMember.kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY) { |
| 828 ConstructorBodyElement body = backendMember; | 833 ConstructorBodyElement body = backendMember; |
| 829 if (body.constructor == constructor) { | 834 if (body.constructor == constructor) { |
| 830 bodyElement = backendMember; | 835 bodyElement = backendMember; |
| (...skipping 2480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3311 <HInstruction>[target, input], | 3316 <HInstruction>[target, input], |
| 3312 HType.STRING)); | 3317 HType.STRING)); |
| 3313 return builder.pop(); | 3318 return builder.pop(); |
| 3314 } | 3319 } |
| 3315 | 3320 |
| 3316 HInstruction result() { | 3321 HInstruction result() { |
| 3317 flushLiterals(); | 3322 flushLiterals(); |
| 3318 return prefix; | 3323 return prefix; |
| 3319 } | 3324 } |
| 3320 } | 3325 } |
| OLD | NEW |