Skip to content

Commit 72a2445

Browse files
authored
Merge pull request #23 from Nitro-Bolt/next-up
The Next Compiler
2 parents 1b58840 + c7929d3 commit 72a2445

File tree

121 files changed

+4913
-2295
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+4913
-2295
lines changed

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"jszip": "^3.1.5",
5151
"scratch-parser": "github:Nitro-Bolt/scratch-parser#master",
5252
"scratch-sb1-converter": "0.2.7",
53-
"scratch-translate-extension-languages": "0.0.20191118205314",
53+
"scratch-translate-extension-languages": "^1.0.7",
5454
"text-encoding": "0.7.0",
5555
"uuid": "8.3.2",
5656
"worker-loader": "^1.1.1"

src/compiler/compat-block-utility.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1+
// @ts-check
2+
13
const BlockUtility = require('../engine/block-utility');
24

35
class CompatibilityLayerBlockUtility extends BlockUtility {
46
constructor () {
57
super();
8+
this._stackFrame = {};
69
this._startedBranch = null;
710
}
811

912
get stackFrame () {
10-
return this.thread.compatibilityStackFrame;
13+
return this.thread?.compatibilityStackFrame;
1114
}
1215

1316
startBranch (branchNumber, isLoop) {

src/compiler/compat-blocks.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// @ts-check
2+
13
/**
24
* @fileoverview List of blocks to be supported in the compiler compatibility layer.
35
* This is only for native blocks. Extensions should not be listed here.

src/compiler/compile.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1+
// @ts-check
2+
13
const {IRGenerator} = require('./irgen');
4+
const {IROptimizer} = require('./iroptimizer');
25
const JSGenerator = require('./jsgen');
36

4-
const compile = thread => {
7+
const compile = (/** @type {import("../engine/thread")} */ thread) => {
58
const irGenerator = new IRGenerator(thread);
69
const ir = irGenerator.generate();
710

11+
const irOptimizer = new IROptimizer(ir);
12+
irOptimizer.optimize();
13+
814
const procedures = {};
915
const target = thread.target;
1016

11-
const compileScript = script => {
17+
const compileScript = (/** @type {import("./intermediate").IntermediateScript} */ script) => {
1218
if (script.cachedCompileResult) {
1319
return script.cachedCompileResult;
1420
}

0 commit comments

Comments
 (0)