From 328c4aaa49aafc44551f72cb30fa5979542fa635 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Sat, 4 Apr 2009 01:00:14 +0200 Subject: [PATCH] added more compiler test cases --- lib/as3/err/override2.as | 11 +++++++++++ lib/as3/err/publicns.as | 9 +++++++++ lib/as3/ok/conditionalcompile.as | 19 +++++++++++++++++++ lib/as3/ok/namespaces2.as | 1 + lib/as3/ok/resolve.as | 29 +++++++++++++++++++++++++++++ lib/as3/test | 14 +++++++++++--- 6 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 lib/as3/err/override2.as create mode 100644 lib/as3/err/publicns.as create mode 100644 lib/as3/ok/conditionalcompile.as create mode 100644 lib/as3/ok/resolve.as diff --git a/lib/as3/err/override2.as b/lib/as3/err/override2.as new file mode 100644 index 0000000..e9766d5 --- /dev/null +++ b/lib/as3/err/override2.as @@ -0,0 +1,11 @@ +package p { + public class C { + public function e() { + } + } + public class D extends C { + override function f() { + // illegal override: no f() in superclass + } + } +} diff --git a/lib/as3/err/publicns.as b/lib/as3/err/publicns.as new file mode 100644 index 0000000..1fe741b --- /dev/null +++ b/lib/as3/err/publicns.as @@ -0,0 +1,9 @@ +package { + public namespace ns1 = "http://www.namespace.com/" + + public class Test { + public ns1 function name() { + // error: either namespace *or* public + } + } +} diff --git a/lib/as3/ok/conditionalcompile.as b/lib/as3/ok/conditionalcompile.as new file mode 100644 index 0000000..d1af26b --- /dev/null +++ b/lib/as3/ok/conditionalcompile.as @@ -0,0 +1,19 @@ +package test1 { + + import flash.display.MovieClip + + var x; + + TEST::DEBUG { + import jj.xx.jj; + var x:int; + x(); + } + + public class Main extends flash.display.MovieClip { + function Main() { + trace("ok"); + } + + } +} diff --git a/lib/as3/ok/namespaces2.as b/lib/as3/ok/namespaces2.as index 337116d..76133f1 100644 --- a/lib/as3/ok/namespaces2.as +++ b/lib/as3/ok/namespaces2.as @@ -22,6 +22,7 @@ package { { this.tf(1); tf(2); + trace("[exit]"); } } diff --git a/lib/as3/ok/resolve.as b/lib/as3/ok/resolve.as new file mode 100644 index 0000000..be8b2a9 --- /dev/null +++ b/lib/as3/ok/resolve.as @@ -0,0 +1,29 @@ +package { + + import flash.display.MovieClip + + public class B extends C { + static var x:String = "error"; + + function f() { + /* the compiler should prefer the superclass x + over the static x */ + return x; + } + } + + public class C extends D { + } + + public class D { + var x:String = "ok"; + } + + + public class Main extends flash.display.MovieClip { + function Main() { + trace((new B()).f()); + } + } + +} diff --git a/lib/as3/test b/lib/as3/test index e30b451..dc79c90 100755 --- a/lib/as3/test +++ b/lib/as3/test @@ -29,8 +29,8 @@ import select from optparse import OptionParser CMD_ARGS=[] -#CMD = "./parser" -CMD="as3compile" +CMD = "./parser" +#CMD="as3compile" CMD_ARGS=["-o","abc.swf"] def check(s): @@ -130,8 +130,12 @@ class Cache: self.runtime = 5 # allow more time if we're tagging this state self.checknum=-1 + self.checkfile=None if len(args): - self.checknum = int(args[0]) + try: + self.checknum = int(args[0]) + except ValueError: + self.checkfile = args[0] @staticmethod def load(filename): @@ -148,11 +152,15 @@ class Cache: fi.close() def highlight(self, nr, filename): + if self.checkfile and filename==self.checkfile: + return 1 return self.checknum==nr def skip_file(self, nr, filename): if self.checknum>=0 and nr!=self.checknum: return 1 + if self.checkfile and filename!=self.checkfile: + return 1 if not self.all and self.milestone.get(filename,"new")!="ok": return 1 if self.diff and self.filename2status(filename,"new")=="ok": -- 1.7.10.4