Skip to content

Commit

Permalink
Fix compilation bugs reported by zartan9
Browse files Browse the repository at this point in the history
Merge pull request #11 from haroldo-ok/fix-zartan9-compilation

- Routine that moved variable declarations to the top of the function caused an error if there were no variables;
- Fixed a pair of compiler invocation errors that happened if the current project wasn't named test.

This fixes #10
  • Loading branch information
haroldo-ok authored Nov 22, 2021
2 parents 99c5005 + 64e5a26 commit 75286fa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions blockly/apps/blocklyduino/blockly_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function compileAndRun() {
.then(async () => {
printToConsole('-----------------------');
printToConsole('Building and starting emulator...');
await vn32x.execConsole(`cd "${path.resolve(buildScriptPath())}" && echo aaa | test-${platformToRun()}.bat`);
await vn32x.execConsole(`cd "${path.resolve(buildScriptPath())}" && echo aaa | ${project.current.name}-${platformToRun()}.bat`);
})
.catch(err => {
console.error(err);
Expand Down Expand Up @@ -359,7 +359,7 @@ const convertPortraits = async () => {
}

const generateBuildScripts = async () => {
return execBuilder(` -projectFile projects/${project.current.name}/test.builder ` +
return execBuilder(` -projectFile projects/${project.current.name}/${project.current.name}.builder ` +
'-useGUI False -callEmu True');
}

Expand Down
2 changes: 1 addition & 1 deletion blockly/generators/arduino.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ Blockly.Arduino.scrub_ = function(block, code) {
Blockly.Arduino.scrubLocalVars_ = function(code, indent) {
indent = indent || '';
const varDeclarationRegex = /\n\s*int\s*(\w+\s*,\s*)*\s*\w+\s*;/g;
const vars = code.match(varDeclarationRegex).map(s => indent + (s || '').trim());
const vars = (code.match(varDeclarationRegex) || []).map(s => indent + (s || '').trim());
const codeWithNoVars = code.replace(varDeclarationRegex, '');
return vars.join('\n') + '\n\n' + codeWithNoVars;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "BlocklyVN8bit",
"version": "0.2.1",
"version": "0.2.2",
"description": "Uses blockly to generate visual novels for 8bit-Unity",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit 75286fa

Please sign in to comment.