OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/ast/ast-expression-visitor.h" | 8 #include "src/ast/ast-expression-visitor.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/parsing/parser.h" | 10 #include "src/parsing/parser.h" |
(...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2017 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); | 2017 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); |
2018 // default: return 66; | 2018 // default: return 66; |
2019 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); | 2019 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); |
2020 // return 0; | 2020 // return 0; |
2021 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); | 2021 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); |
2022 } | 2022 } |
2023 CHECK_SKIP(); | 2023 CHECK_SKIP(); |
2024 } | 2024 } |
2025 CHECK_FUNC_TYPES_END | 2025 CHECK_FUNC_TYPES_END |
2026 } | 2026 } |
| 2027 |
| 2028 |
| 2029 TEST(BadSwitchRange) { |
| 2030 CHECK_FUNC_ERROR( |
| 2031 "function bar() { switch (1) { case -1: case 0x7fffffff: } }\n" |
| 2032 "function foo() { bar(); }", |
| 2033 "asm: line 39: case range too large\n"); |
| 2034 } |
| 2035 |
| 2036 |
| 2037 TEST(DuplicateSwitchCase) { |
| 2038 CHECK_FUNC_ERROR( |
| 2039 "function bar() { switch (1) { case 0: case 0: } }\n" |
| 2040 "function foo() { bar(); }", |
| 2041 "asm: line 39: duplicate case value\n"); |
| 2042 } |
| 2043 |
| 2044 |
| 2045 TEST(BadSwitchOrder) { |
| 2046 CHECK_FUNC_ERROR( |
| 2047 "function bar() { switch (1) { default: case 0: } }\n" |
| 2048 "function foo() { bar(); }", |
| 2049 "asm: line 39: default case out of order\n"); |
| 2050 } |
OLD | NEW |