| 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 "src/asmjs/asm-typer.h" | 5 #include "src/asmjs/asm-typer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 2695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2706 auto* var_info = Lookup(proxy->var()); | 2706 auto* var_info = Lookup(proxy->var()); |
| 2707 | 2707 |
| 2708 if (var_info == nullptr) { | 2708 if (var_info == nullptr) { |
| 2709 FAIL(statement, "Undeclared identifier in return statement."); | 2709 FAIL(statement, "Undeclared identifier in return statement."); |
| 2710 } | 2710 } |
| 2711 | 2711 |
| 2712 if (var_info->mutability() != VariableInfo::kConstGlobal) { | 2712 if (var_info->mutability() != VariableInfo::kConstGlobal) { |
| 2713 FAIL(statement, "Identifier in return statement is not const."); | 2713 FAIL(statement, "Identifier in return statement is not const."); |
| 2714 } | 2714 } |
| 2715 | 2715 |
| 2716 if (!var_info->type()->IsReturnType()) { |
| 2717 FAIL(statement, "Constant in return must be signed, float, or double."); |
| 2718 } |
| 2719 |
| 2716 return var_info->type(); | 2720 return var_info->type(); |
| 2717 } | 2721 } |
| 2718 | 2722 |
| 2719 FAIL(statement, "Invalid return type expression."); | 2723 FAIL(statement, "Invalid return type expression."); |
| 2720 } | 2724 } |
| 2721 | 2725 |
| 2722 // 5.4 VariableTypeAnnotations | 2726 // 5.4 VariableTypeAnnotations |
| 2723 // Also used for 5.5 GlobalVariableTypeAnnotations | 2727 // Also used for 5.5 GlobalVariableTypeAnnotations |
| 2724 AsmType* AsmTyper::VariableTypeAnnotations( | 2728 AsmType* AsmTyper::VariableTypeAnnotations( |
| 2725 Expression* initializer, VariableInfo::Mutability mutability_type) { | 2729 Expression* initializer, VariableInfo::Mutability mutability_type) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2853 return true; | 2857 return true; |
| 2854 } | 2858 } |
| 2855 | 2859 |
| 2856 *error_message = typer.error_message(); | 2860 *error_message = typer.error_message(); |
| 2857 return false; | 2861 return false; |
| 2858 } | 2862 } |
| 2859 | 2863 |
| 2860 } // namespace wasm | 2864 } // namespace wasm |
| 2861 } // namespace internal | 2865 } // namespace internal |
| 2862 } // namespace v8 | 2866 } // namespace v8 |
| OLD | NEW |