MCPcopy Index your code
hub / github.com/BloombergGraphics/whatiscode / parseArrayPattern

Function parseArrayPattern

scripts/libs/esprima.js:2232–2260  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2230 }
2231
2232 function parseArrayPattern() {
2233 var node = new Node(), elements = [], rest, restNode;
2234 expect('[');
2235
2236 while (!match(']')) {
2237 if (match(',')) {
2238 lex();
2239 elements.push(null);
2240 } else {
2241 if (match('...')) {
2242 restNode = new Node();
2243 lex();
2244 rest = parseVariableIdentifier();
2245 elements.push(restNode.finishRestElement(rest));
2246 break;
2247 } else {
2248 elements.push(parsePatternWithDefault());
2249 }
2250 if (!match(']')) {
2251 expect(',');
2252 }
2253 }
2254
2255 }
2256
2257 expect(']');
2258
2259 return node.finishArrayPattern(elements);
2260 }
2261
2262 function parsePropertyPattern() {
2263 var node = new Node(), key, computed = match('['), init;

Callers 1

parsePatternFunction · 0.85

Calls 5

expectFunction · 0.85
matchFunction · 0.85
lexFunction · 0.85
parseVariableIdentifierFunction · 0.85
parsePatternWithDefaultFunction · 0.85

Tested by

no test coverage detected