Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(630)

Side by Side Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 812523002: Change signature of lookupConstructor to only require a name. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fail gracefully on missing default constructors when evaluating constant constructors. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 part of ssa; 5 part of ssa;
6 6
7 class SsaFunctionCompiler implements FunctionCompiler { 7 class SsaFunctionCompiler implements FunctionCompiler {
8 SsaCodeGeneratorTask generator; 8 SsaCodeGeneratorTask generator;
9 SsaBuilderTask builder; 9 SsaBuilderTask builder;
10 SsaOptimizerTask optimizer; 10 SsaOptimizerTask optimizer;
(...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 } 1871 }
1872 1872
1873 if (!foundSuperOrRedirect) { 1873 if (!foundSuperOrRedirect) {
1874 // No super initializer found. Try to find the default constructor if 1874 // No super initializer found. Try to find the default constructor if
1875 // the class is not Object. 1875 // the class is not Object.
1876 ClassElement enclosingClass = constructor.enclosingClass; 1876 ClassElement enclosingClass = constructor.enclosingClass;
1877 ClassElement superClass = enclosingClass.superclass; 1877 ClassElement superClass = enclosingClass.superclass;
1878 if (!enclosingClass.isObject) { 1878 if (!enclosingClass.isObject) {
1879 assert(superClass != null); 1879 assert(superClass != null);
1880 assert(superClass.resolutionState == STATE_DONE); 1880 assert(superClass.resolutionState == STATE_DONE);
1881 Selector selector =
1882 new Selector.callDefaultConstructor(enclosingClass.library);
1883 // TODO(johnniwinther): Should we find injected constructors as well? 1881 // TODO(johnniwinther): Should we find injected constructors as well?
1884 FunctionElement target = superClass.lookupConstructor(selector); 1882 FunctionElement target = superClass.lookupDefaultConstructor();
1885 if (target == null) { 1883 if (target == null) {
1886 compiler.internalError(superClass, 1884 compiler.internalError(superClass,
1887 "No default constructor available."); 1885 "No default constructor available.");
1888 } 1886 }
1887 Selector selector =
1888 new Selector.callDefaultConstructor(enclosingClass.library);
1889 List<HInstruction> arguments = 1889 List<HInstruction> arguments =
1890 selector.makeArgumentsList2(const Link<ast.Node>(), 1890 selector.makeArgumentsList2(const Link<ast.Node>(),
1891 target.implementation, 1891 target.implementation,
1892 null, 1892 null,
1893 handleConstantForOptionalParameter); 1893 handleConstantForOptionalParameter);
1894 inlineSuperOrRedirect(target, 1894 inlineSuperOrRedirect(target,
1895 arguments, 1895 arguments,
1896 constructors, 1896 constructors,
1897 fieldValues, 1897 fieldValues,
1898 constructor); 1898 constructor);
(...skipping 4724 matching lines...) Expand 10 before | Expand all | Expand 10 after
6623 if (unaliased is TypedefType) throw 'unable to unalias $type'; 6623 if (unaliased is TypedefType) throw 'unable to unalias $type';
6624 unaliased.accept(this, builder); 6624 unaliased.accept(this, builder);
6625 } 6625 }
6626 6626
6627 void visitDynamicType(DynamicType type, SsaBuilder builder) { 6627 void visitDynamicType(DynamicType type, SsaBuilder builder) {
6628 JavaScriptBackend backend = builder.compiler.backend; 6628 JavaScriptBackend backend = builder.compiler.backend;
6629 ClassElement cls = backend.findHelper('DynamicRuntimeType'); 6629 ClassElement cls = backend.findHelper('DynamicRuntimeType');
6630 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 6630 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
6631 } 6631 }
6632 } 6632 }
OLDNEW
« pkg/compiler/lib/src/js_backend/backend.dart ('K') | « pkg/compiler/lib/src/resolution/members.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698