in this house we use snake_case

pull/3527/head
Richard Harris 5 years ago
parent 0f80ea7aea
commit e797cfc7b9

@ -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)) {

@ -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<any, any[]> = 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) => {
Loading…
Cancel
Save