[torque] fix assignment with operator
Change-Id: I4710d317cf9f5686551a3df6e98619bab79387fa Reviewed-on: https://chromium-review.googlesource.com/1156698 Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Reviewed-by: Michael Stanton <mvstanton@chromium.org> Cr-Commit-Position: refs/heads/master@{#54827}
This commit is contained in:
parent
6d0c017e24
commit
f95b263249
@ -491,7 +491,7 @@ VisitResult ImplementationVisitor::Visit(AssignmentExpression* expr) {
|
||||
GenerateFetchFromLocation(expr->location, location_ref);
|
||||
assignment_value = Visit(expr->value);
|
||||
Arguments args;
|
||||
args.parameters = {assignment_value, assignment_value};
|
||||
args.parameters = {location_value, assignment_value};
|
||||
assignment_value = GenerateCall(*expr->op, args);
|
||||
GenerateAssignToLocation(expr->location, location_ref, assignment_value);
|
||||
} else {
|
||||
|
@ -702,7 +702,7 @@ base::Optional<ParseResult> MakeNameAndType(
|
||||
base::Optional<ParseResult> ExtractAssignmentOperator(
|
||||
ParseResultIterator* child_results) {
|
||||
auto op = child_results->NextAs<std::string>();
|
||||
base::Optional<std::string> result = std::string(op.begin() + 1, op.end());
|
||||
base::Optional<std::string> result = std::string(op.begin(), op.end() - 1);
|
||||
return ParseResult(std::move(result));
|
||||
}
|
||||
|
||||
|
@ -303,24 +303,24 @@ module test {
|
||||
// are (not) present.
|
||||
macro TestForLoop() {
|
||||
let sum: Smi = 0;
|
||||
for (let i: Smi = 0; i < 5; ++i) sum = sum + i;
|
||||
for (let i: Smi = 0; i < 5; ++i) sum += i;
|
||||
check(sum == 10);
|
||||
|
||||
sum = 0;
|
||||
let j: Smi = 0;
|
||||
for (; j < 5; ++j) sum = sum + j;
|
||||
for (; j < 5; ++j) sum += j;
|
||||
check(sum == 10);
|
||||
|
||||
sum = 0;
|
||||
j = 0;
|
||||
for (; j < 5;) sum = sum + j++;
|
||||
for (; j < 5;) sum += j++;
|
||||
check(sum == 10);
|
||||
|
||||
// Check that break works. No test expression.
|
||||
sum = 0;
|
||||
for (let i: Smi = 0;; ++i) {
|
||||
if (i == 5) break;
|
||||
sum = sum + i;
|
||||
sum += i;
|
||||
}
|
||||
check(sum == 10);
|
||||
|
||||
@ -328,7 +328,7 @@ module test {
|
||||
j = 0;
|
||||
for (;;) {
|
||||
if (j == 5) break;
|
||||
sum = sum + j;
|
||||
sum += j;
|
||||
j++;
|
||||
}
|
||||
check(sum == 10);
|
||||
@ -338,7 +338,7 @@ module test {
|
||||
sum = 0;
|
||||
for (let i: Smi = 0; i < 5; ++i) {
|
||||
if (i == 3) continue;
|
||||
sum = sum + i;
|
||||
sum += i;
|
||||
}
|
||||
check(sum == 7);
|
||||
|
||||
@ -346,7 +346,7 @@ module test {
|
||||
j = 0;
|
||||
for (; j < 5; ++j) {
|
||||
if (j == 3) continue;
|
||||
sum = sum + j;
|
||||
sum += j;
|
||||
}
|
||||
check(sum == 7);
|
||||
|
||||
@ -357,7 +357,7 @@ module test {
|
||||
j++;
|
||||
continue;
|
||||
}
|
||||
sum = sum + j;
|
||||
sum += j;
|
||||
j++;
|
||||
}
|
||||
check(sum == 7);
|
||||
@ -366,7 +366,7 @@ module test {
|
||||
for (let i: Smi = 0;; ++i) {
|
||||
if (i == 3) continue;
|
||||
if (i == 5) break;
|
||||
sum = sum + i;
|
||||
sum += i;
|
||||
}
|
||||
check(sum == 7);
|
||||
|
||||
@ -379,7 +379,7 @@ module test {
|
||||
}
|
||||
|
||||
if (j == 5) break;
|
||||
sum = sum + j;
|
||||
sum += j;
|
||||
j++;
|
||||
}
|
||||
check(sum == 7);
|
||||
|
Loading…
Reference in New Issue
Block a user