Allow implicit type conversion.
This commit is contained in:
parent
14a9f13ce8
commit
b301a2f8b9
4 changed files with 3 additions and 4 deletions
1
.jscsrc
1
.jscsrc
|
@ -19,7 +19,6 @@
|
||||||
"disallowSpaceAfterObjectKeys": true,
|
"disallowSpaceAfterObjectKeys": true,
|
||||||
"requireCommaBeforeLineBreak": true,
|
"requireCommaBeforeLineBreak": true,
|
||||||
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
|
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
|
||||||
"disallowImplicitTypeConversion": ["numeric", "boolean", "binary", "string"],
|
|
||||||
"validateIndentation": 4,
|
"validateIndentation": 4,
|
||||||
"disallowMixedSpacesAndTabs": true,
|
"disallowMixedSpacesAndTabs": true,
|
||||||
"disallowTrailingWhitespace": true,
|
"disallowTrailingWhitespace": true,
|
||||||
|
|
|
@ -383,7 +383,7 @@ Interpreter.prototype.isRunning = function(b) {
|
||||||
|
|
||||||
Interpreter.prototype.startSubstack = function(b, isLoop, secondSubstack) {
|
Interpreter.prototype.startSubstack = function(b, isLoop, secondSubstack) {
|
||||||
// Start the substack of a control structure command such as if or forever.
|
// Start the substack of a control structure command such as if or forever.
|
||||||
b.isLoop = Boolean(isLoop);
|
b.isLoop = !!isLoop;
|
||||||
this.activeThread.stack.push(b); // remember the block that started the substack
|
this.activeThread.stack.push(b); // remember the block that started the substack
|
||||||
if (!secondSubstack) {
|
if (!secondSubstack) {
|
||||||
this.activeThread.nextBlock = b.substack;
|
this.activeThread.nextBlock = b.substack;
|
||||||
|
|
|
@ -110,7 +110,7 @@ Reporter.prototype.update = function() {
|
||||||
newValue = target.currentCostumeIndex + 1;
|
newValue = target.currentCostumeIndex + 1;
|
||||||
break;
|
break;
|
||||||
case 'timer':
|
case 'timer':
|
||||||
newValue = (Math.round(interp.primitiveTable.timer() * 10) / 10).toString();
|
newValue = '' + Math.round(interp.primitiveTable.timer() * 10) / 10;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (typeof newValue === 'number' && Math.abs(newValue) > 0.001) {
|
if (typeof newValue === 'number' && Math.abs(newValue) > 0.001) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ Primitives.prototype.addPrimsTo = function(primTable) {
|
||||||
primTable['computeFunction:of:'] = this.primMathFunction;
|
primTable['computeFunction:of:'] = this.primMathFunction;
|
||||||
|
|
||||||
// String primitives
|
// String primitives
|
||||||
primTable['concatenate:with:'] = function(b) { return (interp.arg(b, 0) + interp.arg(b, 1)).toString(); };
|
primTable['concatenate:with:'] = function(b) { return '' + interp.arg(b, 0) + interp.arg(b, 1); };
|
||||||
primTable['letter:of:'] = this.primLetterOf;
|
primTable['letter:of:'] = this.primLetterOf;
|
||||||
primTable['stringLength:'] = function(b) { return interp.arg(b, 0).length; };
|
primTable['stringLength:'] = function(b) { return interp.arg(b, 0).length; };
|
||||||
|
|
||||||
|
|
Reference in a new issue