Project

General

Profile

1
/**
2
 * @license
3
 * Copyright Google Inc. All Rights Reserved.
4
 *
5
 * Use of this source code is governed by an MIT-style license that can be
6
 * found in the LICENSE file at https://angular.io/license
7
 */
8
/**
9
 * A path is an ordered set of elements. Typically a path is to  a
10
 * particular offset in a source file. The head of the list is the top
11
 * most node. The tail is the node that contains the offset directly.
12
 *
13
 * For example, the expresion `a + b + c` might have an ast that looks
14
 * like:
15
 *     +
16
 *    / \
17
 *   a   +
18
 *      / \
19
 *     b   c
20
 *
21
 * The path to the node at offset 9 would be `['+' at 1-10, '+' at 7-10,
22
 * 'c' at 9-10]` and the path the node at offset 1 would be
23
 * `['+' at 1-10, 'a' at 1-2]`.
24
 */
25
export declare class AstPath<T> {
26
    private path;
27
    position: number;
28
    constructor(path: T[], position?: number);
29
    readonly empty: boolean;
30
    readonly head: T | undefined;
31
    readonly tail: T | undefined;
32
    parentOf(node: T | undefined): T | undefined;
33
    childOf(node: T): T | undefined;
34
    first<N extends T>(ctor: {
35
        new (...args: any[]): N;
36
    }): N | undefined;
37
    push(node: T): void;
38
    pop(): T;
39
}
(3-3/54)