Skip to content

Commit a3b8c98

Browse files
committed
Updated class Jamplate
- updated `Jamplate.execute` ~ changed the memory supplier to supply depending on the compilation.
1 parent 7cffa63 commit a3b8c98

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/java/org/jamplate/impl/Jamplate.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import java.util.Date;
4040
import java.util.Map;
4141
import java.util.Objects;
42-
import java.util.function.Supplier;
42+
import java.util.function.Function;
4343

4444
/**
4545
* An all-in-one jamplate processor.
@@ -441,7 +441,7 @@ public static boolean execute(@NotNull Environment environment, @Nullable Compil
441441
Objects.requireNonNull(environment, "environment");
442442
Objects.requireNonNull(compilations, "compilations");
443443
//noinspection OverlyLongLambda
444-
return Jamplate.execute(environment, () -> {
444+
return Jamplate.execute(environment, compilation -> {
445445
Memory memory = new Memory();
446446

447447
Object memoryDefaults = environment.getMeta().get(Meta.MEMORY);
@@ -506,7 +506,7 @@ public static boolean execute(@NotNull Environment environment, @Nullable Compil
506506
* @since 0.2.0 ~2021.05.31
507507
*/
508508
@Contract(mutates = "param1,param2")
509-
public static boolean execute(@NotNull Environment environment, @NotNull Supplier<Memory> memorySupplier, @Nullable Compilation @NotNull ... compilations) {
509+
public static boolean execute(@NotNull Environment environment, @NotNull Function<Compilation, Memory> memorySupplier, @Nullable Compilation @NotNull ... compilations) {
510510
Objects.requireNonNull(environment, "environment");
511511
Objects.requireNonNull(compilations, "compilations");
512512
boolean success = true;
@@ -515,7 +515,7 @@ public static boolean execute(@NotNull Environment environment, @NotNull Supplie
515515
Instruction instruction = compilation.getInstruction();
516516

517517
if (instruction != null) {
518-
Memory memory = memorySupplier.get();
518+
Memory memory = memorySupplier.apply(compilation);
519519

520520
try {
521521
memory.pushFrame(new Frame(instruction));

0 commit comments

Comments
 (0)