summaryrefslogtreecommitdiff
path: root/blocks.js
diff options
context:
space:
mode:
authorNathan Dinsmore <queryselector@gmail.com>2013-04-13 02:21:46 -0400
committerNathan Dinsmore <queryselector@gmail.com>2013-04-13 02:21:46 -0400
commit285ec99c213f1e031738a9756033dfafa94c5888 (patch)
tree6c98bf6426e2286ffe1facca5b5dd7fff8c71ceb /blocks.js
parent15718f44a30a022a5f45001f3fd2d506da504ff1 (diff)
downloadsnap-285ec99c213f1e031738a9756033dfafa94c5888.tar.gz
snap-285ec99c213f1e031738a9756033dfafa94c5888.zip
Fixed issue #33
Generated variable names now follow the pattern a..z, aa..zz, aaa..zzz, etc.
Diffstat (limited to 'blocks.js')
-rw-r--r--blocks.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/blocks.js b/blocks.js
index 061e176..d4c812e 100644
--- a/blocks.js
+++ b/blocks.js
@@ -7707,13 +7707,20 @@ MultiArgMorph.prototype.drawNew = function () {
// MultiArgMorph arity control:
MultiArgMorph.prototype.addInput = function (contents) {
- var newPart = this.labelPart(this.slotSpec),
+ var i, name,
+ newPart = this.labelPart(this.slotSpec),
idx = this.children.length - 1;
// newPart.alpha = this.alpha ? 1 : (1 - this.alpha) / 2;
if (contents) {
newPart.setContents(contents);
} else if (this.elementSpec === '%scriptVars') {
- newPart.setContents('abcdefghijklmnopqrstuvwxyz'[idx - 1] || 'foo');
+ name = '';
+ i = idx;
+ while (i > 0) {
+ name = String.fromCharCode(97 + (i - 1) % 26) + name;
+ i = Math.floor((i - 1) / 26);
+ }
+ newPart.setContents(name);
} else if (contains(['%parms', '%ringparms'], this.elementSpec)) {
newPart.setContents('#' + idx);
}