src/jdk/nashorn/internal/parser/Parser.java
Print this page
*** 24,34 ****
*/
package jdk.nashorn.internal.parser;
import static jdk.nashorn.internal.codegen.CompilerConstants.EVAL;
! import static jdk.nashorn.internal.codegen.CompilerConstants.FUNCTION_PREFIX;
import static jdk.nashorn.internal.codegen.CompilerConstants.RUN_SCRIPT;
import static jdk.nashorn.internal.parser.TokenType.ASSIGN;
import static jdk.nashorn.internal.parser.TokenType.CASE;
import static jdk.nashorn.internal.parser.TokenType.CATCH;
import static jdk.nashorn.internal.parser.TokenType.COLON;
--- 24,34 ----
*/
package jdk.nashorn.internal.parser;
import static jdk.nashorn.internal.codegen.CompilerConstants.EVAL;
! import static jdk.nashorn.internal.codegen.CompilerConstants.ANON_FUNCTION_PREFIX;
import static jdk.nashorn.internal.codegen.CompilerConstants.RUN_SCRIPT;
import static jdk.nashorn.internal.parser.TokenType.ASSIGN;
import static jdk.nashorn.internal.parser.TokenType.CASE;
import static jdk.nashorn.internal.parser.TokenType.CATCH;
import static jdk.nashorn.internal.parser.TokenType.COLON;
*** 387,397 ****
final FunctionNode parentFunction = lc.getCurrentFunction();
if (parentFunction != null && !parentFunction.isProgram()) {
sb.append(parentFunction.getName()).append('$');
}
! sb.append(ident != null ? ident.getName() : FUNCTION_PREFIX.symbolName());
final String name = namespace.uniqueName(sb.toString());
assert parentFunction != null || name.equals(RUN_SCRIPT.symbolName()) : "name = " + name;// must not rename runScript().
int flags = 0;
if (parentFunction == null) {
--- 387,399 ----
final FunctionNode parentFunction = lc.getCurrentFunction();
if (parentFunction != null && !parentFunction.isProgram()) {
sb.append(parentFunction.getName()).append('$');
}
! assert ident.getName() != null;
! sb.append(ident.getName());
!
final String name = namespace.uniqueName(sb.toString());
assert parentFunction != null || name.equals(RUN_SCRIPT.symbolName()) : "name = " + name;// must not rename runScript().
int flags = 0;
if (parentFunction == null) {
*** 2446,2456 ****
}
// name is null, generate anonymous name
boolean isAnonymous = false;
if (name == null) {
! final String tmpName = "_L" + functionLine;
name = new IdentNode(functionToken, Token.descPosition(functionToken), tmpName);
isAnonymous = true;
}
expect(LPAREN);
--- 2448,2458 ----
}
// name is null, generate anonymous name
boolean isAnonymous = false;
if (name == null) {
! final String tmpName = ANON_FUNCTION_PREFIX.symbolName() + functionLine;
name = new IdentNode(functionToken, Token.descPosition(functionToken), tmpName);
isAnonymous = true;
}
expect(LPAREN);