rename variables to use snake_case

pull/7716/head
Ivan Hofer 4 years ago committed by tanhauhau
parent 7af638d971
commit d84f3153cb

@ -48,8 +48,8 @@ interface ComponentOptions {
}
const regex_leading_directory_separator = /^[/\\]/;
const regex_starts_with_Export = /^Export/;
const regex_contains_Function = /Function/;
const regex_starts_with_term_export = /^Export/;
const regex_contains_term_function = /Function/;
export default class Component {
stats: Stats;
@ -642,7 +642,7 @@ export default class Component {
body.splice(i, 1);
}
if (regex_starts_with_Export.test(node.type)) {
if (regex_starts_with_term_export.test(node.type)) {
const replacement = this.extract_exports(node, true);
if (replacement) {
body[i] = replacement;
@ -799,7 +799,7 @@ export default class Component {
return this.skip();
}
if (regex_starts_with_Export.test(node.type)) {
if (regex_starts_with_term_export.test(node.type)) {
const replacement = component.extract_exports(node);
if (replacement) {
this.replace(replacement);
@ -922,7 +922,7 @@ export default class Component {
}
if (name[1] !== '$' && scope.has(name.slice(1)) && scope.find_owner(name.slice(1)) !== this.instance_scope) {
if (!((regex_contains_Function.test(parent.type) && prop === 'params') || (parent.type === 'VariableDeclarator' && prop === 'id'))) {
if (!((regex_contains_term_function.test(parent.type) && prop === 'params') || (parent.type === 'VariableDeclarator' && prop === 'id'))) {
return this.error(node as any, compiler_errors.contextual_store);
}
}
@ -969,7 +969,7 @@ export default class Component {
walk(this.ast.instance.content, {
enter(node: Node) {
if (regex_contains_Function.test(node.type)) {
if (regex_contains_term_function.test(node.type)) {
return this.skip();
}

@ -6,7 +6,7 @@ import { Identifier } from 'estree';
import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces';
const regex_contains_FunctionExpression = /FunctionExpression/;
const regex_contains_term_function_expression = /FunctionExpression/;
export default class EventHandler extends Node {
type: 'EventHandler';
@ -27,7 +27,7 @@ export default class EventHandler extends Node {
this.expression = new Expression(component, this, template_scope, info.expression);
this.uses_context = this.expression.uses_context;
if (regex_contains_FunctionExpression.test(info.expression.type) && info.expression.params.length === 0) {
if (regex_contains_term_function_expression.test(info.expression.type) && info.expression.params.length === 0) {
// TODO make this detection more accurate — if `event.preventDefault` isn't called, and
// `event` is passed to another function, we can make it passive
this.can_make_passive = true;
@ -57,7 +57,7 @@ export default class EventHandler extends Node {
}
const node = this.expression.node;
if (regex_contains_FunctionExpression.test(node.type)) {
if (regex_contains_term_function_expression.test(node.type)) {
return false;
}

@ -21,7 +21,7 @@ import compiler_errors from '../../compiler_errors';
type Owner = INode;
const regex_contains_FunctionExpression = /FunctionExpression/;
const regex_contains_term_function_expression = /FunctionExpression/;
export default class Expression {
type: 'Expression' = 'Expression';
@ -74,7 +74,7 @@ export default class Expression {
scope = map.get(node);
}
if (!function_expression && regex_contains_FunctionExpression.test(node.type)) {
if (!function_expression && regex_contains_term_function_expression.test(node.type)) {
function_expression = node;
}

Loading…
Cancel
Save