| 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. |
| 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 4227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6419 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6435 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 6420 unaliased.accept(this, builder); | 6436 unaliased.accept(this, builder); |
| 6421 } | 6437 } |
| 6422 | 6438 |
| 6423 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6439 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 6424 JavaScriptBackend backend = builder.compiler.backend; | 6440 JavaScriptBackend backend = builder.compiler.backend; |
| 6425 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 6441 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
| 6426 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); | 6442 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); |
| 6427 } | 6443 } |
| 6428 } | 6444 } |
| OLD | NEW |