diff options
| author | john.j.camilleri <john.j.camilleri@chalmers.se> | 2012-12-04 15:45:41 +0000 |
|---|---|---|
| committer | john.j.camilleri <john.j.camilleri@chalmers.se> | 2012-12-04 15:45:41 +0000 |
| commit | 32f085a4b53b5567dd5a28c2f07da1aecc0b1194 (patch) | |
| tree | 96b2728c9c24b458d601452eb2ee5cb437acea53 /src/www/syntax-editor/ast.js | |
| parent | f5e4385fddd8693f7d7cce3fa782221bafa772c9 (diff) | |
Syntax editor: wrap now handles multiple possible positions for subtree
Diffstat (limited to 'src/www/syntax-editor/ast.js')
| -rw-r--r-- | src/www/syntax-editor/ast.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/www/syntax-editor/ast.js b/src/www/syntax-editor/ast.js index 5aa55d230..89bdcf5c4 100644 --- a/src/www/syntax-editor/ast.js +++ b/src/www/syntax-editor/ast.js @@ -137,7 +137,8 @@ function AST(fun, cat) { } // Wrap the current node inside another node - this.wrap = function(typeobj, childid) { + // Doesn't check whether child_id is within in range + this.wrap = function(typeobj, child_id) { var subtree = new ASTNode(this.currentNode); this.currentNode.fun = typeobj.name.join(" "); this.currentNode.cat = typeobj.ret; @@ -145,7 +146,7 @@ function AST(fun, cat) { for (var i in typeobj.args) { this.add(null, typeobj.args[i]); } - this.currentNode.children[i] = subtree; + this.currentNode.children[child_id] = subtree; return subtree; } |
