diff --git a/packages/translator/src/core/condition/if.ts b/packages/translator/src/core/condition/if.ts index 23470a988..33d025739 100644 --- a/packages/translator/src/core/condition/if.ts +++ b/packages/translator/src/core/condition/if.ts @@ -14,10 +14,18 @@ import { compareReserves, } from "../../util/sections"; import { isOutputDOM } from "../../util/marko-config"; +import analyzeAttributeTags from "../../util/nested-attribute-tags"; +import customTag from "../../visitors/tag/custom-tag"; export default { - analyze(tag) { - reserveScope(ReserveType.Visit, getSection(tag), tag.node, "if", 3); + analyze: { + enter(tag) { + reserveScope(ReserveType.Visit, getSection(tag), tag.node, "if", 3); + customTag.analyze.enter(tag); + }, + exit(tag) { + analyzeAttributeTags(tag); + }, }, translate: { enter(tag) { diff --git a/packages/translator/src/core/for.ts b/packages/translator/src/core/for.ts index b353b5df8..967e6d79b 100644 --- a/packages/translator/src/core/for.ts +++ b/packages/translator/src/core/for.ts @@ -5,10 +5,18 @@ import * as writer from "../util/writer"; import * as walks from "../util/walks"; import { ReserveType, reserveScope, getSection } from "../util/sections"; import { callRuntime } from "../util/runtime"; +import analyzeAttributeTags from "../util/nested-attribute-tags"; +import customTag from "../visitors/tag/custom-tag"; export default { - analyze(tag) { - reserveScope(ReserveType.Visit, getSection(tag), tag.node, "for", 3); + analyze: { + enter(tag) { + reserveScope(ReserveType.Visit, getSection(tag), tag.node, "for", 3); + customTag.analyze.enter(tag); + }, + exit(tag) { + analyzeAttributeTags(tag); + }, }, translate: { enter(tag) { diff --git a/packages/translator/src/core/html-comment.ts b/packages/translator/src/core/html-comment.ts index 78b002a99..aa95918a8 100644 --- a/packages/translator/src/core/html-comment.ts +++ b/packages/translator/src/core/html-comment.ts @@ -9,6 +9,9 @@ import * as writer from "../util/writer"; import * as walks from "../util/walks"; export default { + analyze() { + // skip default custom tag analysis + }, translate: { enter(tag) { walks.enter(tag); diff --git a/packages/translator/src/visitors/tag/index.ts b/packages/translator/src/visitors/tag/index.ts index 725031d65..64825f6d2 100644 --- a/packages/translator/src/visitors/tag/index.ts +++ b/packages/translator/src/visitors/tag/index.ts @@ -22,6 +22,7 @@ export default { if (hook) { hooks.enter(hook, tag); + return; } switch (analyzeTagNameType(tag)) { @@ -46,6 +47,7 @@ export default { if (hook) { hooks.exit(hook, tag); + return; } if (type === TagNameTypes.NativeTag) {