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

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: return null for unresolved default constructors Created 5 years, 10 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
« no previous file with comments | « pkg/compiler/lib/src/resolution/members.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 } 1901 }
1902 1902
1903 if (!foundSuperOrRedirect) { 1903 if (!foundSuperOrRedirect) {
1904 // No super initializer found. Try to find the default constructor if 1904 // No super initializer found. Try to find the default constructor if
1905 // the class is not Object. 1905 // the class is not Object.
1906 ClassElement enclosingClass = constructor.enclosingClass; 1906 ClassElement enclosingClass = constructor.enclosingClass;
1907 ClassElement superClass = enclosingClass.superclass; 1907 ClassElement superClass = enclosingClass.superclass;
1908 if (!enclosingClass.isObject) { 1908 if (!enclosingClass.isObject) {
1909 assert(superClass != null); 1909 assert(superClass != null);
1910 assert(superClass.resolutionState == STATE_DONE); 1910 assert(superClass.resolutionState == STATE_DONE);
1911 Selector selector =
1912 new Selector.callDefaultConstructor(enclosingClass.library);
1913 // TODO(johnniwinther): Should we find injected constructors as well? 1911 // TODO(johnniwinther): Should we find injected constructors as well?
1914 FunctionElement target = superClass.lookupConstructor(selector); 1912 FunctionElement target = superClass.lookupDefaultConstructor();
1915 if (target == null) { 1913 if (target == null) {
1916 compiler.internalError(superClass, 1914 compiler.internalError(superClass,
1917 "No default constructor available."); 1915 "No default constructor available.");
1918 } 1916 }
1917 Selector selector =
1918 new Selector.callDefaultConstructor(enclosingClass.library);
1919 List<HInstruction> arguments = 1919 List<HInstruction> arguments =
1920 selector.makeArgumentsList2(const Link<ast.Node>(), 1920 selector.makeArgumentsList2(const Link<ast.Node>(),
1921 target.implementation, 1921 target.implementation,
1922 null, 1922 null,
1923 handleConstantForOptionalParameter); 1923 handleConstantForOptionalParameter);
1924 inlineSuperOrRedirect(target, 1924 inlineSuperOrRedirect(target,
1925 arguments, 1925 arguments,
1926 constructors, 1926 constructors,
1927 fieldValues, 1927 fieldValues,
1928 constructor); 1928 constructor);
(...skipping 4742 matching lines...) Expand 10 before | Expand all | Expand 10 after
6671 if (unaliased is TypedefType) throw 'unable to unalias $type'; 6671 if (unaliased is TypedefType) throw 'unable to unalias $type';
6672 unaliased.accept(this, builder); 6672 unaliased.accept(this, builder);
6673 } 6673 }
6674 6674
6675 void visitDynamicType(DynamicType type, SsaBuilder builder) { 6675 void visitDynamicType(DynamicType type, SsaBuilder builder) {
6676 JavaScriptBackend backend = builder.compiler.backend; 6676 JavaScriptBackend backend = builder.compiler.backend;
6677 ClassElement cls = backend.findHelper('DynamicRuntimeType'); 6677 ClassElement cls = backend.findHelper('DynamicRuntimeType');
6678 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 6678 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
6679 } 6679 }
6680 } 6680 }
OLDNEW
« no previous file with comments | « 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