X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=src%2FJsRender%2FNodeToVala.vala;h=1350c0dc62488d255f644f711f0900df62e6a7c1;hb=HEAD;hp=4d718eed29b550bc82044f6f00a7490b58a980cb;hpb=60a3fc09f03f617f1b07cfabdbdfe35c23004c17;p=app.Builder.js diff --git a/src/JsRender/NodeToVala.vala b/src/JsRender/NodeToVala.vala index 4d718eed2..1350c0dc6 100644 --- a/src/JsRender/NodeToVala.vala +++ b/src/JsRender/NodeToVala.vala @@ -1,8 +1,8 @@ /** * - * Code to convert node tree to Javascript... + * Code to convert node tree to Vala... * - * usage : x = (new JsRender.NodeToJs(node)).munge(); + * usage : x = (new JsRender.NodeToVala(node)).munge(); * * * @@ -66,7 +66,10 @@ public class JsRender.NodeToVala : Object { node.line_end = this.cur_line; node.lines = new Gee.ArrayList(); node.line_map = new Gee.HashMap(); - + if (parent == null) { + node.node_lines = new Gee.ArrayList(); + node.node_lines_map = new Gee.HashMap(); + } } @@ -188,13 +191,15 @@ public class JsRender.NodeToVala : Object { public void addLine(string str= "") { this.cur_line++; - this.ret += "/*%d*/ ".printf(this.cur_line-1) + str + "\n"; + //this.ret += "/*%d*/ ".printf(this.cur_line-1) + str + "\n"; + this.ret += str + "\n"; } public void addMultiLine(string str= "") { - var l = this.cur_line; + this.cur_line += str.split("\n").length; - this.ret += "/*%d*/ ".printf(l) + str + "\n"; + //this.ret += "/*%d*/ ".printf(l) + str + "\n"; + this.ret += str + "\n"; } @@ -217,6 +222,9 @@ public class JsRender.NodeToVala : Object { // class header.. // class xxx { WrappedGtk el; } this.node.line_start = this.cur_line; + + this.top.node.setNodeLine(this.cur_line, this.node); + this.addLine(inpad + "public class " + this.xcls + " : Object"); this.addLine(this.inpad + "{"); @@ -570,7 +578,7 @@ public class JsRender.NodeToVala : Object { var iter = cls.props.map_iterator(); while (iter.next()) { var p = iter.get_key(); - print("Check Write %s\n", p); + //print("Check Write %s\n", p); if (!this.node.has(p)) { continue; } @@ -814,7 +822,7 @@ public class JsRender.NodeToVala : Object { } var iter = this.node.items.list_iterator(); - var i = -1; + while (iter.next()) { this.addMultiLine(this.mungeChild(iter.get())); }