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

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

Issue 1492823007: Fix #25111: evaluate arguments before throwing errors about invoking invalid constructors (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | tests/co19/co19-dart2js.status » ('j') | 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 final SsaCodeGeneratorTask generator; 8 final SsaCodeGeneratorTask generator;
9 final SsaBuilderTask builder; 9 final SsaBuilderTask builder;
10 final SsaOptimizerTask optimizer; 10 final SsaOptimizerTask optimizer;
(...skipping 5123 matching lines...) Expand 10 before | Expand all | Expand 10 after
5134 stack.add(graph.addConstantNull(compiler)); 5134 stack.add(graph.addConstantNull(compiler));
5135 return; 5135 return;
5136 } 5136 }
5137 5137
5138 if (checkTypeVariableBounds(node, type)) return; 5138 if (checkTypeVariableBounds(node, type)) return;
5139 5139
5140 // Abstract class instantiation error takes precedence over argument 5140 // Abstract class instantiation error takes precedence over argument
5141 // mismatch. 5141 // mismatch.
5142 ClassElement cls = constructor.enclosingClass; 5142 ClassElement cls = constructor.enclosingClass;
5143 if (cls.isAbstract && constructor.isGenerativeConstructor) { 5143 if (cls.isAbstract && constructor.isGenerativeConstructor) {
5144 // However, we need to ensure that all arguments are evaluated before we
5145 // throw the ACIE exception.
5146 send.arguments.forEach((arg) {
5147 visit(arg);
5148 pop();
5149 });
5144 generateAbstractClassInstantiationError(send, cls.name); 5150 generateAbstractClassInstantiationError(send, cls.name);
5145 return; 5151 return;
5146 } 5152 }
5147 5153
5148 // TODO(5347): Try to avoid the need for calling [implementation] before 5154 // TODO(5347): Try to avoid the need for calling [implementation] before
5149 // calling [makeStaticArgumentList]. 5155 // calling [makeStaticArgumentList].
5150 constructorImplementation = constructor.implementation; 5156 constructorImplementation = constructor.implementation;
5151 if (constructorImplementation.isMalformed || 5157 if (constructorImplementation.isMalformed ||
5152 !callStructure.signatureApplies( 5158 !callStructure.signatureApplies(
5153 constructorImplementation.functionSignature)) { 5159 constructorImplementation.functionSignature)) {
(...skipping 4023 matching lines...) Expand 10 before | Expand all | Expand 10 after
9177 if (unaliased is TypedefType) throw 'unable to unalias $type'; 9183 if (unaliased is TypedefType) throw 'unable to unalias $type';
9178 unaliased.accept(this, builder); 9184 unaliased.accept(this, builder);
9179 } 9185 }
9180 9186
9181 void visitDynamicType(DynamicType type, SsaBuilder builder) { 9187 void visitDynamicType(DynamicType type, SsaBuilder builder) {
9182 JavaScriptBackend backend = builder.compiler.backend; 9188 JavaScriptBackend backend = builder.compiler.backend;
9183 ClassElement cls = backend.helpers.DynamicRuntimeType; 9189 ClassElement cls = backend.helpers.DynamicRuntimeType;
9184 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 9190 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
9185 } 9191 }
9186 } 9192 }
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698