| 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 class SsaCodeGeneratorTask extends CompilerTask { | 7 class SsaCodeGeneratorTask extends CompilerTask { |
| 8 | 8 |
| 9 final JavaScriptBackend backend; | 9 final JavaScriptBackend backend; |
| 10 | 10 |
| (...skipping 2340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2351 attachLocationToLast(node); | 2351 attachLocationToLast(node); |
| 2352 } else if (types[input].canBePrimitive() || types[input].canBeNull()) { | 2352 } else if (types[input].canBePrimitive() || types[input].canBeNull()) { |
| 2353 checkObject(input, '==='); | 2353 checkObject(input, '==='); |
| 2354 js.Expression objectTest = pop(); | 2354 js.Expression objectTest = pop(); |
| 2355 checkType(input, type); | 2355 checkType(input, type); |
| 2356 push(new js.Binary('&&', objectTest, pop()), node); | 2356 push(new js.Binary('&&', objectTest, pop()), node); |
| 2357 } else { | 2357 } else { |
| 2358 checkType(input, type); | 2358 checkType(input, type); |
| 2359 attachLocationToLast(node); | 2359 attachLocationToLast(node); |
| 2360 } | 2360 } |
| 2361 if (node.hasArgumentChecks()) { | |
| 2362 InterfaceType interfaceType = type; | |
| 2363 ClassElement cls = type.element; | |
| 2364 Link<DartType> arguments = interfaceType.typeArguments; | |
| 2365 js.Expression result = pop(); | |
| 2366 for (int i = 0; i < node.checkCount; i++) { | |
| 2367 use(node.getCheck(i)); | |
| 2368 result = new js.Binary('&&', result, pop()); | |
| 2369 } | |
| 2370 push(result, node); | |
| 2371 } | |
| 2372 if (node.nullOk) { | 2361 if (node.nullOk) { |
| 2373 checkNull(input); | 2362 checkNull(input); |
| 2374 push(new js.Binary('||', pop(), pop()), node); | 2363 push(new js.Binary('||', pop(), pop()), node); |
| 2375 } | 2364 } |
| 2376 } | 2365 } |
| 2377 | 2366 |
| 2378 // TODO(johnniwinther): Refactor this method. | 2367 // TODO(johnniwinther): Refactor this method. |
| 2379 void visitTypeConversion(HTypeConversion node) { | 2368 void visitTypeConversion(HTypeConversion node) { |
| 2380 Map<String, SourceString> castNames = const <String, SourceString> { | 2369 Map<String, SourceString> castNames = const <String, SourceString> { |
| 2381 "stringTypeCheck": | 2370 "stringTypeCheck": |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2997 if (leftType.canBeNull() && rightType.canBeNull()) { | 2986 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 2998 if (left.isConstantNull() || right.isConstantNull() || | 2987 if (left.isConstantNull() || right.isConstantNull() || |
| 2999 (leftType.isPrimitive() && leftType == rightType)) { | 2988 (leftType.isPrimitive() && leftType == rightType)) { |
| 3000 return '=='; | 2989 return '=='; |
| 3001 } | 2990 } |
| 3002 return null; | 2991 return null; |
| 3003 } else { | 2992 } else { |
| 3004 return '==='; | 2993 return '==='; |
| 3005 } | 2994 } |
| 3006 } | 2995 } |
| OLD | NEW |