com.google.caja.parser.js.FunctionDeclaration

Here are the examples of the java api class com.google.caja.parser.js.FunctionDeclaration taken from open source projects.

1. ScopeTest#testUnmaskableFormals()

Project: caja
Source File: ScopeTest.java
View license
public final void testUnmaskableFormals() throws Exception {
    Block b = js(fromString("function NaN(Infinity, arguments) {}"));
    Scope top = fromProgram(b);
    FunctionDeclaration fn = ((FunctionDeclaration) b.children().get(0));
    Scope.fromFunctionConstructor(top, fn.getInitializer());
    assertMessage(RewriterMessageType.CANNOT_MASK_IDENTIFIER, MessageLevel.FATAL_ERROR, MessagePart.Factory.valueOf("NaN"));
    assertMessage(RewriterMessageType.CANNOT_MASK_IDENTIFIER, MessageLevel.FATAL_ERROR, MessagePart.Factory.valueOf("Infinity"));
    assertMessage(RewriterMessageType.CANNOT_MASK_IDENTIFIER, MessageLevel.FATAL_ERROR, MessagePart.Factory.valueOf("arguments"));
}