X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=tests%2FTestCompiler.vala;h=7c23d11d61279900ba2557040dd2cc2d3fdcfdc6;hb=7e857d8072408ca9f7a3384f2bff241200b5991c;hp=433be03232a89cabb114bb59f3a48463c42217f0;hpb=e23a6da98ba197e3e8c8c1078cf92969beea8623;p=app.Builder.js diff --git a/tests/TestCompiler.vala b/tests/TestCompiler.vala index 433be0323..7c23d11d6 100644 --- a/tests/TestCompiler.vala +++ b/tests/TestCompiler.vala @@ -1,5 +1,5 @@ -// valac TreeBuilder.vala --pkg libvala-0.24 --pkg posix -o /tmp/treebuilder +// valac TestCompiler.vala --pkg libvala-0.26 --pkg posix -o /tmp/TestCompiler namespace Palete { @@ -27,7 +27,7 @@ namespace Palete { - public Gee.HashMap checkString( ) + public void checkString( ) { // init context: var valac = "valac " ; @@ -68,9 +68,7 @@ namespace Palete { context.thread = true; - this.report = new ValaSourceReport(this.file); - context.report = this.report; - + context.basedir = "/tmp"; //Posix.realpath ("."); @@ -106,12 +104,7 @@ namespace Palete { context.add_external_package ("gtksourceview-3.0"); context.add_external_package ("libvala-0.26"); // user defined ones.. - - var dcg = pr.compilegroups.get("_default_"); - for (var i = 0; i < dcg.packages.size; i++) { - valac += " --pkg " + dcg.packages.get(i); - context.add_external_package (dcg.packages.get(i)); - } + //Vala.Config.PACKAGE_SUFFIX.substring (1) @@ -121,8 +114,7 @@ namespace Palete { //context.add_external_package ("libvala-0.24"); - this.report.compile_notice("START", "", 0, ""); - + //add_documented_files (context, settings.source_files); @@ -131,11 +123,10 @@ namespace Palete { //gir_parser.parse (context); if (context.report.get_errors () > 0) { print("parse got errors"); - ((ValaSourceReport)context.report).dump(); - + Vala.CodeContext.pop (); - this.report.compile_notice("END", "", 0, ""); - return this.report.line_errors; + + return; } @@ -143,11 +134,9 @@ namespace Palete { // check context: context.check (); if (context.report.get_errors () > 0) { - print("check got errors"); - ((ValaSourceReport)context.report).dump(); - Vala.CodeContext.pop (); - this.report.compile_notice("END", "", 0, ""); - return this.report.line_errors; + Vala.CodeContext.pop (); + + return ; } @@ -168,15 +157,17 @@ namespace Palete { #endif */ + + + context.resolver.resolve(new Vala.CodeContext()); + context.analyzer.context = null; + context.flow_analyzer.analyze(new Vala.CodeContext()); + //context.analyzer = null; << private Vala.CodeContext.pop (); - //(new Vala.CodeNode()).get_error_types().clear(); - //(new Vala.NullType()).get_type_arguments().clear(); - (new Vala.NullType(null)).get_type_arguments().clear(); - parser = null; - this.report.compile_notice("END", "", 0, ""); + print("%s\n", valac); print("ALL OK?\n"); - return this.report.line_errors; + return ; } // // startpoint: @@ -184,13 +175,15 @@ namespace Palete { } } -/* + int main (string[] args) { - var a = new ValaSource(file); - a.create_valac_tree(); + for (var i = 0;i < 1000;i++) { + var a = new Palete.TestCompiler("/home/alan/gitlive/app.Builder.js/tests/TestCompiler.vala"); + a.checkString(); + } return 0; } -*/ +