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 /** | 5 /** |
| 6 * The [ConstantHandler] keeps track of compile-time constants, | 6 * The [ConstantHandler] keeps track of compile-time constants, |
| 7 * initializations of global and static fields, and default values of | 7 * initializations of global and static fields, and default values of |
| 8 * optional parameters. | 8 * optional parameters. |
| 9 */ | 9 */ |
| 10 class ConstantHandler extends CompilerTask { | 10 class ConstantHandler extends CompilerTask { |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 746 | 746 |
| 747 if (!foundSuperOrRedirect) { | 747 if (!foundSuperOrRedirect) { |
| 748 // No super initializer found. Try to find the default constructor if | 748 // No super initializer found. Try to find the default constructor if |
| 749 // the class is not Object. | 749 // the class is not Object. |
| 750 ClassElement enclosingClass = constructor.getEnclosingClass(); | 750 ClassElement enclosingClass = constructor.getEnclosingClass(); |
| 751 ClassElement superClass = enclosingClass.superclass; | 751 ClassElement superClass = enclosingClass.superclass; |
| 752 if (enclosingClass != compiler.objectClass) { | 752 if (enclosingClass != compiler.objectClass) { |
| 753 assert(superClass !== null); | 753 assert(superClass !== null); |
| 754 assert(superClass.resolutionState == STATE_DONE); | 754 assert(superClass.resolutionState == STATE_DONE); |
| 755 FunctionElement targetConstructor = | 755 FunctionElement targetConstructor = |
| 756 superClass.lookupConstructor(superClass.name); | 756 superClass.lookupConstructor(enclosingClass.getLibrary(), |
|
kasperl
2012/09/19 05:59:17
Could we start using the selector to lookup the co
| |
| 757 superClass.name); | |
| 757 if (targetConstructor === null) { | 758 if (targetConstructor === null) { |
| 758 compiler.internalError("no default constructor available", | 759 compiler.internalError("no default constructor available", |
| 759 node: functionNode); | 760 node: functionNode); |
| 760 } | 761 } |
| 761 | 762 |
| 762 Selector selector = new Selector.call(superClass.name, | 763 Selector selector = new Selector.call(superClass.name, |
| 763 enclosingClass.getLibrary(), | 764 enclosingClass.getLibrary(), |
| 764 0); | 765 0); |
| 765 evaluateSuperOrRedirectSend(functionNode, | 766 evaluateSuperOrRedirectSend(functionNode, |
| 766 selector, | 767 selector, |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 791 Constant fieldValue = fieldValues[field]; | 792 Constant fieldValue = fieldValues[field]; |
| 792 if (fieldValue === null) { | 793 if (fieldValue === null) { |
| 793 // Use the default value. | 794 // Use the default value. |
| 794 fieldValue = compiler.compileConstant(field); | 795 fieldValue = compiler.compileConstant(field); |
| 795 } | 796 } |
| 796 jsNewArguments.add(fieldValue); | 797 jsNewArguments.add(fieldValue); |
| 797 }); | 798 }); |
| 798 return jsNewArguments; | 799 return jsNewArguments; |
| 799 } | 800 } |
| 800 } | 801 } |
| OLD | NEW |