TurboWarp / scratch-vm

Scratch VM with a JIT compiler and more features
https://turbowarp.org/
Mozilla Public License 2.0
75 stars 72 forks source link

Add BlockType.INLINE support #2 #217

Closed yuri-kiss closed 3 months ago

yuri-kiss commented 4 months ago

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 https://github.com/TurboWarp/scratch-vm/pull/187#issuecomment-1909147877 And this PR can be used as a replacement for https://github.com/TurboWarp/scratch-vm/pull/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);
LilyMakesThings commented 4 months ago

common ashime W

veggiecan0419 commented 4 months ago

WT_? Bruh... 💀 🤣

yuri-kiss commented 4 months ago

Bruh... 💀 🤣

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