diff options
| author | jmoenig <jens@moenig.org> | 2013-10-04 10:34:59 +0200 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2013-10-04 10:34:59 +0200 |
| commit | ec6b46a4c58f25ab7f8c1e47493f131809b6fd3b (patch) | |
| tree | 1227c89f855d2f6bc2d55020c9ec9d2e95527a4c | |
| parent | 9a0881b96a729b2dcdc55645b293f61276551fa6 (diff) | |
| download | snap-byow-ec6b46a4c58f25ab7f8c1e47493f131809b6fd3b.tar.gz snap-byow-ec6b46a4c58f25ab7f8c1e47493f131809b6fd3b.zip | |
Type-check the SPLIT block's input before eval'ing it
| -rwxr-xr-x | history.txt | 4 | ||||
| -rw-r--r-- | threads.js | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/history.txt b/history.txt index 93860b5..2605a14 100755 --- a/history.txt +++ b/history.txt @@ -1933,3 +1933,7 @@ ______ 131001 ------ * Objects: smooth numerical values displayed in watchers + +131004 +------ +* Threads: Type-check the SPLIT block's input before eval'ing it @@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2013-September-16'; +modules.threads = '2013-October-04'; var ThreadManager; var Process; @@ -2002,8 +2002,18 @@ Process.prototype.reportUnicodeAsLetter = function (num) { }; Process.prototype.reportTextSplit = function (string, delimiter) { - var str = (string || '').toString(), + var types = ['text', 'number'], + strType = this.reportTypeOf(string), + delType = this.reportTypeOf(this.inputOption(delimiter)), + str, del; + if (!contains(types, strType)) { + throw new Error('expecting a text instad of a ' + strType); + } + if (!contains(types, delType)) { + throw new Error('expecting a text delimiter instad of a ' + delType); + } + str = (string || '').toString(); switch (this.inputOption(delimiter)) { case 'line': del = '\n'; |
