reason="function declarations contain function constructors but don't"
+ " have the same discrepencies on IE 6 as function constructors",
synopsis="")
public ParseTreeNode fire(ParseTreeNode node, Scope scope) {
if (node instanceof FunctionDeclaration) {
FunctionDeclaration decl = ((FunctionDeclaration) node);
FunctionConstructor ctor = decl.getInitializer();
Scope s2 = Scope.fromFunctionConstructor(scope, ctor);
FunctionConstructor rewritten
= (FunctionConstructor) QuasiBuilder.substV(
"function @ident(@formals*) { @stmts*; @body*; }",
"ident", ctor.getIdentifier(),
"formals", expandAll(
new ParseTreeNodeContainer(ctor.getParams()), s2),
"stmts", new ParseTreeNodeContainer(s2.getStartStatements()),
"body", expandAll(
new ParseTreeNodeContainer(ctor.getBody().children()), s2)
);
return new FunctionDeclaration(rewritten);
}
return NONE;
}
});
w.addRule(new Rule() {