|
// we're need to put the function literals in parenthesis to ensure that
// they're parsed as function expressions and not function declarations.
assertParserOutput(
new ExpressionStatement(
new FunctionLiteral(
null,
new Identifier[] {
},
new Statement[] {
}
)
),
"(function () {});"
);
assertParserOutput(
new ExpressionStatement(
new FunctionLiteral(
new Identifier("foo"),
new Identifier[] {
},
new Statement[] {
}
)
),
"(function foo() {});"
);
assertParserOutput(
new ExpressionStatement(
new FunctionLiteral(
new Identifier("foo"),
new Identifier[] {
new Identifier("a"),
},
new Statement[] {
}
)
),
"(function foo(a) {});"
);
assertParserOutput(
new ExpressionStatement(
new FunctionLiteral(
new Identifier("foo"),
new Identifier[] {
new Identifier("a"),
new Identifier("b"),
new Identifier("c"),
},
new Statement[] {
}
)
),
"(function foo(a, b, c) {});"
);
assertParserOutput(
new ExpressionStatement(
new FunctionLiteral(
new Identifier("foo"),
new Identifier[] {
new Identifier("a"),
new Identifier("b"),
|