Lint and format src/compiler/compile/nodes/shared/is_contextual.js

pull/8569/head
Simon Holthausen 3 years ago
parent cf15a8ec39
commit 67b7e9d27f

@ -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;
} }

Loading…
Cancel
Save