MCPcopy Create free account
hub / github.com/mozilla/rhino / argumentList

Method argumentList

rhino/src/main/java/org/mozilla/javascript/Parser.java:3068–3100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3066 }
3067
3068 private List<AstNode> argumentList() throws IOException {
3069 if (matchToken(Token.RP, true)) return null;
3070
3071 List<AstNode> result = new ArrayList<>();
3072 boolean wasInForInit = inForInit;
3073 inForInit = false;
3074 try {
3075 do {
3076 if (peekToken() == Token.RP) {
3077 // Quick fix to handle scenario like f1(a,); but not f1(a,b
3078 break;
3079 }
3080 if (peekToken() == Token.YIELD) {
3081 reportError("msg.yield.parenthesized");
3082 }
3083 AstNode en = assignExpr();
3084 if (peekToken() == Token.FOR) {
3085 try {
3086 result.add(generatorExpression(en, 0, true));
3087 } catch (IOException ex) {
3088 // #TODO
3089 }
3090 } else {
3091 result.add(en);
3092 }
3093 } while (matchToken(Token.COMMA, true));
3094 } finally {
3095 inForInit = wasInForInit;
3096 }
3097
3098 mustMatchToken(Token.RP, "msg.no.paren.arg", true);
3099 return result;
3100 }
3101
3102 /**
3103 * Parse a new-expression, or if next token isn't {@link Token#NEW}, a primary expression.

Callers 2

memberExprMethod · 0.95
makeFunctionCallMethod · 0.95

Calls 7

matchTokenMethod · 0.95
peekTokenMethod · 0.95
reportErrorMethod · 0.95
assignExprMethod · 0.95
generatorExpressionMethod · 0.95
mustMatchTokenMethod · 0.95
addMethod · 0.65

Tested by

no test coverage detected