From e9b4a3d35aa08ff7579957a6c7622fff63f972c4 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 20 Jul 2023 10:17:06 +0100 Subject: Rename int to int-get --- ...rg.shedlang.compiler.testing.snapshots.Snapshotter)].expected | 2 +- ...rg.shedlang.compiler.testing.snapshots.Snapshotter)].expected | 2 +- ...rg.shedlang.compiler.testing.snapshots.Snapshotter)].expected | 2 +- ...rg.shedlang.compiler.testing.snapshots.Snapshotter)].expected | 2 +- src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java | 2 +- .../org/shedlang/compiler/patio/PatioInstructionSerializer.java | 8 ++++---- .../shedlang/compiler/patio/instructions/PatioInstruction.java | 2 +- .../java/org/shedlang/compiler/patio/instructions/PatioInt.java | 9 --------- .../org/shedlang/compiler/patio/instructions/PatioIntGet.java | 9 +++++++++ .../shedlang/compiler/patio/PatioInstructionSerializerTests.java | 6 +++--- .../java/org/shedlang/compiler/patio/instructions/Patio.java | 4 ++-- 11 files changed, 24 insertions(+), 24 deletions(-) delete mode 100644 src/main/java/org/shedlang/compiler/patio/instructions/PatioInt.java create mode 100644 src/main/java/org/shedlang/compiler/patio/instructions/PatioIntGet.java diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushBoolTests]/[method:pushBoolFalseInstructionGeneratesPushIntZeroInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushBoolTests]/[method:pushBoolFalseInstructionGeneratesPushIntZeroInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index faba9cad..40416415 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushBoolTests]/[method:pushBoolFalseInstructionGeneratesPushIntZeroInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushBoolTests]/[method:pushBoolFalseInstructionGeneratesPushIntZeroInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -1,7 +1,7 @@ Instructions: ( - (int "tmp__0" 0) + (int-get "tmp__0" 0) ) Temporary stack: diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushBoolTests]/[method:pushBoolTrueInstructionGeneratesPushIntOneInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushBoolTests]/[method:pushBoolTrueInstructionGeneratesPushIntOneInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 626e6a4c..710f05b4 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushBoolTests]/[method:pushBoolTrueInstructionGeneratesPushIntOneInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushBoolTests]/[method:pushBoolTrueInstructionGeneratesPushIntOneInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -1,7 +1,7 @@ Instructions: ( - (int "tmp__0" 1) + (int-get "tmp__0" 1) ) Temporary stack: diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushIntTests]/[method:pushIntInstructionGeneratesPushIntInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushIntTests]/[method:pushIntInstructionGeneratesPushIntInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index d9b2bcd5..c723b551 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushIntTests]/[method:pushIntInstructionGeneratesPushIntInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushIntTests]/[method:pushIntInstructionGeneratesPushIntInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -1,7 +1,7 @@ Instructions: ( - (int "tmp__0" 42) + (int-get "tmp__0" 42) ) Temporary stack: diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushUnitTests]/[method:pushUnitInstructionGeneratesPushIntInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushUnitTests]/[method:pushUnitInstructionGeneratesPushIntInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index faba9cad..40416415 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushUnitTests]/[method:pushUnitInstructionGeneratesPushIntInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenPushUnitTests]/[method:pushUnitInstructionGeneratesPushIntInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -1,7 +1,7 @@ Instructions: ( - (int "tmp__0" 0) + (int-get "tmp__0" 0) ) Temporary stack: diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java index fe74e70b..5fdcd30f 100644 --- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java +++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java @@ -124,7 +124,7 @@ public class PatioCodeGen { context = localResult.context(); return context - .addInstruction(new PatioInt(local, value, source)) + .addInstruction(new PatioIntGet(local, value, source)) .temporaryPush(local); } } diff --git a/src/main/java/org/shedlang/compiler/patio/PatioInstructionSerializer.java b/src/main/java/org/shedlang/compiler/patio/PatioInstructionSerializer.java index d0785c7a..132803fe 100644 --- a/src/main/java/org/shedlang/compiler/patio/PatioInstructionSerializer.java +++ b/src/main/java/org/shedlang/compiler/patio/PatioInstructionSerializer.java @@ -50,11 +50,11 @@ public class PatioInstructionSerializer { ) ); - case PatioInt int_ -> + case PatioIntGet intGet -> treeList( - treeIdentifier("int"), - localToTree(int_.target()), - treeInt(int_.value()) + treeIdentifier("int-get"), + localToTree(intGet.target()), + treeInt(intGet.value()) ); case PatioLocalCopy localCopy -> diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioInstruction.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioInstruction.java index 9d68b623..c7ce5e85 100644 --- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioInstruction.java +++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioInstruction.java @@ -2,6 +2,6 @@ package org.shedlang.compiler.patio.instructions; import org.shedlang.compiler.sources.Source; -public sealed interface PatioInstruction permits PatioAlloc, PatioCallPointer, PatioFunctionPointerGet, PatioInt, PatioLocalCopy, PatioMemoryLoad, PatioMemoryStore, PatioReturn { +public sealed interface PatioInstruction permits PatioAlloc, PatioCallPointer, PatioFunctionPointerGet, PatioIntGet, PatioLocalCopy, PatioMemoryLoad, PatioMemoryStore, PatioReturn { Source source(); } diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioInt.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioInt.java deleted file mode 100644 index f02c6146..00000000 --- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioInt.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.shedlang.compiler.patio.instructions; - -import org.shedlang.compiler.sources.Source; - -/** - * Store the given value in the target local. - */ -public record PatioInt(PatioLocal target, int value, Source source) implements PatioInstruction { -} diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntGet.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntGet.java new file mode 100644 index 00000000..0d1bbfc2 --- /dev/null +++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntGet.java @@ -0,0 +1,9 @@ +package org.shedlang.compiler.patio.instructions; + +import org.shedlang.compiler.sources.Source; + +/** + * Store the given value in the target local. + */ +public record PatioIntGet(PatioLocal target, int value, Source source) implements PatioInstruction { +} diff --git a/src/test/java/org/shedlang/compiler/patio/PatioInstructionSerializerTests.java b/src/test/java/org/shedlang/compiler/patio/PatioInstructionSerializerTests.java index c07ec16f..03e00a92 100644 --- a/src/test/java/org/shedlang/compiler/patio/PatioInstructionSerializerTests.java +++ b/src/test/java/org/shedlang/compiler/patio/PatioInstructionSerializerTests.java @@ -42,12 +42,12 @@ public class PatioInstructionSerializerTests { } @Test - public void canSerializeInt() { - var instruction = Patio.int_("target", 42); + public void canSerializeIntGet() { + var instruction = Patio.intGet("target", 42); var string = serialize(instruction); - assertThat(string, equalTo("(int \"target\" 42)")); + assertThat(string, equalTo("(int-get \"target\" 42)")); } @Test diff --git a/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java b/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java index 54963c34..c9a01ce3 100644 --- a/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java +++ b/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java @@ -30,8 +30,8 @@ public class Patio { return new PatioFunctionPointerGet(new PatioLocal(target), name, Sources.NULL); } - public static PatioInstruction int_(String target, int value) { - return new PatioInt(new PatioLocal(target), value, Sources.NULL); + public static PatioInstruction intGet(String target, int value) { + return new PatioIntGet(new PatioLocal(target), value, Sources.NULL); } public static PatioInstruction localCopy(String target, String value) { -- cgit v1.2.3