diff options
Diffstat (limited to 'threads.js')
| -rw-r--r-- | threads.js | 25 |
1 files changed, 20 insertions, 5 deletions
@@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2014-May-02'; +modules.threads = '2014-July-08'; var ThreadManager; var Process; @@ -673,11 +673,13 @@ Process.prototype.doYield = function () { // Process Exception Handling Process.prototype.handleError = function (error, element) { + var m = element; this.stop(); this.errorFlag = true; this.topBlock.addErrorHighlight(); - (element || this.topBlock).showBubble( - (element ? '' : 'Inside: ') + if (isNil(m) || isNil(m.world())) {m = this.topBlock; } + m.showBubble( + (m === element ? '' : 'Inside: ') + error.name + '\n' + error.message @@ -1057,7 +1059,6 @@ Process.prototype.evaluateCustomBlock = function () { } }; - // Process variables primitives Process.prototype.doDeclareVariables = function (varNames) { @@ -3054,7 +3055,7 @@ VariableFrame.prototype.getVar = function (name, upvars) { VariableFrame.prototype.addVar = function (name, value) { this.vars[name] = (value === 0 ? 0 : value === false ? false - : value === '' ? '' : value || null); + : value === '' ? '' : value || 0); }; VariableFrame.prototype.deleteVar = function (name) { @@ -3110,6 +3111,20 @@ VariableFrame.prototype.allNames = function () { return answer; }; +// Variable ///////////////////////////////////////////////////////////////// + +function Variable(value) { + this.value = value; +} + +Variable.prototype.toString = function () { + return 'a Variable [' + this.value + ']'; +}; + +Variable.prototype.copy = function () { + return new Variable(this.value); +}; + // UpvarReference /////////////////////////////////////////////////////////// // ... quasi-inherits some features from VariableFrame |
