archives

« Bugzilla Issues Index

#4383 — Static Semantics Contains missing base cases


The base case for Contains is whether the parameter symbol matches the production being considered. Many static semantics (Arrow Functions, Generator Function Decls/Exprs, Func Decls/Exprs, etc) are missing this base case. It may not be a bug if no one ever calls Contains with a parameter of these productions but could probably be fixed for completeness's sake.


(In reply to Brian Terlson from comment #0)
> The base case for Contains is whether the parameter symbol matches the
> production being considered. Many static semantics (Arrow Functions,
> Generator Function Decls/Exprs, Func Decls/Exprs, etc) are missing this base
> case.

On the contrary, sections 14.1.4, 14.2.3, and 14.4.4 *do* cover such cases. However, they do so by returning false, which, while perhaps unintuitive, is not incomplete.

> It may not be a bug if no one ever calls Contains with a parameter of
> these productions but could probably be fixed for completeness's sake.

Indeed, I believe the right-hand argument to Contains is only ever:
SuperProperty
SuperCall
super
NewTarget or
ScriptBody
so how Contains would behave if it were passed any other symbol is (currently) irrelevant from a normative standpoint.