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 class SsaCodeGeneratorTask extends CompilerTask { | 7 class SsaCodeGeneratorTask extends CompilerTask { |
| 8 | 8 |
| 9 final JavaScriptBackend backend; | 9 final JavaScriptBackend backend; |
| 10 | 10 |
| (...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2391 } else if (Elements.isNumberOrStringSupertype(element, compiler)) { | 2391 } else if (Elements.isNumberOrStringSupertype(element, compiler)) { |
| 2392 handleNumberOrStringSupertypeCheck(input, type); | 2392 handleNumberOrStringSupertypeCheck(input, type); |
| 2393 attachLocationToLast(node); | 2393 attachLocationToLast(node); |
| 2394 } else if (Elements.isStringOnlySupertype(element, compiler)) { | 2394 } else if (Elements.isStringOnlySupertype(element, compiler)) { |
| 2395 handleStringSupertypeCheck(input, type); | 2395 handleStringSupertypeCheck(input, type); |
| 2396 attachLocationToLast(node); | 2396 attachLocationToLast(node); |
| 2397 } else if (identical(element, compiler.listClass) | 2397 } else if (identical(element, compiler.listClass) |
| 2398 || Elements.isListSupertype(element, compiler)) { | 2398 || Elements.isListSupertype(element, compiler)) { |
| 2399 handleListOrSupertypeCheck(input, type); | 2399 handleListOrSupertypeCheck(input, type); |
| 2400 attachLocationToLast(node); | 2400 attachLocationToLast(node); |
| 2401 } else if (element.isTypedef()) { | |
|
ngeoffray
2012/12/13 12:38:57
Why did you need this? Code can just fall through.
karlklose
2012/12/13 13:08:46
It falls down to the next case which emits and obj
ngeoffray
2012/12/13 13:20:37
I see. So don't you need to also check for null he
karlklose
2012/12/13 14:10:48
Indeed, done.
| |
| 2402 checkType(input, type); | |
| 2403 attachLocationToLast(node); | |
| 2401 } else if (types[input].canBePrimitive() || types[input].canBeNull()) { | 2404 } else if (types[input].canBePrimitive() || types[input].canBeNull()) { |
| 2402 checkObject(input, '==='); | 2405 checkObject(input, '==='); |
| 2403 js.Expression objectTest = pop(); | 2406 js.Expression objectTest = pop(); |
| 2404 checkType(input, type); | 2407 checkType(input, type); |
| 2405 push(new js.Binary('&&', objectTest, pop()), node); | 2408 push(new js.Binary('&&', objectTest, pop()), node); |
| 2406 } else { | 2409 } else { |
| 2407 checkType(input, type); | 2410 checkType(input, type); |
| 2408 attachLocationToLast(node); | 2411 attachLocationToLast(node); |
| 2409 } | 2412 } |
| 2410 if (node.hasArgumentChecks()) { | 2413 if (node.hasArgumentChecks()) { |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3050 if (leftType.canBeNull() && rightType.canBeNull()) { | 3053 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 3051 if (left.isConstantNull() || right.isConstantNull() || | 3054 if (left.isConstantNull() || right.isConstantNull() || |
| 3052 (leftType.isPrimitive() && leftType == rightType)) { | 3055 (leftType.isPrimitive() && leftType == rightType)) { |
| 3053 return '=='; | 3056 return '=='; |
| 3054 } | 3057 } |
| 3055 return null; | 3058 return null; |
| 3056 } else { | 3059 } else { |
| 3057 return '==='; | 3060 return '==='; |
| 3058 } | 3061 } |
| 3059 } | 3062 } |
| OLD | NEW |