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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 418223010: Revert "Library functions can never be constructors." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 /// A synthetic local variable only used with the SSA graph. 7 /// A synthetic local variable only used with the SSA graph.
8 /// 8 ///
9 /// For instance used for holding return value of function or the exception of a 9 /// For instance used for holding return value of function or the exception of a
10 /// try-catch statement. 10 /// try-catch statement.
(...skipping 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2169 localsHandler.closureData.capturingScopes[node]; 2169 localsHandler.closureData.capturingScopes[node];
2170 signature.orderedForEachParameter((ParameterElement parameterElement) { 2170 signature.orderedForEachParameter((ParameterElement parameterElement) {
2171 if (element.isGenerativeConstructorBody) { 2171 if (element.isGenerativeConstructorBody) {
2172 if (scopeData != null && 2172 if (scopeData != null &&
2173 scopeData.isCapturedVariable(parameterElement)) { 2173 scopeData.isCapturedVariable(parameterElement)) {
2174 // The parameter will be a field in the box passed as the 2174 // The parameter will be a field in the box passed as the
2175 // last parameter. So no need to have it. 2175 // last parameter. So no need to have it.
2176 return; 2176 return;
2177 } 2177 }
2178 } 2178 }
2179 HInstruction newParameter = 2179 HInstruction newParameter = potentiallyCheckType(
2180 localsHandler.directLocals[parameterElement]; 2180 localsHandler.directLocals[parameterElement],
2181 if (!element.isConstructor || 2181 parameterElement.type);
2182 !(element as ConstructorElement).isRedirectingFactory) {
2183 // Redirection factories must not check their argument types.
2184 // Example:
2185 //
2186 // class A {
2187 // A(String foo) = A.b;
2188 // A(int foo) { print(foo); }
2189 // }
2190 // main() {
2191 // new A(499); // valid even in checked mode.
2192 // new A("foo"); // invalid in checked mode.
2193 //
2194 // Only the final target is allowed to check for the argument types.
2195 newParameter =
2196 potentiallyCheckType(newParameter, parameterElement.type);
2197 }
2198 localsHandler.directLocals[parameterElement] = newParameter; 2182 localsHandler.directLocals[parameterElement] = newParameter;
2199 }); 2183 });
2200 2184
2201 returnType = signature.type.returnType; 2185 returnType = signature.type.returnType;
2202 } else { 2186 } else {
2203 // Otherwise it is a lazy initializer which does not have parameters. 2187 // Otherwise it is a lazy initializer which does not have parameters.
2204 assert(element is VariableElement); 2188 assert(element is VariableElement);
2205 } 2189 }
2206 2190
2207 insertTraceCall(element); 2191 insertTraceCall(element);
(...skipping 4219 matching lines...) Expand 10 before | Expand all | Expand 10 after
6427 if (unaliased is TypedefType) throw 'unable to unalias $type'; 6411 if (unaliased is TypedefType) throw 'unable to unalias $type';
6428 unaliased.accept(this, builder); 6412 unaliased.accept(this, builder);
6429 } 6413 }
6430 6414
6431 void visitDynamicType(DynamicType type, SsaBuilder builder) { 6415 void visitDynamicType(DynamicType type, SsaBuilder builder) {
6432 JavaScriptBackend backend = builder.compiler.backend; 6416 JavaScriptBackend backend = builder.compiler.backend;
6433 ClassElement cls = backend.findHelper('DynamicRuntimeType'); 6417 ClassElement cls = backend.findHelper('DynamicRuntimeType');
6434 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); 6418 builder.push(new HDynamicType(type, new TypeMask.exact(cls)));
6435 } 6419 }
6436 } 6420 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | sdk/lib/_internal/lib/core_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698