From e905055cb0cae261fb90f3f8efe6e13324684ba2 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Fri, 27 Mar 2026 05:29:24 +0000 Subject: [PATCH] (fixes) test-projects main have to run --- .../lowering/PbsExecutableBodyLowerer.java | 112 ++++++++++- .../PbsExecutableCallsiteEmitter.java | 4 +- .../PbsExecutableLoweringContext.java | 22 +++ .../lowering/PbsExecutableLoweringModels.java | 2 + .../PbsExecutableMetadataIndexFactory.java | 31 ++++ .../lowering/PbsExecutableStackAnalyzer.java | 4 +- .../semantics/PbsFlowAssignmentAnalyzer.java | 7 + .../services/PBSFrontendPhaseService.java | 14 +- .../compiler/pbs/PbsFrontendCompilerTest.java | 53 ++++++ .../semantics/PbsSemanticsAssignmentTest.java | 22 +++ .../services/PBSFrontendPhaseServiceTest.java | 20 +- .../backend/irvm/LowerToIRVMServiceTest.java | 28 ++- .../main/assets/.prometeu/cache.json | 174 +++++++++--------- test-projects/main/cartridge/program.pbx | Bin 6147 -> 6437 bytes test-projects/main/src/main.pbs | 19 +- 15 files changed, 391 insertions(+), 121 deletions(-) diff --git a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableBodyLowerer.java b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableBodyLowerer.java index 9500ddf1..0a3ca1fe 100644 --- a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableBodyLowerer.java +++ b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableBodyLowerer.java @@ -173,23 +173,36 @@ final class PbsExecutableBodyLowerer { reportUnsupportedLowering("path assignment lowering is not supported in executable lowering v1", assignStatement.span(), context); return false; } - final var targetSlot = context.resolveLocalSlot(target.rootName()); - if (targetSlot == null) { - reportUnsupportedLowering("assignment target is not a known local: " + target.rootName(), assignStatement.span(), context); + final var targetLocalSlot = context.resolveLocalSlot(target.rootName()); + final var targetGlobalSlot = targetLocalSlot == null ? context.resolveGlobalSlot(target.rootName()) : null; + if (targetLocalSlot == null && targetGlobalSlot == null) { + reportUnsupportedLowering("assignment target is not a known local or global: " + target.rootName(), assignStatement.span(), context); return false; } if (assignStatement.operator() == PbsAst.AssignOperator.ASSIGN) { final var localOwner = callsiteEmitter.resolveExpressionOwnerForLowering(assignStatement.value(), context); lowerExpression(assignStatement.value(), context); - context.bindLocalOwner(target.rootName(), localOwner); - emitSetLocal(targetSlot, assignStatement.span(), context); + if (targetLocalSlot != null) { + context.bindLocalOwner(target.rootName(), localOwner); + emitSetLocal(targetLocalSlot, assignStatement.span(), context); + } else { + emitSetGlobal(targetGlobalSlot, assignStatement.span(), context); + } return false; } - emitGetLocal(targetSlot, assignStatement.span(), context); + if (targetLocalSlot != null) { + emitGetLocal(targetLocalSlot, assignStatement.span(), context); + } else { + emitGetGlobal(targetGlobalSlot, assignStatement.span(), context); + } lowerExpression(assignStatement.value(), context); emitBinaryOperatorInstruction(compoundAssignBinaryOperator(assignStatement.operator()), assignStatement.span(), context); - context.bindLocalOwner(target.rootName(), ""); - emitSetLocal(targetSlot, assignStatement.span(), context); + if (targetLocalSlot != null) { + context.bindLocalOwner(target.rootName(), ""); + emitSetLocal(targetLocalSlot, assignStatement.span(), context); + } else { + emitSetGlobal(targetGlobalSlot, assignStatement.span(), context); + } return false; } @@ -446,6 +459,53 @@ final class PbsExecutableBodyLowerer { final var slot = context.localSlotByNameId().get(context.nameTable().register(identifierExpr.name())); if (slot != null) { emitGetLocal(slot, identifierExpr.span(), context); + return; + } + final var globalSlot = context.resolveGlobalSlot(identifierExpr.name()); + if (globalSlot != null) { + emitGetGlobal(globalSlot, identifierExpr.span(), context); + return; + } + final var constDecl = context.resolveConstDecl(identifierExpr.name()); + if (constDecl != null && constDecl.initializer() != null) { + lowerConstExpression(constDecl.initializer(), context); + } + } + + private void lowerConstExpression( + final PbsAst.Expression expression, + final PbsExecutableLoweringContext context) { + if (expression == null) { + return; + } + switch (expression) { + case PbsAst.IntLiteralExpr intLiteralExpr -> lowerIntLiteral(intLiteralExpr, context); + case PbsAst.BoundedLiteralExpr boundedLiteralExpr -> + lowerIntLiteral(new PbsAst.IntLiteralExpr(boundedLiteralExpr.value(), boundedLiteralExpr.span()), context); + case PbsAst.StringLiteralExpr stringLiteralExpr -> emitPushConst(stringLiteralExpr.value(), stringLiteralExpr.span(), context); + case PbsAst.BoolLiteralExpr boolLiteralExpr -> emitPushBool(boolLiteralExpr.value(), boolLiteralExpr.span(), context); + case PbsAst.GroupExpr groupExpr -> lowerConstExpression(groupExpr.expression(), context); + case PbsAst.UnaryExpr unaryExpr -> { + lowerConstExpression(unaryExpr.expression(), context); + emitUnaryOperatorInstruction(unaryExpr.operator(), unaryExpr.span(), context); + } + case PbsAst.BinaryExpr binaryExpr -> { + lowerConstExpression(binaryExpr.left(), context); + lowerConstExpression(binaryExpr.right(), context); + emitBinaryOperatorInstruction(binaryExpr.operator(), binaryExpr.span(), context); + } + case PbsAst.IdentifierExpr identifierExpr -> { + final var referenced = context.resolveConstDecl(identifierExpr.name()); + if (referenced != null && referenced.initializer() != null) { + lowerConstExpression(referenced.initializer(), context); + } else { + reportUnsupportedLowering("const identifier is not lowerable: " + identifierExpr.name(), identifierExpr.span(), context); + } + } + default -> reportUnsupportedLowering( + "const expression is not lowerable in executable lowering v1", + expression.span(), + context); } } @@ -585,6 +645,24 @@ final class PbsExecutableBodyLowerer { span)); } + private void emitSetGlobal( + final int slot, + final p.studio.compiler.source.Span span, + final PbsExecutableLoweringContext context) { + context.instructions().add(new IRBackendExecutableFunction.Instruction( + IRBackendExecutableFunction.InstructionKind.SET_GLOBAL, + ModuleId.none(), + "", + null, + null, + null, + "", + "", + slot, + null, + span)); + } + private String compoundAssignBinaryOperator(final PbsAst.AssignOperator operator) { return switch (operator) { case ADD_ASSIGN -> "+"; @@ -681,6 +759,24 @@ final class PbsExecutableBodyLowerer { span)); } + private void emitGetGlobal( + final int slot, + final p.studio.compiler.source.Span span, + final PbsExecutableLoweringContext context) { + context.instructions().add(new IRBackendExecutableFunction.Instruction( + IRBackendExecutableFunction.InstructionKind.GET_GLOBAL, + ModuleId.none(), + "", + null, + null, + null, + "", + "", + slot, + null, + span)); + } + private void reportUnsupportedLowering( final String message, final p.studio.compiler.source.Span span, diff --git a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableCallsiteEmitter.java b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableCallsiteEmitter.java index c5b40327..f2882cc7 100644 --- a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableCallsiteEmitter.java +++ b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableCallsiteEmitter.java @@ -361,7 +361,9 @@ final class PbsExecutableCallsiteEmitter { final PbsExecutableLoweringContext context) { return switch (receiver) { case PbsAst.CallExpr ignored -> true; - case PbsAst.IdentifierExpr identifierExpr -> context.resolveLocalSlot(identifierExpr.name()) != null; + case PbsAst.IdentifierExpr identifierExpr -> + context.resolveLocalSlot(identifierExpr.name()) != null + || context.resolveGlobalSlot(identifierExpr.name()) != null; case PbsAst.GroupExpr groupExpr -> receiverProducesRuntimeValue(groupExpr.expression(), context); default -> false; }; diff --git a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableLoweringContext.java b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableLoweringContext.java index 3551029d..8bb642a6 100644 --- a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableLoweringContext.java +++ b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableLoweringContext.java @@ -58,6 +58,14 @@ final class PbsExecutableLoweringContext { return metadataIndex.builtinConstOwnerByNameId(); } + Map globalSlotByNameId() { + return metadataIndex.globalSlotByNameId(); + } + + Map constDeclByNameId() { + return metadataIndex.constDeclByNameId(); + } + Map builtinCanonicalBySourceType() { return metadataIndex.builtinCanonicalBySourceType(); } @@ -118,6 +126,20 @@ final class PbsExecutableLoweringContext { return localSlotByNameId.get(nameTable.register(localName)); } + Integer resolveGlobalSlot(final String globalName) { + if (globalName == null || globalName.isBlank()) { + return null; + } + return globalSlotByNameId().get(nameTable.register(globalName)); + } + + p.studio.compiler.pbs.ast.PbsAst.ConstDecl resolveConstDecl(final String constName) { + if (constName == null || constName.isBlank()) { + return null; + } + return constDeclByNameId().get(nameTable.register(constName)); + } + int declareLocalSlot(final String localName) { final var nameId = nameTable.register(localName); final var existing = localSlotByNameId.get(nameId); diff --git a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableLoweringModels.java b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableLoweringModels.java index e75b7828..7bc353b1 100644 --- a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableLoweringModels.java +++ b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableLoweringModels.java @@ -44,6 +44,8 @@ public class PbsExecutableLoweringModels { Map> hostByMethodName, Map builtinCanonicalBySourceType, Map builtinConstOwnerByNameId, + Map globalSlotByNameId, + Map constDeclByNameId, Map> intrinsicByOwnerAndMethod, Map intrinsicReturnOwnerByCanonical) { } diff --git a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableMetadataIndexFactory.java b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableMetadataIndexFactory.java index 9249bf81..a189bebd 100644 --- a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableMetadataIndexFactory.java +++ b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableMetadataIndexFactory.java @@ -27,6 +27,8 @@ final class PbsExecutableMetadataIndexFactory { final var hostByMethodName = indexHostBindingsByMethodName(reservedMetadata, nameTable); final var builtinCanonicalBySourceType = indexBuiltinCanonicalBySourceType(reservedMetadata); final var builtinConstOwnerByNameId = indexBuiltinConstOwners(reservedMetadata, nameTable); + final var globalSlotByNameId = indexGlobalSlots(ast, nameTable); + final var constDeclByNameId = indexConstDecls(ast, nameTable); final var builtinSignatureByOwnerAndMethod = indexBuiltinSignatures( ast, supplementalTopDecls, @@ -44,6 +46,8 @@ final class PbsExecutableMetadataIndexFactory { hostByMethodName, builtinCanonicalBySourceType, builtinConstOwnerByNameId, + globalSlotByNameId, + constDeclByNameId, intrinsicByOwnerAndMethod, intrinsicReturnOwnerByCanonical); } @@ -81,6 +85,33 @@ final class PbsExecutableMetadataIndexFactory { return builtinConstOwnerByNameId; } + private Map indexGlobalSlots( + final PbsAst.File ast, + final NameTable nameTable) { + final var globalSlotByNameId = new HashMap(); + var nextSlot = 0; + for (final var topDecl : ast.topDecls()) { + if (!(topDecl instanceof PbsAst.GlobalDecl globalDecl)) { + continue; + } + globalSlotByNameId.putIfAbsent(nameTable.register(globalDecl.name()), nextSlot++); + } + return globalSlotByNameId; + } + + private Map indexConstDecls( + final PbsAst.File ast, + final NameTable nameTable) { + final var constDeclByNameId = new HashMap(); + for (final var topDecl : ast.topDecls()) { + if (!(topDecl instanceof PbsAst.ConstDecl constDecl)) { + continue; + } + constDeclByNameId.putIfAbsent(nameTable.register(constDecl.name()), constDecl); + } + return constDeclByNameId; + } + private Map indexBuiltinSignatures( final PbsAst.File ast, final ReadOnlyList supplementalTopDecls, diff --git a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableStackAnalyzer.java b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableStackAnalyzer.java index 42216581..10cea500 100644 --- a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableStackAnalyzer.java +++ b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableStackAnalyzer.java @@ -38,8 +38,8 @@ final class PbsExecutableStackAnalyzer { var outHeight = incomingHeightByInstruction.get(index); switch (instruction.kind()) { - case PUSH_I32, PUSH_BOOL, PUSH_CONST, GET_LOCAL -> outHeight += 1; - case POP, SET_LOCAL -> { + case PUSH_I32, PUSH_BOOL, PUSH_CONST, GET_LOCAL, GET_GLOBAL -> outHeight += 1; + case POP, SET_LOCAL, SET_GLOBAL -> { if (outHeight <= 0) { throw new ExecutableLoweringAnalysisException( "stack underflow at " + instruction.kind().name().toLowerCase() + ": need=1 have=" + outHeight); diff --git a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/semantics/PbsFlowAssignmentAnalyzer.java b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/semantics/PbsFlowAssignmentAnalyzer.java index 706a6118..e5235ddd 100644 --- a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/semantics/PbsFlowAssignmentAnalyzer.java +++ b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/semantics/PbsFlowAssignmentAnalyzer.java @@ -108,6 +108,11 @@ final class PbsFlowAssignmentAnalyzer { return new AssignmentTargetResolution(localType, true); } + final var globalType = model.globalTypes.get(rootName); + if (globalType != null) { + return new AssignmentTargetResolution(globalType, true); + } + if (isKnownNonAssignableRoot(rootName, model)) { Diagnostics.error(diagnostics, PbsSemanticsErrors.E_SEM_ASSIGN_TARGET_NOT_ASSIGNABLE.name(), @@ -138,6 +143,8 @@ final class PbsFlowAssignmentAnalyzer { final var localType = scope.resolve(rootName); if (localType != null) { currentType = localType; + } else if (model.globalTypes.containsKey(rootName)) { + currentType = model.globalTypes.get(rootName); } else if (model.serviceSingletons.containsKey(rootName)) { currentType = model.serviceSingletons.get(rootName); } else if (model.constTypes.containsKey(rootName)) { diff --git a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/services/PBSFrontendPhaseService.java b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/services/PBSFrontendPhaseService.java index 91ff0df0..a293e925 100644 --- a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/services/PBSFrontendPhaseService.java +++ b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/services/PBSFrontendPhaseService.java @@ -253,6 +253,8 @@ public class PBSFrontendPhaseService implements FrontendPhaseService { callableSignatures.add(new CallableSignatureRef(entryPointModuleId, entryPointCallableName, 0, "() -> unit")); final var instructions = new ArrayList(); instructions.add(getGlobalInstruction(bootGuardSlot, frameExecutable.span())); + instructions.add(pushBoolInstruction(true, frameExecutable.span())); + instructions.add(eqInstruction(frameExecutable.span())); instructions.add(jumpIfTrueInstruction("bootstrap_done", frameExecutable.span())); for (final var moduleId : sortedModuleIds) { final var moduleInitCallableId = moduleInitCallableIds.get(moduleId); @@ -297,7 +299,7 @@ public class PBSFrontendPhaseService implements FrontendPhaseService { 0, 0, 0, - 1, + 2, ReadOnlyList.wrap(instructions), frameExecutable.span())); @@ -459,6 +461,16 @@ public class PBSFrontendPhaseService implements FrontendPhaseService { span); } + private IRBackendExecutableFunction.Instruction eqInstruction(final Span span) { + return new IRBackendExecutableFunction.Instruction( + IRBackendExecutableFunction.InstructionKind.EQ, + "", + null, + null, + null, + span); + } + private IRBackendExecutableFunction.Instruction labelInstruction( final String label, final Span span) { diff --git a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/PbsFrontendCompilerTest.java b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/PbsFrontendCompilerTest.java index 8b11df44..fcc0f99a 100644 --- a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/PbsFrontendCompilerTest.java +++ b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/PbsFrontendCompilerTest.java @@ -134,6 +134,59 @@ class PbsFrontendCompilerTest { i.kind() == p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.CALL_FUNC)); } + @Test + void shouldLowerGlobalReadsAndWritesInExecutableBodies() { + final var source = """ + declare global tile_id: int = 0; + + fn tick() -> int { + tile_id = tile_id + 1; + if (tile_id > 7) { + tile_id = 0; + } + return tile_id; + } + """; + + final var diagnostics = DiagnosticSink.empty(); + final var compiler = new PbsFrontendCompiler(); + final var fileBackend = compiler.compileFile(new FileId(46), source, diagnostics); + + assertTrue(diagnostics.isEmpty(), diagnostics.stream().map(d -> d.getCode() + ":" + d.getMessage()).toList().toString()); + final var executableTick = fileBackend.executableFunctions().stream() + .filter(fn -> fn.callableName().equals("tick")) + .findFirst() + .orElseThrow(); + assertTrue(executableTick.instructions().stream().anyMatch(i -> + i.kind() == p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.GET_GLOBAL)); + assertTrue(executableTick.instructions().stream().anyMatch(i -> + i.kind() == p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.SET_GLOBAL)); + } + + @Test + void shouldLowerUserConstIdentifiersInExecutableBodies() { + final var source = """ + declare const MAX_FRAMES: int = 10; + + fn tick(frame_counter: int) -> bool { + return frame_counter > MAX_FRAMES; + } + """; + + final var diagnostics = DiagnosticSink.empty(); + final var compiler = new PbsFrontendCompiler(); + final var fileBackend = compiler.compileFile(new FileId(47), source, diagnostics); + + assertTrue(diagnostics.isEmpty(), diagnostics.stream().map(d -> d.getCode() + ":" + d.getMessage()).toList().toString()); + final var executableTick = fileBackend.executableFunctions().stream() + .filter(fn -> fn.callableName().equals("tick")) + .findFirst() + .orElseThrow(); + assertTrue(executableTick.instructions().stream().anyMatch(i -> + i.kind() == p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.PUSH_I32 + && "10".equals(i.label()))); + } + @Test void shouldClassifyCallableCallEvenWhenNameLooksHostLike() { final var source = """ diff --git a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/semantics/PbsSemanticsAssignmentTest.java b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/semantics/PbsSemanticsAssignmentTest.java index ce627a17..d9f43448 100644 --- a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/semantics/PbsSemanticsAssignmentTest.java +++ b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/semantics/PbsSemanticsAssignmentTest.java @@ -42,6 +42,28 @@ class PbsSemanticsAssignmentTest { d.getCode().equals(PbsSemanticsErrors.E_SEM_FIELD_WRITE_ACCESS_DENIED.name()))); } + @Test + void shouldAllowGlobalAssignments() { + final var source = """ + declare global tile_id: int = 0; + + fn tick(next: int) -> int { + tile_id = tile_id + next; + return tile_id; + } + """; + final var diagnostics = DiagnosticSink.empty(); + + new PbsFrontendCompiler().compileFile(new FileId(0), source, diagnostics); + + assertFalse(diagnostics.stream().anyMatch(d -> + d.getCode().equals(PbsSemanticsErrors.E_SEM_ASSIGN_TARGET_UNRESOLVED.name()))); + assertFalse(diagnostics.stream().anyMatch(d -> + d.getCode().equals(PbsSemanticsErrors.E_SEM_ASSIGN_TARGET_NOT_ASSIGNABLE.name()))); + assertFalse(diagnostics.stream().anyMatch(d -> + d.getCode().equals(PbsSemanticsErrors.E_SEM_ASSIGN_TYPE_MISMATCH.name()))); + } + @Test void shouldRejectUnresolvedImmutableAndTypeMismatchedAssignments() { final var source = """ diff --git a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/services/PBSFrontendPhaseServiceTest.java b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/services/PBSFrontendPhaseServiceTest.java index 411c9f75..6cf98622 100644 --- a/prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/services/PBSFrontendPhaseServiceTest.java +++ b/prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/services/PBSFrontendPhaseServiceTest.java @@ -381,16 +381,18 @@ class PBSFrontendPhaseServiceTest { .filter(function -> irBackend.getEntryPointCallableName().equals(function.callableName())) .findFirst() .orElseThrow(); - assertEquals(9, wrapper.instructions().size()); + assertEquals(11, wrapper.instructions().size()); assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.GET_GLOBAL, wrapper.instructions().get(0).kind()); - assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.JMP_IF_TRUE, wrapper.instructions().get(1).kind()); - assertTrue(wrapper.instructions().get(2).calleeCallableName().startsWith("__pbs.module_init$m")); - assertTrue(wrapper.instructions().get(3).calleeCallableName().startsWith("__pbs.project_init$m")); - assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.PUSH_BOOL, wrapper.instructions().get(4).kind()); - assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.SET_GLOBAL, wrapper.instructions().get(5).kind()); - assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.LABEL, wrapper.instructions().get(6).kind()); - assertEquals("frame", wrapper.instructions().get(7).calleeCallableName()); - assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.RET, wrapper.instructions().get(8).kind()); + assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.PUSH_BOOL, wrapper.instructions().get(1).kind()); + assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.EQ, wrapper.instructions().get(2).kind()); + assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.JMP_IF_TRUE, wrapper.instructions().get(3).kind()); + assertTrue(wrapper.instructions().get(4).calleeCallableName().startsWith("__pbs.module_init$m")); + assertTrue(wrapper.instructions().get(5).calleeCallableName().startsWith("__pbs.project_init$m")); + assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.PUSH_BOOL, wrapper.instructions().get(6).kind()); + assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.SET_GLOBAL, wrapper.instructions().get(7).kind()); + assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.LABEL, wrapper.instructions().get(8).kind()); + assertEquals("frame", wrapper.instructions().get(9).calleeCallableName()); + assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.RET, wrapper.instructions().get(10).kind()); } @Test diff --git a/prometeu-compiler/prometeu-build-pipeline/src/test/java/p/studio/compiler/backend/irvm/LowerToIRVMServiceTest.java b/prometeu-compiler/prometeu-build-pipeline/src/test/java/p/studio/compiler/backend/irvm/LowerToIRVMServiceTest.java index cae2b32a..bcfef43f 100644 --- a/prometeu-compiler/prometeu-build-pipeline/src/test/java/p/studio/compiler/backend/irvm/LowerToIRVMServiceTest.java +++ b/prometeu-compiler/prometeu-build-pipeline/src/test/java/p/studio/compiler/backend/irvm/LowerToIRVMServiceTest.java @@ -87,6 +87,8 @@ class LowerToIRVMServiceTest { fn("frame", "app", 20, ReadOnlyList.from(ret())), fn("__pbs.frame_wrapper$m0", "app", 40, ReadOnlyList.from( getGlobal(0), + pushBool(true), + eq(), jmpIfTrue("bootstrap_done"), callFunc("app", "__pbs.module_init$m0", 31), callFunc("app", "__pbs.project_init$m0", 32), @@ -101,13 +103,15 @@ class LowerToIRVMServiceTest { assertEquals("__pbs.frame_wrapper$m0", lowered.module().functions().get(0).name()); assertEquals(IRVMOp.GET_GLOBAL, lowered.module().functions().get(0).instructions().get(0).op()); - assertEquals(IRVMOp.JMP_IF_TRUE, lowered.module().functions().get(0).instructions().get(1).op()); - assertEquals(IRVMOp.CALL, lowered.module().functions().get(0).instructions().get(2).op()); - assertEquals(IRVMOp.CALL, lowered.module().functions().get(0).instructions().get(3).op()); - assertEquals(IRVMOp.PUSH_BOOL, lowered.module().functions().get(0).instructions().get(4).op()); - assertEquals(IRVMOp.SET_GLOBAL, lowered.module().functions().get(0).instructions().get(5).op()); - assertEquals(IRVMOp.CALL, lowered.module().functions().get(0).instructions().get(6).op()); - assertEquals(IRVMOp.RET, lowered.module().functions().get(0).instructions().get(7).op()); + assertEquals(IRVMOp.PUSH_BOOL, lowered.module().functions().get(0).instructions().get(1).op()); + assertEquals(IRVMOp.EQ, lowered.module().functions().get(0).instructions().get(2).op()); + assertEquals(IRVMOp.JMP_IF_TRUE, lowered.module().functions().get(0).instructions().get(3).op()); + assertEquals(IRVMOp.CALL, lowered.module().functions().get(0).instructions().get(4).op()); + assertEquals(IRVMOp.CALL, lowered.module().functions().get(0).instructions().get(5).op()); + assertEquals(IRVMOp.PUSH_BOOL, lowered.module().functions().get(0).instructions().get(6).op()); + assertEquals(IRVMOp.SET_GLOBAL, lowered.module().functions().get(0).instructions().get(7).op()); + assertEquals(IRVMOp.CALL, lowered.module().functions().get(0).instructions().get(8).op()); + assertEquals(IRVMOp.RET, lowered.module().functions().get(0).instructions().get(9).op()); assertEquals(IRVMOp.RET, lowered.module().functions().stream() .filter(function -> "frame".equals(function.name())) .findFirst() @@ -645,4 +649,14 @@ class LowerToIRVMServiceTest { null, Span.none()); } + + private static IRBackendExecutableFunction.Instruction eq() { + return new IRBackendExecutableFunction.Instruction( + IRBackendExecutableFunction.InstructionKind.EQ, + "", + null, + null, + null, + Span.none()); + } } diff --git a/test-projects/main/assets/.prometeu/cache.json b/test-projects/main/assets/.prometeu/cache.json index 228347b0..ea9a28f6 100644 --- a/test-projects/main/assets/.prometeu/cache.json +++ b/test-projects/main/assets/.prometeu/cache.json @@ -7,7 +7,7 @@ "relative_path" : "confirm.png", "mime_type" : "image/png", "size" : 137, - "last_modified" : 1773571367191, + "last_modified" : 1774359768919, "fingerprint" : "aa7d241deabcebe29a6096e14eaf16fdc06cf06380c11a507620b00fc7bff094", "metadata" : { }, "diagnostics" : [ { @@ -21,7 +21,7 @@ "relative_path" : "right-palette copy 10.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772403, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -39,7 +39,7 @@ "relative_path" : "right-palette copy 11.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772405, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -57,7 +57,7 @@ "relative_path" : "right-palette copy 12.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772406, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -75,7 +75,7 @@ "relative_path" : "right-palette copy 13.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772408, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -93,7 +93,7 @@ "relative_path" : "right-palette copy 14.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772409, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -111,7 +111,7 @@ "relative_path" : "right-palette copy 15.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772411, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -129,7 +129,7 @@ "relative_path" : "right-palette copy 16.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772412, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -147,7 +147,7 @@ "relative_path" : "right-palette copy 17.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772413, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -165,7 +165,7 @@ "relative_path" : "right-palette copy 18.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772415, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -183,7 +183,7 @@ "relative_path" : "right-palette copy 19.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772416, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -201,7 +201,7 @@ "relative_path" : "right-palette copy 2.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772417, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -219,7 +219,7 @@ "relative_path" : "right-palette copy 20.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772418, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -237,7 +237,7 @@ "relative_path" : "right-palette copy 21.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772420, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -255,7 +255,7 @@ "relative_path" : "right-palette copy 22.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772421, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -273,7 +273,7 @@ "relative_path" : "right-palette copy 23.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772423, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -291,7 +291,7 @@ "relative_path" : "right-palette copy 24.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772424, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -309,7 +309,7 @@ "relative_path" : "right-palette copy 25.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772425, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -327,7 +327,7 @@ "relative_path" : "right-palette copy 26.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772426, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -345,7 +345,7 @@ "relative_path" : "right-palette copy 27.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772428, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -363,7 +363,7 @@ "relative_path" : "right-palette copy 28.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772429, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -381,7 +381,7 @@ "relative_path" : "right-palette copy 29.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772430, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -399,7 +399,7 @@ "relative_path" : "right-palette copy 3.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772431, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -417,7 +417,7 @@ "relative_path" : "right-palette copy 30.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772432, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -435,7 +435,7 @@ "relative_path" : "right-palette copy 31.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772433, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -453,7 +453,7 @@ "relative_path" : "right-palette copy 32.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772435, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -471,7 +471,7 @@ "relative_path" : "right-palette copy 33.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772436, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -489,7 +489,7 @@ "relative_path" : "right-palette copy 34.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772437, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -507,7 +507,7 @@ "relative_path" : "right-palette copy 35.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772438, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -525,7 +525,7 @@ "relative_path" : "right-palette copy 36.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772439, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -543,7 +543,7 @@ "relative_path" : "right-palette copy 37.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772441, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -561,7 +561,7 @@ "relative_path" : "right-palette copy 38.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772442, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -579,7 +579,7 @@ "relative_path" : "right-palette copy 39.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772443, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -597,7 +597,7 @@ "relative_path" : "right-palette copy 4.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772444, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -615,7 +615,7 @@ "relative_path" : "right-palette copy 40.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772445, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -633,7 +633,7 @@ "relative_path" : "right-palette copy 41.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772448, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -651,7 +651,7 @@ "relative_path" : "right-palette copy 42.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772449, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -669,7 +669,7 @@ "relative_path" : "right-palette copy 43.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772450, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -687,7 +687,7 @@ "relative_path" : "right-palette copy 44.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772452, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -705,7 +705,7 @@ "relative_path" : "right-palette copy 45.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772453, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -723,7 +723,7 @@ "relative_path" : "right-palette copy 46.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772454, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -741,7 +741,7 @@ "relative_path" : "right-palette copy 47.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772455, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -759,7 +759,7 @@ "relative_path" : "right-palette copy 48.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772456, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -777,7 +777,7 @@ "relative_path" : "right-palette copy 49.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772458, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -795,7 +795,7 @@ "relative_path" : "right-palette copy 5.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772459, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -813,7 +813,7 @@ "relative_path" : "right-palette copy 50.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772460, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -831,7 +831,7 @@ "relative_path" : "right-palette copy 51.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772461, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -849,7 +849,7 @@ "relative_path" : "right-palette copy 52.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772463, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -867,7 +867,7 @@ "relative_path" : "right-palette copy 53.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772464, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -885,7 +885,7 @@ "relative_path" : "right-palette copy 54.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772465, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -903,7 +903,7 @@ "relative_path" : "right-palette copy 55.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772467, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -921,7 +921,7 @@ "relative_path" : "right-palette copy 56.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772468, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -939,7 +939,7 @@ "relative_path" : "right-palette copy 57.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772470, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -957,7 +957,7 @@ "relative_path" : "right-palette copy 58.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772474, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -975,7 +975,7 @@ "relative_path" : "right-palette copy 59.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772476, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -993,7 +993,7 @@ "relative_path" : "right-palette copy 6.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772478, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -1011,7 +1011,7 @@ "relative_path" : "right-palette copy 60.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772479, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -1029,7 +1029,7 @@ "relative_path" : "right-palette copy 61.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772481, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -1047,7 +1047,7 @@ "relative_path" : "right-palette copy 62.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772482, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -1065,7 +1065,7 @@ "relative_path" : "right-palette copy 63.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772483, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -1083,7 +1083,7 @@ "relative_path" : "right-palette copy 64.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772484, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -1101,7 +1101,7 @@ "relative_path" : "right-palette copy 65.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772485, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -1119,7 +1119,7 @@ "relative_path" : "right-palette copy 66.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772487, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -1137,7 +1137,7 @@ "relative_path" : "right-palette copy 67.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772488, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -1155,7 +1155,7 @@ "relative_path" : "right-palette copy 68.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772489, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -1173,7 +1173,7 @@ "relative_path" : "right-palette copy 69.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772491, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -1191,7 +1191,7 @@ "relative_path" : "right-palette copy 7.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772492, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -1209,7 +1209,7 @@ "relative_path" : "right-palette copy 8.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772493, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -1227,7 +1227,7 @@ "relative_path" : "right-palette copy 9.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772494, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -1245,7 +1245,7 @@ "relative_path" : "right-palette copy.png", "mime_type" : "image/png", "size" : 172, - "last_modified" : 1773913054715, + "last_modified" : 1774359772495, "fingerprint" : "eeb7cc665386299403b7be1c272375d5077f3647c587f8033aa8c9275f840562", "metadata" : { "tile" : { @@ -1263,7 +1263,7 @@ "relative_path" : "right-palette.png", "mime_type" : "image/png", "size" : 327, - "last_modified" : 1773932799598, + "last_modified" : 1774359773932, "fingerprint" : "0526996900bdeef23c72fe987fb45800f11895946dcd5f0f7f8390c879069a37", "metadata" : { "tile" : { @@ -1281,7 +1281,7 @@ "relative_path" : "wrong-palette.png", "mime_type" : "image/png", "size" : 248, - "last_modified" : 1773911050482, + "last_modified" : 1774359771814, "fingerprint" : "15850f68547775866b01a0fe0b0012bb0243dec303ce1f9c3e02220e05b593e6", "metadata" : { }, "diagnostics" : [ { @@ -1311,7 +1311,7 @@ "relative_path" : "confirm.png", "mime_type" : "image/png", "size" : 137, - "last_modified" : 1773253076764, + "last_modified" : 1774359768918, "fingerprint" : "aa7d241deabcebe29a6096e14eaf16fdc06cf06380c11a507620b00fc7bff094", "metadata" : { "tile" : { @@ -1341,7 +1341,7 @@ "relative_path" : "flag00.png", "mime_type" : "image/png", "size" : 507, - "last_modified" : 1774025407014, + "last_modified" : 1774359777378, "fingerprint" : "6ca635a7906067b6a2a8460a8562718c445783e6df18b9f2c80c83c5ac569db6", "metadata" : { "tile" : { @@ -1365,7 +1365,7 @@ "relative_path" : "flag01.png", "mime_type" : "image/png", "size" : 766, - "last_modified" : 1774025460662, + "last_modified" : 1774359777379, "fingerprint" : "79257d8437747a68e9e8eb8f43fced7aa55940dc8eca98f95767994abbacdd81", "metadata" : { }, "diagnostics" : [ { @@ -1379,7 +1379,7 @@ "relative_path" : "flag02.png", "mime_type" : "image/png", "size" : 684, - "last_modified" : 1774025485085, + "last_modified" : 1774359777379, "fingerprint" : "5fd43c447cf6dd9b164458860239427d2f4544ff6e007814731b50c17ffe75bf", "metadata" : { }, "diagnostics" : [ { @@ -1393,7 +1393,7 @@ "relative_path" : "flag03.png", "mime_type" : "image/png", "size" : 669, - "last_modified" : 1774025730144, + "last_modified" : 1774359777380, "fingerprint" : "7feab8c868bb446afd3dd7250e70504fb0ca228f463650d2dd7c525144e0b321", "metadata" : { "tile" : { @@ -1411,7 +1411,7 @@ "relative_path" : "link00.png", "mime_type" : "image/png", "size" : 497, - "last_modified" : 1774024641031, + "last_modified" : 1774359777381, "fingerprint" : "c363f3ef7f32d9b249c7dc8babdb3eb5aae68c524099e5e97290202b054dda71", "metadata" : { "tile" : { @@ -1429,7 +1429,7 @@ "relative_path" : "link01.png", "mime_type" : "image/png", "size" : 500, - "last_modified" : 1774024641031, + "last_modified" : 1774359777382, "fingerprint" : "e2130efbb9643b41a4fb62619f2713402f9622c7db040fe18d929609ef70b89a", "metadata" : { "tile" : { @@ -1447,7 +1447,7 @@ "relative_path" : "link02.png", "mime_type" : "image/png", "size" : 517, - "last_modified" : 1774024641031, + "last_modified" : 1774359777383, "fingerprint" : "9216dfc6a6226fac398e9f781550d23fbfaa65bd377cdda69187149beca114ec", "metadata" : { "tile" : { @@ -1465,7 +1465,7 @@ "relative_path" : "link03.png", "mime_type" : "image/png", "size" : 507, - "last_modified" : 1774024641031, + "last_modified" : 1774359777383, "fingerprint" : "ebc4b7ca7bb1455288681c5d71424f60f658a44cb343d0c3934329cec676c867", "metadata" : { "tile" : { @@ -1483,7 +1483,7 @@ "relative_path" : "link04.png", "mime_type" : "image/png", "size" : 497, - "last_modified" : 1774024641031, + "last_modified" : 1774359777384, "fingerprint" : "c363f3ef7f32d9b249c7dc8babdb3eb5aae68c524099e5e97290202b054dda71", "metadata" : { "tile" : { @@ -1501,7 +1501,7 @@ "relative_path" : "link05.png", "mime_type" : "image/png", "size" : 495, - "last_modified" : 1774024641032, + "last_modified" : 1774359777384, "fingerprint" : "1ba8ce75c445396334737143e0cfa56c87a1fb64cca8ad0962192594849249eb", "metadata" : { "tile" : { @@ -1519,7 +1519,7 @@ "relative_path" : "link06.png", "mime_type" : "image/png", "size" : 518, - "last_modified" : 1774024641032, + "last_modified" : 1774359777385, "fingerprint" : "5e0954447699c6d5eac7550f1a10cf520efcddad0b9fbd9a716434da9d9550d4", "metadata" : { "tile" : { @@ -1537,7 +1537,7 @@ "relative_path" : "link07.png", "mime_type" : "image/png", "size" : 517, - "last_modified" : 1774024641032, + "last_modified" : 1774359777385, "fingerprint" : "6104ba7f216a937994d478ed07766ec28f48ad72fdd6620508535a1f877b8ddb", "metadata" : { "tile" : { @@ -1555,7 +1555,7 @@ "relative_path" : "t1381s1.png", "mime_type" : "image/png", "size" : 4970, - "last_modified" : 1774023262790, + "last_modified" : 1774359777386, "fingerprint" : "c8b667527b32436ab97fd57b3215917f7065d6d1b7f6d71be1827351bdc61fa6", "metadata" : { }, "diagnostics" : [ { @@ -1569,7 +1569,7 @@ "relative_path" : "t1489s1.png", "mime_type" : "image/png", "size" : 6489, - "last_modified" : 1774023316667, + "last_modified" : 1774359777387, "fingerprint" : "678c6f48c6d1fcd1209c9d0ab1c46f20eea4871946135263b7363488cceb74f0", "metadata" : { }, "diagnostics" : [ { diff --git a/test-projects/main/cartridge/program.pbx b/test-projects/main/cartridge/program.pbx index 438842cec03e32af2234dd9dfbebc58b6b07384d..7ad9ccf9a285c2e6a7e02fe5ce2bbd5e57bcc2f0 100644 GIT binary patch literal 6437 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 Z%5bwa`4OkJ;?=bGYf2l+s+8m0{{hmlXQcoD diff --git a/test-projects/main/src/main.pbs b/test-projects/main/src/main.pbs index 9e53bacc..f22c4558 100644 --- a/test-projects/main/src/main.pbs +++ b/test-projects/main/src/main.pbs @@ -4,20 +4,27 @@ import { Log } from @sdk:log; import { Input } from @sdk:input; import { Gfx } from @sdk:gfx; +declare global frame_counter: int = 0; +declare global tile_id: int = 0; +declare const MAX_FRAMES: int = 4; + [Frame] fn frame() -> void { let touch = Input.touch(); - let tile_id = 0; - let hold = 0; - let counter = 0; + + if (touch.button().released()) + { + frame_counter = 0; + tile_id = 0; + } if (touch.button().down()) { - hold = touch.button().hold() / 6; - while (counter < hold) + frame_counter = frame_counter + 1; + if (frame_counter > MAX_FRAMES) { - counter = counter + 1; + frame_counter = 0; tile_id = tile_id + 1; if (tile_id > 7) {