X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=tests%2FTreeBuilder.vala;h=325a3c7b89fbeea4aa73f5be3a4452e812c2244e;hb=f10e0933c16d3bea5bdd2bde43c8b149a2312b30;hp=8c68d49cbf84df817a8909a8f82d38aab1489d2e;hpb=4c46dc0606965f0eda17ff20fa91462da065a475;p=app.Builder.js diff --git a/tests/TreeBuilder.vala b/tests/TreeBuilder.vala index 8c68d49cb..325a3c7b8 100644 --- a/tests/TreeBuilder.vala +++ b/tests/TreeBuilder.vala @@ -6,7 +6,15 @@ namespace Palete { public class ValaSourceReport : Vala.Report { + + Gee.HashMap line_errors; + + public ValaSourceReport() + { + base(); + this.line_errors = new Gee.HashMap (); + } public override void err (Vala.SourceReference? source, string message) { errors++; @@ -17,28 +25,26 @@ namespace Palete { if (source.file != "~~~~~testfile.vala") { return; } + var pre = ""; if (line_errors.has_key(source.begin.line)) { - line_errors(source.begin.line - var line = source.begin.line; - - stderr.printf ("%s: My error: %s\n", source.to_string (), message); - - //Vala.Report.report_source (source); - + pre = line_errors.get(source.begin.line) + "\n"; + } + line_errors.set(source.begin.line, pre + message); } } public class ValaSource : Vala.CodeVisitor { - - public Vala.CodeContext check (JsRender.Gtk file) { - // init context: + Vala.CodeContext context; + + public ValaSource(JsRender.JsRender file) { + base(); + // init context: - - var context = new Vala.CodeContext (); + context = new Vala.CodeContext (); Vala.CodeContext.push (context); context.experimental = false; @@ -68,7 +74,7 @@ namespace Palete { context, Vala.SourceFileType.SOURCE, "~~~~~testfile.vala", - file.toSource() + NodeToVala.mungeFile(file) ); //context.add_source_file (testcode); @@ -103,8 +109,9 @@ namespace Palete { parser.parse (context); //gir_parser.parse (context); if (context.report.get_errors () > 0) { - print("got errors"); - return context; + print("parse got errors"); + Vala.CodeContext.pop (context); + return; } @@ -113,20 +120,23 @@ namespace Palete { context.check (); if (context.report.get_errors () > 0) { print("check got errors"); - return context; + Vala.CodeContext.pop (context); + return; } + Vala.CodeContext.pop (context); print("ALL OK?\n"); - return context; + return; } // // startpoint: // } +} int main (string[] args) { - var a = new TreeBuilder(); + var a = new ValaSource(file); a.create_valac_tree(); return 0; }