MCPcopy Create free account
hub / github.com/nodejs/node / checkGrammarJsxElement

Function checkGrammarJsxElement

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

Source from the content-addressed store, hash-verified

88379 }
88380 }
88381 function checkGrammarJsxElement(node) {
88382 checkGrammarJsxName(node.tagName);
88383 checkGrammarTypeArguments(node, node.typeArguments);
88384 var seen = new ts.Map();
88385 for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) {
88386 var attr = _a[_i];
88387 if (attr.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) {
88388 continue;
88389 }
88390 var name = attr.name, initializer = attr.initializer;
88391 if (!seen.get(name.escapedText)) {
88392 seen.set(name.escapedText, true);
88393 }
88394 else {
88395 return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
88396 }
88397 if (initializer && initializer.kind === 288 /* SyntaxKind.JsxExpression */ && !initializer.expression) {
88398 return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression);
88399 }
88400 }
88401 }
88402 function checkGrammarJsxName(node) {
88403 if (ts.isPropertyAccessExpression(node)) {
88404 var propName = node;

Calls 5

checkGrammarJsxNameFunction · 0.85
grammarErrorOnNodeFunction · 0.85
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected