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 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
984 bodyElement = backendMember; | 984 bodyElement = backendMember; |
985 break; | 985 break; |
986 } | 986 } |
987 } | 987 } |
988 } | 988 } |
989 if (bodyElement == null) { | 989 if (bodyElement == null) { |
990 bodyElement = new ConstructorBodyElement(constructor); | 990 bodyElement = new ConstructorBodyElement(constructor); |
991 // [:resolveMethodElement:] require the passed element to be a | 991 // [:resolveMethodElement:] require the passed element to be a |
992 // declaration. | 992 // declaration. |
993 TreeElements treeElements = | 993 TreeElements treeElements = |
994 compiler.resolver.resolveMethodElement(constructor.declaration); | 994 compiler.enqueuer.resolution.getCachedElements(constructor.declaration ); |
ahe
2012/10/23 16:13:24
Long line.
Johnni Winther
2012/10/26 07:40:02
Done.
| |
995 classElement.backendMembers = | 995 classElement.backendMembers = |
996 classElement.backendMembers.prepend(bodyElement); | 996 classElement.backendMembers.prepend(bodyElement); |
997 | 997 |
998 if (constructor.isPatch) { | 998 if (constructor.isPatch) { |
999 // Create origin body element for patched constructors. | 999 // Create origin body element for patched constructors. |
1000 bodyElement.origin = new ConstructorBodyElement(constructor.origin); | 1000 bodyElement.origin = new ConstructorBodyElement(constructor.origin); |
1001 bodyElement.origin.patch = bodyElement; | 1001 bodyElement.origin.patch = bodyElement; |
1002 classElement.origin.backendMembers = | 1002 classElement.origin.backendMembers = |
1003 classElement.origin.backendMembers.prepend(bodyElement.origin); | 1003 classElement.origin.backendMembers.prepend(bodyElement.origin); |
1004 } | 1004 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1154 // Don't forget to update the field, if the parameter is of the | 1154 // Don't forget to update the field, if the parameter is of the |
1155 // form [:this.x:]. | 1155 // form [:this.x:]. |
1156 if (parameter.kind == ElementKind.FIELD_PARAMETER) { | 1156 if (parameter.kind == ElementKind.FIELD_PARAMETER) { |
1157 FieldParameterElement fieldParameterElement = parameter; | 1157 FieldParameterElement fieldParameterElement = parameter; |
1158 fieldValues[fieldParameterElement.fieldElement] = argument; | 1158 fieldValues[fieldParameterElement.fieldElement] = argument; |
1159 } | 1159 } |
1160 }); | 1160 }); |
1161 | 1161 |
1162 // Build the initializers in the context of the new constructor. | 1162 // Build the initializers in the context of the new constructor. |
1163 TreeElements oldElements = elements; | 1163 TreeElements oldElements = elements; |
1164 elements = compiler.resolver.resolveMethodElement(constructor); | 1164 elements = |
1165 compiler.enqueuer.resolution.getCachedElements(constructor); | |
1165 buildInitializers(constructor, constructors, fieldValues); | 1166 buildInitializers(constructor, constructors, fieldValues); |
1166 elements = oldElements; | 1167 elements = oldElements; |
1167 }); | 1168 }); |
1168 } | 1169 } |
1169 | 1170 |
1170 /** | 1171 /** |
1171 * Run through the initializers and inline all field initializers. Recursively | 1172 * Run through the initializers and inline all field initializers. Recursively |
1172 * inlines super initializers. | 1173 * inlines super initializers. |
1173 * | 1174 * |
1174 * The constructors of the inlined initializers is added to [constructors] | 1175 * The constructors of the inlined initializers is added to [constructors] |
(...skipping 3323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4498 new HSubGraphBlockInformation(elseBranch.graph)); | 4499 new HSubGraphBlockInformation(elseBranch.graph)); |
4499 | 4500 |
4500 HBasicBlock conditionStartBlock = conditionBranch.block; | 4501 HBasicBlock conditionStartBlock = conditionBranch.block; |
4501 conditionStartBlock.setBlockFlow(info, joinBlock); | 4502 conditionStartBlock.setBlockFlow(info, joinBlock); |
4502 SubGraph conditionGraph = conditionBranch.graph; | 4503 SubGraph conditionGraph = conditionBranch.graph; |
4503 HIf branch = conditionGraph.end.last; | 4504 HIf branch = conditionGraph.end.last; |
4504 assert(branch is HIf); | 4505 assert(branch is HIf); |
4505 branch.blockInformation = conditionStartBlock.blockFlow; | 4506 branch.blockInformation = conditionStartBlock.blockFlow; |
4506 } | 4507 } |
4507 } | 4508 } |
OLD | NEW |