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) ...
244245246247248249250251252253
@Override protected IClassNode getClassNode(String code) { String source = "package org.apache.flex {import flash.events.IEventDispatcher;import mx.logging.ILogger;import spark.components.Button;" + code + "}"; IFileNode node = compileAS(source); IClassNode child = (IClassNode) findFirstDescendantOfType(node, IClassNode.class); return child; }
224225226227228229230231232233
} protected IClassNode getClassNode(String code) { String source = "package {" + code + "}"; IFileNode node = compileAS(source); IClassNode child = (IClassNode) findFirstDescendantOfType(node, IClassNode.class); return child; }
3839404142434445464748
@Test public void testLocalFunction() { String fileName = "LocalFunction"; IFileNode node = compileAS(fileName, true, "test-files" + File.separator + "flexjs" + File.separator + "files", false); asBlockWalker.visitFile(node);
5657585960616263646566
@Test public void testFlexJSMyController() { String fileName = "controllers/MyController"; IFileNode node = compileAS(fileName, true, "test-files" + File.separator + "flexjs" + File.separator + "files", false); asBlockWalker.visitFile(node);
7475767778798081828384
@Test public void testFlexJSMyModel() { String fileName = "models/MyModel"; IFileNode node = compileAS(fileName, true, "test-files" + File.separator + "flexjs" + File.separator + "files", false); asBlockWalker.visitFile(node); //writeResultToFile(writer.toString(), fileName);
353637383940414243
{ @Override @Test public void testPackage_Simple() { IFileNode node = compileAS("package{}"); asBlockWalker.visitFile(node); assertOut(""); }
434445464748495051
} @Test public void testPackage_SimpleName() { IFileNode node = compileAS("package foo {}"); asBlockWalker.visitFile(node); assertOut(""); }
525354555657585960
@Override @Test public void testPackage_Name() { IFileNode node = compileAS("package foo.bar.baz {}"); asBlockWalker.visitFile(node); assertOut(""); }
707172737475767778
// (erikdebruin) the constuctor IS the class definition, in 'goog' JS, // therefor we need to write out implicit constructors // (if I understand the term correctly) IFileNode node = compileAS("package {public class A{}}"); asBlockWalker.visitFile(node); assertOut("goog.provide('A');\n\n/**\n * @constructor\n */\nA = function() {\n};"); }
798081828384858687
@Override @Test public void testPackageQualified_Class() { IFileNode node = compileAS("package foo.bar.baz {public class A{}}"); asBlockWalker.visitFile(node); assertOut("goog.provide('foo.bar.baz.A');\n\n/**\n * @constructor\n */\nfoo.bar.baz.A = function() {\n};"); }