ParseScript (§16.1.5) declares sourceText as ECMAScript source text,
which per §11.1 is a sequence of Unicode code points.
However, ParseText (§11.1.6), which ParseScript calls directly in step 1,
accepts sourceText as a String or a sequence of Unicode code points and
explicitly handles the String case via StringToCodePoints.
This means callers like the HTML spec can pass a String to ParseScript,
which works in practice but violates the declared type at the ParseScript level.
Suggestion: update ParseScript's parameter type to
a String or a sequence of Unicode code points to match ParseText's actual accepted input.
ParseScript(§16.1.5) declaressourceTextasECMAScript source text,which per §11.1 is a sequence of Unicode code points.
However,
ParseText(§11.1.6), whichParseScriptcalls directly in step 1,accepts
sourceTextas a String or a sequence of Unicode code points andexplicitly handles the String case via
StringToCodePoints.This means callers like the HTML spec can pass a String to
ParseScript,which works in practice but violates the declared type at the
ParseScriptlevel.Suggestion: update
ParseScript's parameter type toa String or a sequence of Unicode code pointsto matchParseText's actual accepted input.