From 32f085a4b53b5567dd5a28c2f07da1aecc0b1194 Mon Sep 17 00:00:00 2001 From: "john.j.camilleri" Date: Tue, 4 Dec 2012 15:45:41 +0000 Subject: Syntax editor: wrap now handles multiple possible positions for subtree --- src/www/syntax-editor/ast.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/www/syntax-editor/ast.js') 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; } -- cgit v1.2.3