Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BlockType.INLINE support #2 #217

Closed
wants to merge 4 commits into from
Closed

Add BlockType.INLINE support #2 #217

wants to merge 4 commits into from

Conversation

yuri-kiss
Copy link

@yuri-kiss yuri-kiss commented Jun 16, 2024

Resolves

Nothing is resolved this is just a new feature.

Proposed Changes

Adds BlockType.INLINE support in full (so compiler support)
This takes the second approach of #187 (comment)
And this PR can be used as a replacement for #187 itself.

Reason for Changes

The need for ugly inline patches and hacky thread stuff.

Test Coverage

No tests but I did try with a extension.

(function(Scratch) {
  class InlineBlockTest {
    getInfo() {
      return {
        id: 'InlineBlockTest',
        name: 'Test: Inline Block',
        blocks: [{
          blockType: Scratch.BlockType.INLINE,
          opcode: 'block',
          text: 'inline',
        }]
      }
    }
    async block(_, util) {
      await (Promise.resolve());
      util.startBranch(1, true); // Loop does not actually work like "loop"
      return 'test';
    }
  }
  Scratch.extensions.register(new InlineBlockTest);
})(Scratch);

@yuri-kiss yuri-kiss changed the title Add inline blocktype support Add BlockType.INLINE support #2 Jun 16, 2024
@@ -439,9 +439,29 @@ class JSGenerator {
return new TypedInput(`p${node.index}`, TYPE_UNKNOWN);

case 'compat':
if (node.blockType === BlockType.INLINE) {
Copy link
Author

@yuri-kiss yuri-kiss Jun 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently util.startBranch with the loop parameter as true does not actually make it a loop, I dont know how to fix this while still allowing a return value.

And honestly I don't see a practical reason for the block to be a loop anyways but I did attempt to support it with no avail, the return value was able to be grabbed but without using globalState.blockUtility._startedBranch[0] I cant get the branch from what I know.

If this does not matter I can resolve this, I just wanted to point it out to you. (garbomuffin)

@LilyMakesThings
Copy link

common ashime W

@veggiecan0419
Copy link

veggiecan0419 commented Jun 17, 2024

WT_?
Bruh... 💀 🤣

@yuri-kiss
Copy link
Author

yuri-kiss commented Jun 17, 2024

Bruh... 💀 🤣

I just realized what that was, this is not something I can fix

@yuri-kiss yuri-kiss closed this by deleting the head repository Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants