| 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 import 'dart:collection'; | 5 import 'dart:collection'; |
| 6 | 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart'; | 7 import 'package:js_runtime/shared/embedded_names.dart'; |
| 8 | 8 |
| 9 import '../closure.dart'; | 9 import '../closure.dart'; |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 // Build the initializers in the context of the new constructor. | 1028 // Build the initializers in the context of the new constructor. |
| 1029 ResolvedAst oldResolvedAst = resolvedAst; | 1029 ResolvedAst oldResolvedAst = resolvedAst; |
| 1030 resolvedAst = callee.resolvedAst; | 1030 resolvedAst = callee.resolvedAst; |
| 1031 final oldElementInferenceResults = elementInferenceResults; | 1031 final oldElementInferenceResults = elementInferenceResults; |
| 1032 elementInferenceResults = globalInferenceResults.resultOfMember(callee); | 1032 elementInferenceResults = globalInferenceResults.resultOfMember(callee); |
| 1033 ClosureClassMap oldClosureData = localsHandler.closureData; | 1033 ClosureClassMap oldClosureData = localsHandler.closureData; |
| 1034 ClosureClassMap newClosureData = | 1034 ClosureClassMap newClosureData = |
| 1035 closureToClassMapper.getMemberMap(callee); | 1035 closureToClassMapper.getMemberMap(callee); |
| 1036 localsHandler.closureData = newClosureData; | 1036 localsHandler.closureData = newClosureData; |
| 1037 if (resolvedAst.kind == ResolvedAstKind.PARSED) { | 1037 if (resolvedAst.kind == ResolvedAstKind.PARSED) { |
| 1038 localsHandler.enterScope(resolvedAst.node, | 1038 localsHandler.enterScope( |
| 1039 newClosureData.capturingScopes[resolvedAst.node], |
| 1039 forGenerativeConstructorBody: callee.isGenerativeConstructorBody); | 1040 forGenerativeConstructorBody: callee.isGenerativeConstructorBody); |
| 1040 } | 1041 } |
| 1041 buildInitializers(callee, constructorResolvedAsts, fieldValues); | 1042 buildInitializers(callee, constructorResolvedAsts, fieldValues); |
| 1042 localsHandler.closureData = oldClosureData; | 1043 localsHandler.closureData = oldClosureData; |
| 1043 resolvedAst = oldResolvedAst; | 1044 resolvedAst = oldResolvedAst; |
| 1044 elementInferenceResults = oldElementInferenceResults; | 1045 elementInferenceResults = oldElementInferenceResults; |
| 1045 }); | 1046 }); |
| 1046 } | 1047 } |
| 1047 | 1048 |
| 1048 void buildInitializers( | 1049 void buildInitializers( |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1433 /** | 1434 /** |
| 1434 * Documentation wanted -- johnniwinther | 1435 * Documentation wanted -- johnniwinther |
| 1435 * | 1436 * |
| 1436 * Invariant: [functionElement] must be the implementation element. | 1437 * Invariant: [functionElement] must be the implementation element. |
| 1437 */ | 1438 */ |
| 1438 void openFunction(MemberElement element, ast.Node node) { | 1439 void openFunction(MemberElement element, ast.Node node) { |
| 1439 assert(element.isImplementation, failedAt(element)); | 1440 assert(element.isImplementation, failedAt(element)); |
| 1440 HBasicBlock block = graph.addNewBlock(); | 1441 HBasicBlock block = graph.addNewBlock(); |
| 1441 open(graph.entry); | 1442 open(graph.entry); |
| 1442 | 1443 |
| 1443 localsHandler.startFunction(element, node, | 1444 Map<Local, TypeMask> parameters = <Local, TypeMask>{}; |
| 1445 if (element is MethodElement) { |
| 1446 element.functionSignature |
| 1447 .orderedForEachParameter((ParameterElement parameter) { |
| 1448 parameters[parameter] = TypeMaskFactory.inferredTypeForParameter( |
| 1449 parameter, globalInferenceResults); |
| 1450 }); |
| 1451 } |
| 1452 |
| 1453 ClosureClassMap closureData = closureToClassMapper.getMemberMap(element); |
| 1454 localsHandler.startFunction( |
| 1455 element, closureData, closureData.capturingScopes[node], parameters, |
| 1444 isGenerativeConstructorBody: element.isGenerativeConstructorBody); | 1456 isGenerativeConstructorBody: element.isGenerativeConstructorBody); |
| 1445 close(new HGoto()).addSuccessor(block); | 1457 close(new HGoto()).addSuccessor(block); |
| 1446 | 1458 |
| 1447 open(block); | 1459 open(block); |
| 1448 | 1460 |
| 1449 // Add the type parameters of the class as parameters of this method. This | 1461 // Add the type parameters of the class as parameters of this method. This |
| 1450 // must be done before adding the normal parameters, because their types | 1462 // must be done before adding the normal parameters, because their types |
| 1451 // may contain references to type variables. | 1463 // may contain references to type variables. |
| 1452 ClassElement cls = element.enclosingClass; | 1464 ClassElement cls = element.enclosingClass; |
| 1453 if ((element.isConstructor || element.isGenerativeConstructorBody) && | 1465 if ((element.isConstructor || element.isGenerativeConstructorBody) && |
| (...skipping 5370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6824 this.oldReturnLocal, | 6836 this.oldReturnLocal, |
| 6825 this.oldReturnType, | 6837 this.oldReturnType, |
| 6826 this.oldResolvedAst, | 6838 this.oldResolvedAst, |
| 6827 this.oldStack, | 6839 this.oldStack, |
| 6828 this.oldLocalsHandler, | 6840 this.oldLocalsHandler, |
| 6829 this.inTryStatement, | 6841 this.inTryStatement, |
| 6830 this.allFunctionsCalledOnce, | 6842 this.allFunctionsCalledOnce, |
| 6831 this.oldElementInferenceResults) | 6843 this.oldElementInferenceResults) |
| 6832 : super(function); | 6844 : super(function); |
| 6833 } | 6845 } |
| OLD | NEW |