Skip to content

telling whether a decl comes before a scope

icefapper edited this page Mar 10, 2017 · 1 revision

the declaration is always lexical (or lexical-like, like catch/function arguments), and the scope we are going to compare the declaration against is always a descendant of the declaration itself. if the latter does not hold, the declaration is not accessible from withing the scope in the first place, and a comparison is meaningless. * now if the declaration has not yet been reached, scope is before the declaration (scope < decl), * otherwise, * if it is hoisted, the scope is not before it (scope >= decl); otherwise, * if the scope is hoisted, it will be before the target declaration (scope < decl); otherwise, * the scope is not before it; it is strictly after it (scope > decl)

Clone this wiki locally