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

Function walkArray

test/fixtures/snapshot/typescript.js:117801–117860  ·  view source on GitHub ↗
(nodes, parent)

Source from the content-addressed store, hash-verified

117799 }
117800 }
117801 function walkArray(nodes, parent) {
117802 if (parent.decorators === nodes && !options.experimentalDecorators) {
117803 diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning));
117804 }
117805 switch (parent.kind) {
117806 case 257 /* SyntaxKind.ClassDeclaration */:
117807 case 226 /* SyntaxKind.ClassExpression */:
117808 case 169 /* SyntaxKind.MethodDeclaration */:
117809 case 171 /* SyntaxKind.Constructor */:
117810 case 172 /* SyntaxKind.GetAccessor */:
117811 case 173 /* SyntaxKind.SetAccessor */:
117812 case 213 /* SyntaxKind.FunctionExpression */:
117813 case 256 /* SyntaxKind.FunctionDeclaration */:
117814 case 214 /* SyntaxKind.ArrowFunction */:
117815 // Check type parameters
117816 if (nodes === parent.typeParameters) {
117817 diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files));
117818 return "skip";
117819 }
117820 // falls through
117821 case 237 /* SyntaxKind.VariableStatement */:
117822 // Check modifiers
117823 if (nodes === parent.modifiers) {
117824 checkModifiers(parent.modifiers, parent.kind === 237 /* SyntaxKind.VariableStatement */);
117825 return "skip";
117826 }
117827 break;
117828 case 167 /* SyntaxKind.PropertyDeclaration */:
117829 // Check modifiers of property declaration
117830 if (nodes === parent.modifiers) {
117831 for (var _i = 0, _a = nodes; _i < _a.length; _i++) {
117832 var modifier = _a[_i];
117833 if (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */) {
117834 diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind)));
117835 }
117836 }
117837 return "skip";
117838 }
117839 break;
117840 case 164 /* SyntaxKind.Parameter */:
117841 // Check modifiers of parameter declaration
117842 if (nodes === parent.modifiers) {
117843 diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files));
117844 return "skip";
117845 }
117846 break;
117847 case 208 /* SyntaxKind.CallExpression */:
117848 case 209 /* SyntaxKind.NewExpression */:
117849 case 228 /* SyntaxKind.ExpressionWithTypeArguments */:
117850 case 279 /* SyntaxKind.JsxSelfClosingElement */:
117851 case 280 /* SyntaxKind.JsxOpeningElement */:
117852 case 210 /* SyntaxKind.TaggedTemplateExpression */:
117853 // Check type arguments
117854 if (nodes === parent.typeArguments) {
117855 diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files));
117856 return "skip";
117857 }
117858 break;

Callers

nothing calls this directly

Calls 4

createDiagnosticForNodeFunction · 0.85
checkModifiersFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected