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 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 Loading... | |
| 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 = potentiallyCheckType( | 2179 HInstruction newParameter = |
| 2180 localsHandler.directLocals[parameterElement], | 2180 localsHandler.directLocals[parameterElement]; |
| 2181 parameterElement.type); | 2181 if (!element.isConstructor || |
| 2182 !(element as ConstructorElement).isRedirectingFactory) { | |
| 2183 // Redirection factories must not check their argument types. | |
|
ahe
2014/07/27 09:43:31
I'm having a hard time finding this explicitly sta
Johnni Winther
2014/08/04 06:58:03
It is in the spec, implicitly. I even asked Gilad
| |
| 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 } | |
| 2182 localsHandler.directLocals[parameterElement] = newParameter; | 2198 localsHandler.directLocals[parameterElement] = newParameter; |
| 2183 }); | 2199 }); |
| 2184 | 2200 |
| 2185 returnType = signature.type.returnType; | 2201 returnType = signature.type.returnType; |
| 2186 } else { | 2202 } else { |
| 2187 // Otherwise it is a lazy initializer which does not have parameters. | 2203 // Otherwise it is a lazy initializer which does not have parameters. |
| 2188 assert(element is VariableElement); | 2204 assert(element is VariableElement); |
| 2189 } | 2205 } |
| 2190 | 2206 |
| 2191 insertTraceCall(element); | 2207 insertTraceCall(element); |
| (...skipping 4219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6411 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6427 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 6412 unaliased.accept(this, builder); | 6428 unaliased.accept(this, builder); |
| 6413 } | 6429 } |
| 6414 | 6430 |
| 6415 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6431 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 6416 JavaScriptBackend backend = builder.compiler.backend; | 6432 JavaScriptBackend backend = builder.compiler.backend; |
| 6417 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 6433 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
| 6418 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); | 6434 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); |
| 6419 } | 6435 } |
| 6420 } | 6436 } |
| OLD | NEW |