Rename IndexLoad/Store to ComputedLoad/Store

Hopefully a more clear name, these values correspond to computed properties.
This commit is contained in:
Joe Savona
2023-01-03 17:03:45 -08:00
parent bd99d06a5f
commit 29bb3f55a3
8 changed files with 21 additions and 21 deletions
+3 -3
View File
@@ -1077,7 +1077,7 @@ function lowerExpression(
);
const propertyPlace = lowerExpressionToPlace(builder, property);
value = {
kind: "IndexLoad",
kind: "ComputedLoad",
object,
property: propertyPlace,
loc: exprLoc,
@@ -1423,7 +1423,7 @@ function lowerAssignment(
);
const propertyPlace = lowerExpressionToPlace(builder, property);
return {
kind: "IndexStore",
kind: "ComputedStore",
object,
property: propertyPlace,
value: valuePlace,
@@ -1465,7 +1465,7 @@ function lowerAssignment(
loc: element.node.loc ?? GeneratedSource,
});
const value: InstructionValue = {
kind: "IndexLoad",
kind: "ComputedLoad",
loc,
object: { ...arrayPlace },
property,
+2 -2
View File
@@ -473,7 +473,7 @@ export function codegenInstructionValue(
);
break;
}
case "IndexStore": {
case "ComputedStore": {
value = t.assignmentExpression(
"=",
t.memberExpression(
@@ -485,7 +485,7 @@ export function codegenInstructionValue(
);
break;
}
case "IndexLoad": {
case "ComputedLoad": {
value = t.memberExpression(
codegenPlace(temp, instrValue.object),
codegenPlace(temp, instrValue.property),
+2 -2
View File
@@ -299,9 +299,9 @@ export type InstructionData =
| { kind: "PropertyLoad"; object: Place; property: string }
// store `object[index] = value` - like PropertyStore but with a dynamic property
| { kind: "IndexStore"; object: Place; property: Place; value: Place }
| { kind: "ComputedStore"; object: Place; property: Place; value: Place }
// load `object[index]` - like PropertyLoad but with a dynamic property
| { kind: "IndexLoad"; object: Place; property: Place }
| { kind: "ComputedLoad"; object: Place; property: Place }
/**
* Catch-all for statements such as type imports, nested class declarations, etc
@@ -607,7 +607,7 @@ function inferBlock(env: Environment, block: BasicBlock) {
}
continue;
}
case "IndexStore": {
case "ComputedStore": {
const effect = isObjectType(instrValue.object.identifier)
? Effect.Store
: Effect.Mutate;
@@ -622,7 +622,7 @@ function inferBlock(env: Environment, block: BasicBlock) {
}
continue;
}
case "IndexLoad": {
case "ComputedLoad": {
if (!env.isDefined(instrValue.object)) {
// TODO @josephsavona: improve handling of globals
const value: InstructionValue = {
+4 -4
View File
@@ -277,14 +277,14 @@ export function printInstructionValue(instrValue: InstructionValue): string {
} = ${printPlace(instrValue.value)}`;
break;
}
case "IndexLoad": {
value = `IndexLoad ${printPlace(instrValue.object)}[${printPlace(
case "ComputedLoad": {
value = `ComputedLoad ${printPlace(instrValue.object)}[${printPlace(
instrValue.property
)}]`;
break;
}
case "IndexStore": {
value = `IndexStore ${printPlace(instrValue.object)}[${printPlace(
case "ComputedStore": {
value = `ComputedStore ${printPlace(instrValue.object)}[${printPlace(
instrValue.property
)}] = ${printPlace(instrValue.value)}`;
break;
+4 -4
View File
@@ -50,12 +50,12 @@ export function* eachInstructionValueOperand(
yield instrValue.value;
break;
}
case "IndexLoad": {
case "ComputedLoad": {
yield instrValue.object;
yield instrValue.property;
break;
}
case "IndexStore": {
case "ComputedStore": {
yield instrValue.object;
yield instrValue.property;
yield instrValue.value;
@@ -121,12 +121,12 @@ export function mapInstructionOperands(
instrValue.value = fn(instrValue.value);
break;
}
case "IndexLoad": {
case "ComputedLoad": {
instrValue.object = fn(instrValue.object);
instrValue.property = fn(instrValue.property);
break;
}
case "IndexStore": {
case "ComputedStore": {
instrValue.object = fn(instrValue.object);
instrValue.property = fn(instrValue.property);
instrValue.value = fn(instrValue.value);
@@ -161,13 +161,13 @@ function mayAllocate(value: InstructionValue): boolean {
case "BinaryExpression":
case "Identifier":
case "PropertyLoad":
case "IndexLoad":
case "ComputedLoad":
case "JSXText":
case "Primitive": {
return false;
}
case "PropertyStore":
case "IndexStore":
case "ComputedStore":
case "ArrayExpression":
case "CallExpression":
case "JsxExpression":
@@ -302,8 +302,8 @@ function valueKind(value: InstructionValue): DeclKind {
case "Primitive": {
return DeclKind.Const;
}
case "IndexLoad":
case "IndexStore":
case "ComputedLoad":
case "ComputedStore":
case "PropertyStore":
case "PropertyLoad":
case "Identifier":