|
|
|
@ -6,19 +6,12 @@ import { is_reserved_keyword } from '../../utils/reserved_keywords.js';
|
|
|
|
* @param {string} name
|
|
|
|
* @param {string} name
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export default function is_contextual(component, scope, name) {
|
|
|
|
export default function is_contextual(component, scope, name) {
|
|
|
|
if (is_reserved_keyword(name))
|
|
|
|
if (is_reserved_keyword(name)) return true;
|
|
|
|
return true;
|
|
|
|
// if it's a name below root scope, it's contextual
|
|
|
|
// if it's a name below root scope, it's contextual
|
|
|
|
if (!scope.is_top_level(name)) return true;
|
|
|
|
if (!scope.is_top_level(name))
|
|
|
|
const variable = component.var_lookup.get(name);
|
|
|
|
return true;
|
|
|
|
// hoistables, module declarations, and imports are non-contextual
|
|
|
|
const variable = component.var_lookup.get(name);
|
|
|
|
if (!variable || variable.hoistable) return false;
|
|
|
|
// hoistables, module declarations, and imports are non-contextual
|
|
|
|
// assume contextual
|
|
|
|
if (!variable || variable.hoistable)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// assume contextual
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|