OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 <cstring> | 5 #include <cstring> |
6 #include <functional> | 6 #include <functional> |
7 #include <iostream> | 7 #include <iostream> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/asmjs/asm-typer.h" | 10 #include "src/asmjs/asm-typer.h" |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 const char* error_message; | 852 const char* error_message; |
853 } kTests[] = { | 853 } kTests[] = { |
854 {"if (fround(1));", "If condition must be type int"}, | 854 {"if (fround(1));", "If condition must be type int"}, |
855 {"return;", "Type mismatch in return statement"}, | 855 {"return;", "Type mismatch in return statement"}, |
856 {"return +1.0;", "Type mismatch in return statement"}, | 856 {"return +1.0;", "Type mismatch in return statement"}, |
857 {"return +d()", "Type mismatch in return statement"}, | 857 {"return +d()", "Type mismatch in return statement"}, |
858 {"while (fround(1));", "While condition must be type int"}, | 858 {"while (fround(1));", "While condition must be type int"}, |
859 {"do {} while (fround(1));", "Do {} While condition must be type int"}, | 859 {"do {} while (fround(1));", "Do {} While condition must be type int"}, |
860 {"for (;fround(1););", "For condition must be type int"}, | 860 {"for (;fround(1););", "For condition must be type int"}, |
861 {"switch(flocal){ case 0: return 0; }", "Switch tag must be signed"}, | 861 {"switch(flocal){ case 0: return 0; }", "Switch tag must be signed"}, |
| 862 {"switch(slocal){ default: case 0: return 0; }", |
| 863 "Switch default must appear last"}, |
862 {"switch(slocal){ case 1: case 1: return 0; }", "Duplicated case label"}, | 864 {"switch(slocal){ case 1: case 1: return 0; }", "Duplicated case label"}, |
863 {"switch(slocal){ case 1: case 0: break; case 1: return 0; }", | 865 {"switch(slocal){ case 1: case 0: break; case 1: return 0; }", |
864 "Duplicated case label"}, | 866 "Duplicated case label"}, |
865 {"switch(slocal){ case 1.0: return 0; }", | 867 {"switch(slocal){ case 1.0: return 0; }", |
866 "Case label must be a 32-bit signed integer"}, | 868 "Case label must be a 32-bit signed integer"}, |
867 {"switch(slocal){ case 1.0: return 0; }", | 869 {"switch(slocal){ case 1.0: return 0; }", |
868 "Case label must be a 32-bit signed integer"}, | 870 "Case label must be a 32-bit signed integer"}, |
869 {"switch(slocal){ case -100000: case 2147483647: return 0; }", | 871 {"switch(slocal){ case -100000: case 2147483647: return 0; }", |
870 "Out-of-bounds case"}, | 872 "Out-of-bounds case"}, |
871 {"switch(slocal){ case 2147483648: return 0; }", | 873 {"switch(slocal){ case 2147483648: return 0; }", |
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1791 const auto* test = kTests + ii; | 1793 const auto* test = kTests + ii; |
1792 if (!ValidationOf(Module(test->module)) | 1794 if (!ValidationOf(Module(test->module)) |
1793 ->FailsWithMessage(test->error_message)) { | 1795 ->FailsWithMessage(test->error_message)) { |
1794 std::cerr << "Test:\n" << test->module; | 1796 std::cerr << "Test:\n" << test->module; |
1795 CHECK(false); | 1797 CHECK(false); |
1796 } | 1798 } |
1797 } | 1799 } |
1798 } | 1800 } |
1799 | 1801 |
1800 } // namespace | 1802 } // namespace |
OLD | NEW |