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

Function checkGrammarBindingElement

test/fixtures/snapshot/typescript.js:88722–88737  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

88720 }
88721 }
88722 function checkGrammarBindingElement(node) {
88723 if (node.dotDotDotToken) {
88724 var elements = node.parent.elements;
88725 if (node !== ts.last(elements)) {
88726 return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
88727 }
88728 checkGrammarForDisallowedTrailingComma(elements, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
88729 if (node.propertyName) {
88730 return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_have_a_property_name);
88731 }
88732 }
88733 if (node.dotDotDotToken && node.initializer) {
88734 // Error on equals token which immediately precedes the initializer
88735 return grammarErrorAtPos(node, node.initializer.pos - 1, 1, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);
88736 }
88737 }
88738 function isStringOrNumberLiteralExpression(expr) {
88739 return ts.isStringOrNumericLiteralLike(expr) ||
88740 expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ &&

Callers 1

checkBindingElementFunction · 0.85

Calls 4

grammarErrorOnNodeFunction · 0.85
grammarErrorAtPosFunction · 0.85
lastMethod · 0.45

Tested by

no test coverage detected