diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index ee8c44123f..68efd7f763 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -24,7 +24,7 @@ import unwrap_parens from './utils/unwrap_parens'; import Slot from './nodes/Slot'; import { Node as ESTreeNode } from 'estree'; import add_to_set from './utils/add_to_set'; -import checkGraphForCycles from './utils/checkGraphForCycles'; +import check_graph_for_cycles from './utils/check_graph_for_cycles'; interface ComponentOptions { namespace?: string; @@ -1206,7 +1206,7 @@ export default class Component { }); }); - const cycle = checkGraphForCycles(unsorted_reactive_declarations.reduce((acc, declaration) => { + const cycle = check_graph_for_cycles(unsorted_reactive_declarations.reduce((acc, declaration) => { declaration.assignees.forEach(v => { declaration.dependencies.forEach(w => { if (!declaration.assignees.has(w)) { diff --git a/src/compiler/compile/utils/checkGraphForCycles.ts b/src/compiler/compile/utils/check_graph_for_cycles.ts similarity index 67% rename from src/compiler/compile/utils/checkGraphForCycles.ts rename to src/compiler/compile/utils/check_graph_for_cycles.ts index 718d2e2665..7606e3214d 100644 --- a/src/compiler/compile/utils/checkGraphForCycles.ts +++ b/src/compiler/compile/utils/check_graph_for_cycles.ts @@ -1,4 +1,4 @@ -export default function checkGraphForCycles(edges: Array<[any, any]>): any[] { +export default function check_graph_for_cycles(edges: Array<[any, any]>): any[] { const graph: Map = edges.reduce((g, edge) => { const [u, v] = edge; if (!g.has(u)) g.set(u, []); @@ -8,22 +8,22 @@ export default function checkGraphForCycles(edges: Array<[any, any]>): any[] { }, new Map()); const visited = new Set(); - const onStack = new Set(); + const on_stack = new Set(); const cycles = []; function visit (v) { visited.add(v); - onStack.add(v); + on_stack.add(v); graph.get(v).forEach(w => { if (!visited.has(w)) { visit(w); - } else if (onStack.has(w)) { - cycles.push([...onStack, w]); + } else if (on_stack.has(w)) { + cycles.push([...on_stack, w]); } }); - onStack.delete(v); + on_stack.delete(v); } graph.forEach((_, v) => {