Lines Matching refs:node
16 pp.parseTopLevel = function(node) { argument
18 if (!node.body) node.body = []
21 node.body.push(stmt)
25 node.sourceType = this.options.sourceType
27 return this.finishNode(node, "Program")
69 let starttype = this.type, node = this.startNode(), kind
81 …case tt._break: case tt._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
82 case tt._debugger: return this.parseDebuggerStatement(node)
83 case tt._do: return this.parseDoStatement(node)
84 case tt._for: return this.parseForStatement(node)
87 return this.parseFunctionStatement(node, false)
90 return this.parseClass(node, true)
91 case tt._if: return this.parseIfStatement(node)
92 case tt._return: return this.parseReturnStatement(node)
93 case tt._switch: return this.parseSwitchStatement(node)
94 case tt._throw: return this.parseThrowStatement(node)
95 case tt._try: return this.parseTryStatement(node)
99 return this.parseVarStatement(node, kind)
100 case tt._while: return this.parseWhileStatement(node)
101 case tt._with: return this.parseWithStatement(node)
103 case tt.semi: return this.parseEmptyStatement(node)
112 return starttype === tt._import ? this.parseImport(node) : this.parseExport(node, exports)
122 return this.parseFunctionStatement(node, true)
127 return this.parseLabeledStatement(node, maybeName, expr)
128 else return this.parseExpressionStatement(node, expr)
132 pp.parseBreakContinueStatement = function(node, keyword) { argument
135 if (this.eat(tt.semi) || this.insertSemicolon()) node.label = null
138 node.label = this.parseIdent()
146 if (node.label == null || lab.name === node.label.name) {
148 if (node.label && isBreak) break
151 if (i === this.labels.length) this.raise(node.start, "Unsyntactic " + keyword)
152 return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
155 pp.parseDebuggerStatement = function(node) { argument
158 return this.finishNode(node, "DebuggerStatement")
161 pp.parseDoStatement = function(node) { argument
164 node.body = this.parseStatement(false)
167 node.test = this.parseParenExpression()
172 return this.finishNode(node, "DoWhileStatement")
183 pp.parseForStatement = function(node) { argument
187 if (this.type === tt.semi) return this.parseFor(node, null)
196 return this.parseForIn(node, init)
197 return this.parseFor(node, init)
205 return this.parseForIn(node, init)
209 return this.parseFor(node, init)
212 pp.parseFunctionStatement = function(node, isAsync) { argument
214 return this.parseFunction(node, true, false, isAsync)
221 pp.parseIfStatement = function(node) { argument
223 node.test = this.parseParenExpression()
225 node.consequent = this.parseStatement(!this.strict && this.isFunction())
226 …node.alternate = this.eat(tt._else) ? this.parseStatement(!this.strict && this.isFunction()) : null
227 return this.finishNode(node, "IfStatement")
230 pp.parseReturnStatement = function(node) { argument
239 if (this.eat(tt.semi) || this.insertSemicolon()) node.argument = null
240 else { node.argument = this.parseExpression(); this.semicolon() }
241 return this.finishNode(node, "ReturnStatement")
244 pp.parseSwitchStatement = function(node) { argument
246 node.discriminant = this.parseParenExpression()
247 node.cases = []
259 node.cases.push(cur = this.startNode())
278 return this.finishNode(node, "SwitchStatement")
281 pp.parseThrowStatement = function(node) { argument
285 node.argument = this.parseExpression()
287 return this.finishNode(node, "ThrowStatement")
294 pp.parseTryStatement = function(node) { argument
296 node.block = this.parseBlock()
297 node.handler = null
306 node.handler = this.finishNode(clause, "CatchClause")
308 node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null
309 if (!node.handler && !node.finalizer)
310 this.raise(node.start, "Missing catch or finally clause")
311 return this.finishNode(node, "TryStatement")
314 pp.parseVarStatement = function(node, kind) { argument
316 this.parseVar(node, false, kind)
318 return this.finishNode(node, "VariableDeclaration")
321 pp.parseWhileStatement = function(node) { argument
323 node.test = this.parseParenExpression()
325 node.body = this.parseStatement(false)
327 return this.finishNode(node, "WhileStatement")
330 pp.parseWithStatement = function(node) { argument
333 node.object = this.parseParenExpression()
334 node.body = this.parseStatement(false)
335 return this.finishNode(node, "WithStatement")
338 pp.parseEmptyStatement = function(node) { argument
340 return this.finishNode(node, "EmptyStatement")
343 pp.parseLabeledStatement = function(node, maybeName, expr) { argument
349 if (label.statementStart == node.start) {
355 node.body = this.parseStatement(true)
356 if (node.body.type == "ClassDeclaration" ||
357 node.body.type == "VariableDeclaration" && (this.strict || node.body.kind != "var") ||
358 node.body.type == "FunctionDeclaration" && (this.strict || node.body.generator))
359 this.raiseRecoverable(node.body.start, "Invalid labeled declaration")
361 node.label = expr
362 return this.finishNode(node, "LabeledStatement")
365 pp.parseExpressionStatement = function(node, expr) { argument
366 node.expression = expr
368 return this.finishNode(node, "ExpressionStatement")
376 let node = this.startNode()
377 node.body = []
381 node.body.push(stmt)
383 return this.finishNode(node, "BlockStatement")
390 pp.parseFor = function(node, init) { argument
391 node.init = init
393 node.test = this.type === tt.semi ? null : this.parseExpression()
395 node.update = this.type === tt.parenR ? null : this.parseExpression()
397 node.body = this.parseStatement(false)
399 return this.finishNode(node, "ForStatement")
405 pp.parseForIn = function(node, init) { argument
408 node.left = init
409 node.right = this.parseExpression()
411 node.body = this.parseStatement(false)
413 return this.finishNode(node, type)
418 pp.parseVar = function(node, isFor, kind) { argument
419 node.declarations = []
420 node.kind = kind
433 node.declarations.push(this.finishNode(decl, "VariableDeclarator"))
436 return node
447 pp.parseFunction = function(node, isStatement, allowExpressionBody, isAsync) { argument
448 this.initFunction(node)
450 node.generator = this.eat(tt.star)
452 node.async = !!isAsync
457 node.id = this.parseIdent()
461 this.inGenerator = node.generator
462 this.inAsync = node.async
468 node.id = this.parseIdent()
469 this.parseFunctionParams(node)
470 this.parseFunctionBody(node, allowExpressionBody)
477 return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
480 pp.parseFunctionParams = function(node) { argument
482 node.params = this.parseBindingList(tt.parenR, false, this.options.ecmaVersion >= 8, true)
489 pp.parseClass = function(node, isStatement) { argument
492 this.parseClassId(node, isStatement)
493 this.parseClassSuper(node)
551 node.body = this.finishNode(classBody, "ClassBody")
552 return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
560 pp.parseClassId = function(node, isStatement) { argument
561 node.id = this.type === tt.name ? this.parseIdent() : isStatement ? this.unexpected() : null
564 pp.parseClassSuper = function(node) { argument
565 node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null
570 pp.parseExport = function(node, exports) { argument
575 node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()
577 return this.finishNode(node, "ExportAllDeclaration")
586 node.declaration = this.parseFunction(fNode, null, false, isAsync)
589 node.declaration = this.parseClass(cNode, null)
591 node.declaration = this.parseMaybeAssign()
594 return this.finishNode(node, "ExportDefaultDeclaration")
598 node.declaration = this.parseStatement(true)
599 if (node.declaration.type === "VariableDeclaration")
600 this.checkVariableExport(exports, node.declaration.declarations)
602 this.checkExport(exports, node.declaration.id.name, node.declaration.id.start)
603 node.specifiers = []
604 node.source = null
606 node.declaration = null
607 node.specifiers = this.parseExportSpecifiers(exports)
609 node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()
612 for (let i = 0; i < node.specifiers.length; i++) {
613 …if (this.keywords.test(node.specifiers[i].local.name) || this.reservedWords.test(node.specifiers[i…
614 this.unexpected(node.specifiers[i].local.start)
618 node.source = null
622 return this.finishNode(node, "ExportNamedDeclaration")
677 let node = this.startNode()
678 node.local = this.parseIdent(true)
679 node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local
680 this.checkExport(exports, node.exported.name, node.exported.start)
681 nodes.push(this.finishNode(node, "ExportSpecifier"))
688 pp.parseImport = function(node) { argument
692 node.specifiers = empty
693 node.source = this.parseExprAtom()
695 node.specifiers = this.parseImportSpecifiers()
697 node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()
700 return this.finishNode(node, "ImportDeclaration")
709 let node = this.startNode()
710 node.local = this.parseIdent()
711 this.checkLVal(node.local, true)
712 nodes.push(this.finishNode(node, "ImportDefaultSpecifier"))
716 let node = this.startNode()
719 node.local = this.parseIdent()
720 this.checkLVal(node.local, true)
721 nodes.push(this.finishNode(node, "ImportNamespaceSpecifier"))
731 let node = this.startNode()
732 node.imported = this.parseIdent(true)
734 node.local = this.parseIdent()
736 node.local = node.imported
737 if (this.isKeyword(node.local.name)) this.unexpected(node.local.start)
738 …if (this.reservedWordsStrict.test(node.local.name)) this.raiseRecoverable(node.local.start, "The k…
740 this.checkLVal(node.local, true)
741 nodes.push(this.finishNode(node, "ImportSpecifier"))