Skip to content

Commit ec219d6

Browse files
committed
TypeScript naming style+
1 parent e1fedab commit ec219d6

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

scripts/lib/util.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,23 @@ export function flatten<T>(xss: Array<Array<T>>): Array<T> {
4747
for (let xs of xss) flat.push(...xs);
4848
return flat;
4949
}
50+
/** Preorder walk of dependency tree, circular dependencies is not allowed. */
5051
export function deepDependencies<T>(node: T, links: Links<T>): Array<T> {
5152
let dependencies: Array<T> = [...links(node)];
5253
if (is.empty(dependencies)) return []; //base:no-dependency
5354
else return flatten(dependencies.map(eDep => deepDependencies(eDep, links).concat(eDep)));
5455
}
5556
export function flatDependencies<T>(root: T, links: Links<T>): Array<T> {
56-
let bfsQueue: Array<T> = [...links(root)];
57+
let addWithDepTodo: Array<T> = [...links(root)]; //data:bfs-queue
5758
let dependencySet: Set<T> = new Set();
58-
while (is.notEmpty(bfsQueue)) {
59-
let someNode = bfsQueue.shift();
59+
while (is.notEmpty(addWithDepTodo)) {
60+
let someNode = addWithDepTodo.shift();
6061
if (dependencySet.has(someNode)) {
61-
continue; // skip cyclic deps like a-b
62+
continue; // skip circular deps like a-b
6263
} else {
6364
dependencySet.add(someNode);
6465
let itsDepencencies = links(someNode);
65-
bfsQueue.push(...itsDepencencies);
66+
addWithDepTodo.push(...itsDepencencies);
6667
}
6768
}
6869
return [...dependencySet.values()];

scripts/literate_kotlin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const literateKtConfig = {
2424
_for: (id:string) => ` for ${id.bold()}`,
2525
dependsOn: (deps: Array<string>) => ` depends on ${preetyShowList(deps.map(t => t.bold().italics()))}`,
2626
expectingFor: (what:any, that:any) => `Expecting ${what} for ${that}`,
27-
adjNounDesc: (adj:string, noun:string, desc:string) => `${adj} ${noun}${desc}`
27+
nounNounDesc: (noun0:string, noun1:string, desc:string) => `${noun0} ${noun1}${desc}`
2828
},
2929
dependencyOrdered: false
3030
};
@@ -71,7 +71,7 @@ function read<T>(p: Predicate<T>, s: Peek<T>) {
7171

7272
export function enableCodeFilter(begin_e: Element) {
7373
const { playgroundDefaults } = literateKtConfig;
74-
const { adjNounDesc } = literateKtConfig.texts;
74+
const { nounNounDesc: adjNounDesc } = literateKtConfig.texts;
7575
const { playgroundClass: playground, hiddenDependencyClass: hiddenDependency,
7676
KotlinPlaygroundGlobalId: KotlinPlayground } = literateKtMagics;
7777

0 commit comments

Comments
 (0)