diff --git a/src/Meta.ts b/src/Meta.ts index b9d59246..6184683d 100644 --- a/src/Meta.ts +++ b/src/Meta.ts @@ -3,10 +3,25 @@ import type { Context } from './Context'; import Builder from './Builder'; +import { validateEffects } from './utils'; + export default class Meta extends Builder { static elements = ['EMU-META']; - static async enter({ spec, node }: Context) { + static async enter({ spec, node, clauseStack }: Context) { + const parent = clauseStack[clauseStack.length - 1] || null; + if (node.hasAttribute('effects') && parent !== null) { + const effects = validateEffects(spec, node.getAttribute('effects')!.split(',').map(c => c.trim()), node); + for (const effect of effects) { + if (!parent.effects.includes(effect)) { + parent.effects.push(effect); + if (!spec._effectWorklist.has(effect)) { + spec._effectWorklist.set(effect, []); + } + spec._effectWorklist.get(effect)!.push(parent); + } + } + } spec._emuMetasToRender.add(node); } diff --git a/test/baselines/generated-reference/effect-user-code.html b/test/baselines/generated-reference/effect-user-code.html index 4a3c2242..23d5b626 100644 --- a/test/baselines/generated-reference/effect-user-code.html +++ b/test/baselines/generated-reference/effect-user-code.html @@ -4,7 +4,7 @@

1 UserCode ( )

The abstract operation UserCode takes no arguments. It performs the following steps when called:

-
  1. Call user code.
+
  1. Call user code.
diff --git a/test/baselines/sources/effect-user-code.html b/test/baselines/sources/effect-user-code.html index 32123a12..7610d2d7 100644 --- a/test/baselines/sources/effect-user-code.html +++ b/test/baselines/sources/effect-user-code.html @@ -7,11 +7,9 @@

UserCode ( )

-
effects
-
user-code
- 1. Call user code. + 1. Call user code.