An IFileNode is the root of the AST (abstract syntax tree) produced for a file.
IFileNode
If the file includes other files, a single IFileNode is produced.
The shape of this node is
IFileNode IASNode <-- getChild(0) IASNode <-- getChild(1) ...
606162636465666768
} @Test public void testPackageSimple_Class() { IFileNode node = compileAS("package {public class A{}}"); asBlockWalker.visitFile(node); assertOut("package {\n\tpublic class A {\n\t}\n}"); }
686970717273747576
} @Test public void testPackageQualified_Class() { IFileNode node = compileAS("package foo.bar.baz {public class A{}}"); asBlockWalker.visitFile(node); assertOut("package foo.bar.baz {\n\tpublic class A {\n\t}\n}"); }
767778798081828384
} @Test public void testPackageQualified_ClassBody() { IFileNode node = compileAS("package foo.bar.baz {public class A{public function A(){}}}"); asBlockWalker.visitFile(node); assertOut("package foo.bar.baz {\n\tpublic class A {\n\t\tpublic function A() {\n\t\t}\n\t}\n}"); }
84858687888990919293
} @Test public void testPackageQualified_ClassBodyMethodContents() { IFileNode node = compileAS("package foo.bar.baz {public class A{public function A(){if (a){for each(var i:Object in obj){doit();}}}}}"); asBlockWalker.visitFile(node); assertOut("package foo.bar.baz {\n\tpublic class A {\n\t\tpublic function A() {\n\t\t\t" + "if (a) {\n\t\t\t\tfor each (var i:Object in obj) {\n\t\t\t\t\tdoit();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}"); }
194195196197198199200201202203
} protected INamespaceNode getNamespace(String code) { String source = "package {public class A {" + code + "}}"; IFileNode node = compileAS(source); INamespaceNode child = (INamespaceNode) findFirstDescendantOfType(node, INamespaceNode.class); return child; }
383940414243444546
@Override @Test public void testPackage_Simple() { IFileNode node = compileAS("package{}"); asBlockWalker.visitFile(node); assertOut(""); }
474849505152535455
@Override @Test public void testPackage_SimpleName() { IFileNode node = compileAS("package foo {}"); asBlockWalker.visitFile(node); assertOut(""); }
565758596061626364
@Override @Test public void testPackage_Name() { IFileNode node = compileAS("package foo.bar.baz {}"); asBlockWalker.visitFile(node); assertOut(""); }
656667686970717273
@Override @Test public void testPackageSimple_Class() { IFileNode node = compileAS("package {public class A{}}"); asBlockWalker.visitFile(node); //assertOut(""); }
808182838485868788
@Override @Test public void testPackageQualified_Class() { IFileNode node = compileAS("package foo.bar.baz {public class A{}}"); asBlockWalker.visitFile(node); //assertOut(""); }