mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-07 19:14:40 -04:00
Fix eslint errors
This includes adding a line to `.eslintrc` to allow `console.log`, `console.warn`, and `console.error`.
This commit is contained in:
parent
4a3276d026
commit
751ca97733
3 changed files with 18 additions and 15 deletions
|
@ -7,7 +7,8 @@
|
||||||
"linebreak-style": [2, "unix"],
|
"linebreak-style": [2, "unix"],
|
||||||
"max-len": [2, 80, 4],
|
"max-len": [2, 80, 4],
|
||||||
"semi": [2, "always"],
|
"semi": [2, "always"],
|
||||||
"strict": [2, "never"]
|
"strict": [2, "never"],
|
||||||
|
"no-console": [2, {"allow": ["log", "warn", "error"]}]
|
||||||
},
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"node": true,
|
"node": true,
|
||||||
|
|
|
@ -205,12 +205,13 @@ Runtime.prototype.deleteBlock = function (e) {
|
||||||
Runtime.prototype._registerBlockPackages = function () {
|
Runtime.prototype._registerBlockPackages = function () {
|
||||||
for (var packageName in defaultBlockPackages) {
|
for (var packageName in defaultBlockPackages) {
|
||||||
if (defaultBlockPackages.hasOwnProperty(packageName)) {
|
if (defaultBlockPackages.hasOwnProperty(packageName)) {
|
||||||
// @todo maybe we pass a different runtime depending on package privilege level?
|
// @todo pass a different runtime depending on package privilege?
|
||||||
var packageObject = new (defaultBlockPackages[packageName])(this);
|
var packageObject = new (defaultBlockPackages[packageName])(this);
|
||||||
var packageContents = packageObject.getPrimitives();
|
var packageContents = packageObject.getPrimitives();
|
||||||
for (var op in packageContents) {
|
for (var op in packageContents) {
|
||||||
if (packageContents.hasOwnProperty(op)) {
|
if (packageContents.hasOwnProperty(op)) {
|
||||||
this._primitives[op] = packageContents[op].bind(packageObject);
|
this._primitives[op] =
|
||||||
|
packageContents[op].bind(packageObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,23 +60,24 @@ Sequencer.prototype.stepThreads = function (threads) {
|
||||||
Sequencer.prototype.stepThread = function (thread) {
|
Sequencer.prototype.stepThread = function (thread) {
|
||||||
var opcode = this.runtime._getOpcode(thread.nextBlock);
|
var opcode = this.runtime._getOpcode(thread.nextBlock);
|
||||||
|
|
||||||
if (!opcode) {
|
if (!opcode) {
|
||||||
console.warn('Could not get opcode for block: ' + thread.nextBlock);
|
console.warn('Could not get opcode for block: ' + thread.nextBlock);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var blockFunction = this.runtime.getOpcodeFunction(opcode);
|
||||||
|
if (!blockFunction) {
|
||||||
|
console.warn('Could not get implementation for opcode: ' + opcode);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var blockFunction = this.runtime.getOpcodeFunction(opcode);
|
try {
|
||||||
if (!blockFunction) {
|
blockFunction();
|
||||||
console.warn('Could not get implementation for opcode: ' + opcode);
|
|
||||||
}
|
}
|
||||||
else {
|
catch(e) {
|
||||||
try {
|
console.error('Exception calling block function',
|
||||||
blockFunction();
|
{opcode: opcode, exception: e});
|
||||||
}
|
|
||||||
catch(e) {
|
|
||||||
console.error('Exception calling block function', {opcode: opcode, exception: e});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
thread.nextBlock = this.runtime._getNextBlock(thread.nextBlock);
|
thread.nextBlock = this.runtime._getNextBlock(thread.nextBlock);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue