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/asmjs/typing-asm.h" | 5 #include "src/asmjs/typing-asm.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 // Assignment to a local or context variable. | 668 // Assignment to a local or context variable. |
669 VariableProxy* proxy = expr->target()->AsVariableProxy(); | 669 VariableProxy* proxy = expr->target()->AsVariableProxy(); |
670 if (intish_ != 0) { | 670 if (intish_ != 0) { |
671 FAIL(expr, "intish or floatish assignment"); | 671 FAIL(expr, "intish or floatish assignment"); |
672 } | 672 } |
673 if (in_function_ && target_type->IsArray()) { | 673 if (in_function_ && target_type->IsArray()) { |
674 FAIL(expr, "assignment to array variable"); | 674 FAIL(expr, "assignment to array variable"); |
675 } | 675 } |
676 expected_type_ = target_type; | 676 expected_type_ = target_type; |
677 Variable* var = proxy->var(); | 677 Variable* var = proxy->var(); |
| 678 if (!in_function_ && var->IsParameter()) { |
| 679 FAIL(expr, "assignment to module parameter"); |
| 680 } |
678 VariableInfo* info = GetVariableInfo(var); | 681 VariableInfo* info = GetVariableInfo(var); |
679 if (info == nullptr || info->type == nullptr) { | 682 if (info == nullptr || info->type == nullptr) { |
680 if (var->mode() == TEMPORARY) { | 683 if (var->mode() == TEMPORARY) { |
681 SetType(var, Type::Any()); | 684 SetType(var, Type::Any()); |
682 info = GetVariableInfo(var); | 685 info = GetVariableInfo(var); |
683 } else { | 686 } else { |
684 FAIL(proxy, "unbound variable"); | 687 FAIL(proxy, "unbound variable"); |
685 } | 688 } |
686 } | 689 } |
687 if (property_info_ != nullptr) { | 690 if (property_info_ != nullptr) { |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 } | 1597 } |
1595 expected_type_ = save; | 1598 expected_type_ = save; |
1596 } | 1599 } |
1597 | 1600 |
1598 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) { | 1601 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) { |
1599 RECURSE(Visit(expr->expression())); | 1602 RECURSE(Visit(expr->expression())); |
1600 } | 1603 } |
1601 | 1604 |
1602 } // namespace internal | 1605 } // namespace internal |
1603 } // namespace v8 | 1606 } // namespace v8 |
OLD | NEW |