* Visit one node of tag markup. `containerId` is the scope the node sits in * — the function whose body it is, else the component, else the file — and * owns whatever calls it makes. `declScope` is true outside function bodies * (component/interface/template scope), where a ` ` d
(node: SyntaxNode, parentType: string, containerId: string, parentClassName: string | undefined, declScope: boolean)
| 405 | * enough to tell the expression from the tag around it. |
| 406 | */ |
| 407 | private visitTag(node: SyntaxNode, parentType: string, containerId: string, parentClassName: string | undefined, declScope: boolean): void { |
| 408 | switch (node.type) { |
| 409 | case 'cf_script_tag': |
| 410 | this.delegateScriptTag(node, containerId, parentClassName); |
| 411 | return; |
| 412 | case 'cf_query_tag': |
| 413 | // The SQL body is opaque to this grammar; the walk below only reaches |
| 414 | // the tag's attributes (`datasource="#dsn()#"`), never the body twice. |
| 415 | this.delegateQueryTag(node, containerId); |
| 416 | break; |
| 417 | case 'cf_function_tag': |
| 418 | if (declScope) this.extractFunctionTag(node, parentClassName ? containerId : undefined, containerId, parentClassName); |
| 419 | return; |
| 420 | case 'cf_selfclose_tag': |
| 421 | // `<cfinclude template="…">`, wherever it is written (#2651). Its |
| 422 | // attributes are still walked below for `#hash#` expressions. |
| 423 | if (this.selfCloseTagName(node) === 'include') this.extractIncludeTag(node, containerId); |
| 424 | break; |
| 425 | case 'cf_tag': { |
| 426 | const name = this.cfTagName(node); |
| 427 | if (name === 'interface' && declScope && !parentClassName) { |
| 428 | this.extractInterfaceTag(node, containerId); |
| 429 | return; |
| 430 | } |
| 431 | // `<cfloop condition="hasNext()">` — the one common tag attribute whose |
| 432 | // plain-text value is a CFML expression rather than a literal. |
| 433 | if (name === 'loop') { |
| 434 | const condition = this.tagAttrValueNode(this.cfStartTag(node) ?? node, 'condition'); |
| 435 | if (condition) this.addTagExpression(condition, containerId); |
| 436 | } |
| 437 | break; |
| 438 | } |
| 439 | default: |
| 440 | if (TAG_EXPRESSION_PARENTS.has(parentType) && TAG_EXPRESSION_TYPES.has(node.type)) { |
| 441 | this.addTagExpression(node, containerId); |
| 442 | return; |
| 443 | } |
| 444 | } |
| 445 | this.delegateNestedTags(node, containerId, parentClassName, declScope && node.type !== 'ERROR'); |
| 446 | } |
| 447 | |
| 448 | /** |
| 449 | * Visit `node`'s children (see visitTag) — e.g. a `<cfscript>`/`<cfquery>` |
no test coverage detected