aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-03-24 12:11:00 +0000
committergingerBill <bill@gingerbill.org>2021-03-24 12:11:00 +0000
commit0e3ecc350abfce97029276d03a8c79c885784ae4 (patch)
tree2b3c4929bee17da673c5e561694b98caf59a85f7 /src/ir.cpp
parent295c1550a8569f91ed1838b37426bd6f56383a82 (diff)
Make the parser support as many identifiers on the LHS in `for in` loops to improve error messages
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index d17951f9f..ee463296a 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -10735,18 +10735,18 @@ void ir_build_stmt_internal(irProcedure *proc, Ast *node) {
Type *val0_type = nullptr;
Type *val1_type = nullptr;
- if (rs->val0 != nullptr && !is_blank_ident(rs->val0)) {
- val0_type = type_of_expr(rs->val0);
+ if (rs->vals.count > 0 && rs->vals[0] != nullptr && !is_blank_ident(rs->vals[0])) {
+ val0_type = type_of_expr(rs->vals[0]);
}
- if (rs->val1 != nullptr && !is_blank_ident(rs->val1)) {
- val1_type = type_of_expr(rs->val1);
+ if (rs->vals.count > 1 && rs->vals[1] != nullptr && !is_blank_ident(rs->vals[1])) {
+ val1_type = type_of_expr(rs->vals[1]);
}
if (val0_type != nullptr) {
- ir_add_local_for_identifier(proc, rs->val0, true);
+ ir_add_local_for_identifier(proc, rs->vals[0], true);
}
if (val1_type != nullptr) {
- ir_add_local_for_identifier(proc, rs->val1, true);
+ ir_add_local_for_identifier(proc, rs->vals[1], true);
}
irValue *val = nullptr;
@@ -10851,11 +10851,11 @@ void ir_build_stmt_internal(irProcedure *proc, Ast *node) {
if (is_map) {
- if (val0_type) ir_store_range_stmt_val(proc, rs->val0, key);
- if (val1_type) ir_store_range_stmt_val(proc, rs->val1, val);
+ if (val0_type) ir_store_range_stmt_val(proc, rs->vals[0], key);
+ if (val1_type) ir_store_range_stmt_val(proc, rs->vals[1], val);
} else {
- if (val0_type) ir_store_range_stmt_val(proc, rs->val0, val);
- if (val1_type) ir_store_range_stmt_val(proc, rs->val1, key);
+ if (val0_type) ir_store_range_stmt_val(proc, rs->vals[0], val);
+ if (val1_type) ir_store_range_stmt_val(proc, rs->vals[1], key);
}
ir_push_target_list(proc, rs->label, done, loop, nullptr);