Lines Matching full:this

31   if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
40 if (this.options.ecmaVersion >= 6) {
42 if (propHash.proto) this.raiseRecoverable(key.start, "Redefinition of __proto__ property")
51 if ((this.strict || isGetSet) && other[kind] || !(isGetSet ^ other.init))
52 this.raiseRecoverable(key.start, "Redefinition of property")
79 let startPos = this.start, startLoc = this.startLoc
80 let expr = this.parseMaybeAssign(noIn, refDestructuringErrors)
81 if (this.type === tt.comma) {
82 let node = this.startNodeAt(startPos, startLoc)
84 …while (this.eat(tt.comma)) node.expressions.push(this.parseMaybeAssign(noIn, refDestructuringError…
85 return this.finishNode(node, "SequenceExpression")
90 // Parse an assignment expression. This includes applications of
94 if (this.inGenerator && this.isContextual("yield")) return this.parseYield()
105 let startPos = this.start, startLoc = this.startLoc
106 if (this.type == tt.parenL || this.type == tt.name)
107 this.potentialArrowAt = this.start
108 let left = this.parseMaybeConditional(noIn, refDestructuringErrors)
109 if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc)
110 if (this.type.isAssign) {
111 this.checkPatternErrors(refDestructuringErrors, true)
113 let node = this.startNodeAt(startPos, startLoc)
114 node.operator = this.value
115 node.left = this.type === tt.eq ? this.toAssignable(left) : left
117 this.checkLVal(left)
118 this.next()
119 node.right = this.parseMaybeAssign(noIn)
120 return this.finishNode(node, "AssignmentExpression")
122 if (ownDestructuringErrors) this.checkExpressionErrors(refDestructuringErrors, true)
131 let startPos = this.start, startLoc = this.startLoc
132 let expr = this.parseExprOps(noIn, refDestructuringErrors)
133 if (this.checkExpressionErrors(refDestructuringErrors)) return expr
134 if (this.eat(tt.question)) {
135 let node = this.startNodeAt(startPos, startLoc)
137 node.consequent = this.parseMaybeAssign()
138 this.expect(tt.colon)
139 node.alternate = this.parseMaybeAssign(noIn)
140 return this.finishNode(node, "ConditionalExpression")
148 let startPos = this.start, startLoc = this.startLoc
149 let expr = this.parseMaybeUnary(refDestructuringErrors, false)
150 if (this.checkExpressionErrors(refDestructuringErrors)) return expr
151 return this.parseExprOp(expr, startPos, startLoc, -1, noIn)
161 let prec = this.type.binop
162 if (prec != null && (!noIn || this.type !== tt._in)) {
164 let logical = this.type === tt.logicalOR || this.type === tt.logicalAND
165 let op = this.value
166 this.next()
167 let startPos = this.start, startLoc = this.startLoc
168 … let right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn)
169 let node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical)
170 return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)
177 let node = this.startNodeAt(startPos, startLoc)
181 return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression")
187 let startPos = this.start, startLoc = this.startLoc, expr
188 if (this.inAsync && this.isContextual("await")) {
189 expr = this.parseAwait(refDestructuringErrors)
191 } else if (this.type.prefix) {
192 let node = this.startNode(), update = this.type === tt.incDec
193 node.operator = this.value
195 this.next()
196 node.argument = this.parseMaybeUnary(null, true)
197 this.checkExpressionErrors(refDestructuringErrors, true)
198 if (update) this.checkLVal(node.argument)
199 else if (this.strict && node.operator === "delete" &&
201 this.raiseRecoverable(node.start, "Deleting local variable in strict mode")
203 expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression")
205 expr = this.parseExprSubscripts(refDestructuringErrors)
206 if (this.checkExpressionErrors(refDestructuringErrors)) return expr
207 while (this.type.postfix && !this.canInsertSemicolon()) {
208 let node = this.startNodeAt(startPos, startLoc)
209 node.operator = this.value
212 this.checkLVal(expr)
213 this.next()
214 expr = this.finishNode(node, "UpdateExpression")
218 if (!sawUnary && this.eat(tt.starstar))
219 … return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false)
227 let startPos = this.start, startLoc = this.startLoc
228 let expr = this.parseExprAtom(refDestructuringErrors)
229 …Subscripts = expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.l…
230 if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) return expr
231 let result = this.parseSubscripts(expr, startPos, startLoc)
240 …let maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name ===…
241 this.lastTokEnd == base.end && !this.canInsertSemicolon()
243 if ((computed = this.eat(tt.bracketL)) || this.eat(tt.dot)) {
244 let node = this.startNodeAt(startPos, startLoc)
246 node.property = computed ? this.parseExpression() : this.parseIdent(true)
248 if (computed) this.expect(tt.bracketR)
249 base = this.finishNode(node, "MemberExpression")
250 } else if (!noCalls && this.eat(tt.parenL)) {
251 …estructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awai…
252 this.yieldPos = 0
253 this.awaitPos = 0
254 …let exprList = this.parseExprList(tt.parenR, this.options.ecmaVersion >= 8, false, refDestructurin…
255 if (maybeAsyncArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {
256 this.checkPatternErrors(refDestructuringErrors, false)
257 this.checkYieldAwaitInDefaultParams()
258 this.yieldPos = oldYieldPos
259 this.awaitPos = oldAwaitPos
260 return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true)
262 this.checkExpressionErrors(refDestructuringErrors, true)
263 this.yieldPos = oldYieldPos || this.yieldPos
264 this.awaitPos = oldAwaitPos || this.awaitPos
265 let node = this.startNodeAt(startPos, startLoc)
268 base = this.finishNode(node, "CallExpression")
269 } else if (this.type === tt.backQuote) {
270 let node = this.startNodeAt(startPos, startLoc)
272 node.quasi = this.parseTemplate()
273 base = this.finishNode(node, "TaggedTemplateExpression")
286 let node, canBeArrow = this.potentialArrowAt == this.start
287 switch (this.type) {
289 if (!this.inFunction)
290 this.raise(this.start, "'super' outside of function or class")
293 let type = this.type === tt._this ? "ThisExpression" : "Super"
294 node = this.startNode()
295 this.next()
296 return this.finishNode(node, type)
299 let startPos = this.start, startLoc = this.startLoc
300 let id = this.parseIdent(this.type !== tt.name)
301 …if (this.options.ecmaVersion >= 8 && id.name === "async" && !this.canInsertSemicolon() && this.eat…
302 return this.parseFunction(this.startNodeAt(startPos, startLoc), false, false, true)
303 if (canBeArrow && !this.canInsertSemicolon()) {
304 if (this.eat(tt.arrow))
305 return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false)
306 if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === tt.name) {
307 id = this.parseIdent()
308 if (this.canInsertSemicolon() || !this.eat(tt.arrow))
309 this.unexpected()
310 return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true)
316 let value = this.value
317 node = this.parseLiteral(value.value)
322 return this.parseLiteral(this.value)
325 node = this.startNode()
326 node.value = this.type === tt._null ? null : this.type === tt._true
327 node.raw = this.type.keyword
328 this.next()
329 return this.finishNode(node, "Literal")
332 let start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow)
334 if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
342 node = this.startNode()
343 this.next()
344 node.elements = this.parseExprList(tt.bracketR, true, true, refDestructuringErrors)
345 return this.finishNode(node, "ArrayExpression")
348 return this.parseObj(false, refDestructuringErrors)
351 node = this.startNode()
352 this.next()
353 return this.parseFunction(node, false)
356 return this.parseClass(this.startNode(), false)
359 return this.parseNew()
362 return this.parseTemplate()
365 this.unexpected()
370 let node = this.startNode()
372 node.raw = this.input.slice(this.start, this.end)
373 this.next()
374 return this.finishNode(node, "Literal")
378 this.expect(tt.parenL)
379 let val = this.parseExpression()
380 this.expect(tt.parenR)
385 …let startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVe…
386 if (this.options.ecmaVersion >= 6) {
387 this.next()
389 let innerStartPos = this.start, innerStartLoc = this.startLoc
391 …estructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awai…
392 this.yieldPos = 0
393 this.awaitPos = 0
394 while (this.type !== tt.parenR) {
395 first ? first = false : this.expect(tt.comma)
396 if (allowTrailingComma && this.afterTrailingComma(tt.parenR, true)) {
399 } else if (this.type === tt.ellipsis) {
400 spreadStart = this.start
401 exprList.push(this.parseParenItem(this.parseRest()))
402 …if (this.type === tt.comma) this.raise(this.start, "Comma is not permitted after the rest element")
405 if (this.type === tt.parenL && !innerParenStart) {
406 innerParenStart = this.start
408 exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem))
411 let innerEndPos = this.start, innerEndLoc = this.startLoc
412 this.expect(tt.parenR)
414 if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {
415 this.checkPatternErrors(refDestructuringErrors, false)
416 this.checkYieldAwaitInDefaultParams()
417 if (innerParenStart) this.unexpected(innerParenStart)
418 this.yieldPos = oldYieldPos
419 this.awaitPos = oldAwaitPos
420 return this.parseParenArrowList(startPos, startLoc, exprList)
423 if (!exprList.length || lastIsComma) this.unexpected(this.lastTokStart)
424 if (spreadStart) this.unexpected(spreadStart)
425 this.checkExpressionErrors(refDestructuringErrors, true)
426 this.yieldPos = oldYieldPos || this.yieldPos
427 this.awaitPos = oldAwaitPos || this.awaitPos
430 val = this.startNodeAt(innerStartPos, innerStartLoc)
432 this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc)
437 val = this.parseParenExpression()
440 if (this.options.preserveParens) {
441 let par = this.startNodeAt(startPos, startLoc)
443 return this.finishNode(par, "ParenthesizedExpression")
454 return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList)
466 let node = this.startNode()
467 let meta = this.parseIdent(true)
468 if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) {
470 node.property = this.parseIdent(true)
472this.raiseRecoverable(node.property.start, "The only valid meta property for new is new.target")
473 if (!this.inFunction)
474 this.raiseRecoverable(node.start, "new.target can only be used in functions")
475 return this.finishNode(node, "MetaProperty")
477 let startPos = this.start, startLoc = this.startLoc
478 node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true)
479 …if (this.eat(tt.parenL)) node.arguments = this.parseExprList(tt.parenR, this.options.ecmaVersion >…
481 return this.finishNode(node, "NewExpression")
487 let elem = this.startNode()
489 raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, '\n'),
490 cooked: this.value
492 this.next()
493 elem.tail = this.type === tt.backQuote
494 return this.finishNode(elem, "TemplateElement")
498 let node = this.startNode()
499 this.next()
501 let curElt = this.parseTemplateElement()
504 this.expect(tt.dollarBraceL)
505 node.expressions.push(this.parseExpression())
506 this.expect(tt.braceR)
507 node.quasis.push(curElt = this.parseTemplateElement())
509 this.next()
510 return this.finishNode(node, "TemplateLiteral")
516 let node = this.startNode(), first = true, propHash = {}
518 this.next()
519 while (!this.eat(tt.braceR)) {
521 this.expect(tt.comma)
522 if (this.afterTrailingComma(tt.braceR)) break
525 let prop = this.startNode(), isGenerator, isAsync, startPos, startLoc
526 if (this.options.ecmaVersion >= 6) {
530 startPos = this.start
531 startLoc = this.startLoc
534 isGenerator = this.eat(tt.star)
536 this.parsePropertyName(prop)
537 if (!isPattern && this.options.ecmaVersion >= 8 && !isGenerator && !prop.computed &&
538 prop.key.type === "Identifier" && prop.key.name === "async" && this.type !== tt.parenL &&
539 this.type !== tt.colon && !this.canInsertSemicolon()) {
541 this.parsePropertyName(prop, refDestructuringErrors)
545this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructurin…
546 this.checkPropClash(prop, propHash)
547 node.properties.push(this.finishNode(prop, "Property"))
549 return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
553 if ((isGenerator || isAsync) && this.type === tt.colon)
554 this.unexpected()
556 if (this.eat(tt.colon)) {
557 …prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign…
559 } else if (this.options.ecmaVersion >= 6 && this.type === tt.parenL) {
560 if (isPattern) this.unexpected()
563 prop.value = this.parseMethod(isGenerator, isAsync)
564 } else if (this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
566 (this.type != tt.comma && this.type != tt.braceR)) {
567 if (isGenerator || isAsync || isPattern) this.unexpected()
569 this.parsePropertyName(prop)
570 prop.value = this.parseMethod(false)
575 this.raiseRecoverable(start, "getter should have no params")
577 this.raiseRecoverable(start, "setter should have exactly one param")
580 this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params")
582 } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
583 if (this.keywords.test(prop.key.name) ||
584 (this.strict ? this.reservedWordsStrict : this.reservedWords).test(prop.key.name) ||
585 (this.inGenerator && prop.key.name == "yield") ||
586 (this.inAsync && prop.key.name == "await"))
587this.raiseRecoverable(prop.key.start, "'" + prop.key.name + "' can not be used as shorthand proper…
590 prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)
591 } else if (this.type === tt.eq && refDestructuringErrors) {
593 refDestructuringErrors.shorthandAssign = this.start
594 prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)
599 } else this.unexpected()
603 if (this.options.ecmaVersion >= 6) {
604 if (this.eat(tt.bracketL)) {
606 prop.key = this.parseMaybeAssign()
607 this.expect(tt.bracketR)
613 …return prop.key = this.type === tt.num || this.type === tt.string ? this.parseExprAtom() : this.pa…
620 if (this.options.ecmaVersion >= 6) {
624 if (this.options.ecmaVersion >= 8)
631 let node = this.startNode(), oldInGen = this.inGenerator, oldInAsync = this.inAsync,
632 oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunction
634 this.initFunction(node)
635 if (this.options.ecmaVersion >= 6)
637 if (this.options.ecmaVersion >= 8)
640 this.inGenerator = node.generator
641 this.inAsync = node.async
642 this.yieldPos = 0
643 this.awaitPos = 0
644 this.inFunction = true
646 this.expect(tt.parenL)
647 node.params = this.parseBindingList(tt.parenR, false, this.options.ecmaVersion >= 8)
648 this.checkYieldAwaitInDefaultParams()
649 this.parseFunctionBody(node, false)
651 this.inGenerator = oldInGen
652 this.inAsync = oldInAsync
653 this.yieldPos = oldYieldPos
654 this.awaitPos = oldAwaitPos
655 this.inFunction = oldInFunc
656 return this.finishNode(node, "FunctionExpression")
662 let oldInGen = this.inGenerator, oldInAsync = this.inAsync,
663 oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunction
665 this.initFunction(node)
666 if (this.options.ecmaVersion >= 8)
669 this.inGenerator = false
670 this.inAsync = node.async
671 this.yieldPos = 0
672 this.awaitPos = 0
673 this.inFunction = true
675 node.params = this.toAssignableList(params, true)
676 this.parseFunctionBody(node, true)
678 this.inGenerator = oldInGen
679 this.inAsync = oldInAsync
680 this.yieldPos = oldYieldPos
681 this.awaitPos = oldAwaitPos
682 this.inFunction = oldInFunc
683 return this.finishNode(node, "ArrowFunctionExpression")
689 let isExpression = isArrowFunction && this.type !== tt.braceL
690 let oldStrict = this.strict, useStrict = false
693 node.body = this.parseMaybeAssign()
696 let nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params)
698 useStrict = this.strictDirective(this.end)
699 // If this is a strict mode function, verify that argument names
703this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple para…
707 let oldLabels = this.labels
708 this.labels = []
709 if (useStrict) this.strict = true
710 node.body = this.parseBlock(true)
712 this.labels = oldLabels
716 this.strict = true
718 this.checkLVal(node.id, true)
719 this.checkParams(node)
720 this.strict = oldStrict
721 } else if (isArrowFunction || !this.isSimpleParamList(node.params)) {
722 this.checkParams(node)
737 for (let i = 0; i < node.params.length; i++) this.checkLVal(node.params[i], true, nameHash)
748 while (!this.eat(close)) {
750 this.expect(tt.comma)
751 if (allowTrailingComma && this.afterTrailingComma(close)) break
755 if (allowEmpty && this.type === tt.comma)
757 else if (this.type === tt.ellipsis) {
758 elt = this.parseSpread(refDestructuringErrors)
759 … if (refDestructuringErrors && this.type === tt.comma && refDestructuringErrors.trailingComma < 0)
760 refDestructuringErrors.trailingComma = this.start
762 elt = this.parseMaybeAssign(false, refDestructuringErrors)
774 let node = this.startNode()
775 if (liberal && this.options.allowReserved == "never") liberal = false
776 if (this.type === tt.name) {
777 … if (!liberal && (this.strict ? this.reservedWordsStrict : this.reservedWords).test(this.value) &&
778 (this.options.ecmaVersion >= 6 ||
779 this.input.slice(this.start, this.end).indexOf("\\") == -1))
780 this.raiseRecoverable(this.start, "The keyword '" + this.value + "' is reserved")
781 if (this.inGenerator && this.value === "yield")
782 this.raiseRecoverable(this.start, "Can not use 'yield' as identifier inside a generator")
783 if (this.inAsync && this.value === "await")
784this.raiseRecoverable(this.start, "Can not use 'await' as identifier inside an async function")
785 node.name = this.value
786 } else if (liberal && this.type.keyword) {
787 node.name = this.type.keyword
789 this.unexpected()
791 this.next()
792 return this.finishNode(node, "Identifier")
798 if (!this.yieldPos) this.yieldPos = this.start
800 let node = this.startNode()
801 this.next()
802 …if (this.type == tt.semi || this.canInsertSemicolon() || (this.type != tt.star && !this.type.start…
806 node.delegate = this.eat(tt.star)
807 node.argument = this.parseMaybeAssign()
809 return this.finishNode(node, "YieldExpression")
813 if (!this.awaitPos) this.awaitPos = this.start
815 let node = this.startNode()
816 this.next()
817 node.argument = this.parseMaybeUnary(null, true)
818 return this.finishNode(node, "AwaitExpression")