MCPcopy Index your code
hub / github.com/nodejs/node / parseMemberExpressionOrHigher

Function parseMemberExpressionOrHigher

test/fixtures/snapshot/typescript.js:35132–35183  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35130 return parseCallExpressionRest(pos, expression);
35131 }
35132 function parseMemberExpressionOrHigher() {
35133 // Note: to make our lives simpler, we decompose the NewExpression productions and
35134 // place ObjectCreationExpression and FunctionExpression into PrimaryExpression.
35135 // like so:
35136 //
35137 // PrimaryExpression : See 11.1
35138 // this
35139 // Identifier
35140 // Literal
35141 // ArrayLiteral
35142 // ObjectLiteral
35143 // (Expression)
35144 // FunctionExpression
35145 // new MemberExpression Arguments?
35146 //
35147 // MemberExpression : See 11.2
35148 // PrimaryExpression
35149 // MemberExpression[Expression]
35150 // MemberExpression.IdentifierName
35151 //
35152 // CallExpression : See 11.2
35153 // MemberExpression
35154 // CallExpression Arguments
35155 // CallExpression[Expression]
35156 // CallExpression.IdentifierName
35157 //
35158 // Technically this is ambiguous. i.e. CallExpression defines:
35159 //
35160 // CallExpression:
35161 // CallExpression Arguments
35162 //
35163 // If you see: "new Foo()"
35164 //
35165 // Then that could be treated as a single ObjectCreationExpression, or it could be
35166 // treated as the invocation of "new Foo". We disambiguate that in code (to match
35167 // the original grammar) by making sure that if we see an ObjectCreationExpression
35168 // we always consume arguments if they are there. So we treat "new Foo()" as an
35169 // object creation only, and not at all as an invocation. Another way to think
35170 // about this is that for every "new" that we see, we will consume an argument list if
35171 // it is there as part of the *associated* object creation node. Any additional
35172 // argument lists we see, will become invocation expressions.
35173 //
35174 // Because there are no other places in the grammar now that refer to FunctionExpression
35175 // or ObjectCreationExpression, it is safe to push down into the PrimaryExpression
35176 // production.
35177 //
35178 // Because CallExpression and MemberExpression are left recursive, we need to bottom out
35179 // of the recursion immediately. So we parse out a primary expression to start with.
35180 var pos = getNodePos();
35181 var expression = parsePrimaryExpression();
35182 return parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
35183 }
35184 function parseSuperExpression() {
35185 var pos = getNodePos();
35186 var expression = parseTokenNode();

Callers 1

Calls 3

getNodePosFunction · 0.85
parsePrimaryExpressionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…