style(compiler): reformat of codebase with new clang-format version (#36520)
This commit reformats the packages/compiler tree using the new version of clang-format. PR Close #36520
This commit is contained in:
@ -26,23 +26,35 @@
|
||||
export class AstPath<T> {
|
||||
constructor(private path: T[], public position: number = -1) {}
|
||||
|
||||
get empty(): boolean { return !this.path || !this.path.length; }
|
||||
get head(): T|undefined { return this.path[0]; }
|
||||
get tail(): T|undefined { return this.path[this.path.length - 1]; }
|
||||
get empty(): boolean {
|
||||
return !this.path || !this.path.length;
|
||||
}
|
||||
get head(): T|undefined {
|
||||
return this.path[0];
|
||||
}
|
||||
get tail(): T|undefined {
|
||||
return this.path[this.path.length - 1];
|
||||
}
|
||||
|
||||
parentOf(node: T|undefined): T|undefined {
|
||||
return node && this.path[this.path.indexOf(node) - 1];
|
||||
}
|
||||
childOf(node: T): T|undefined { return this.path[this.path.indexOf(node) + 1]; }
|
||||
childOf(node: T): T|undefined {
|
||||
return this.path[this.path.indexOf(node) + 1];
|
||||
}
|
||||
|
||||
first<N extends T>(ctor: {new (...args: any[]): N}): N|undefined {
|
||||
first<N extends T>(ctor: {new(...args: any[]): N}): N|undefined {
|
||||
for (let i = this.path.length - 1; i >= 0; i--) {
|
||||
let item = this.path[i];
|
||||
if (item instanceof ctor) return <N>item;
|
||||
}
|
||||
}
|
||||
|
||||
push(node: T) { this.path.push(node); }
|
||||
push(node: T) {
|
||||
this.path.push(node);
|
||||
}
|
||||
|
||||
pop(): T { return this.path.pop() !; }
|
||||
pop(): T {
|
||||
return this.path.pop()!;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user