1 | import type NameManager from "../NameManager";
|
2 | import type TokenProcessor from "../TokenProcessor";
|
3 | import Transformer from "./Transformer";
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | export default class OptionalChainingNullishTransformer extends Transformer {
|
14 | readonly tokens: TokenProcessor;
|
15 | readonly nameManager: NameManager;
|
16 | constructor(tokens: TokenProcessor, nameManager: NameManager);
|
17 | process(): boolean;
|
18 | /**
|
19 | * Determine if the current token is the last of its chain, so that we know whether it's eligible
|
20 | * to have a delete op inserted.
|
21 | *
|
22 | * We can do this by walking forward until we determine one way or another. Each
|
23 | * isOptionalChainStart token must be paired with exactly one isOptionalChainEnd token after it in
|
24 | * a nesting way, so we can track depth and walk to the end of the chain (the point where the
|
25 | * depth goes negative) and see if any other subscript token is after us in the chain.
|
26 | */
|
27 | isLastSubscriptInChain(): boolean;
|
28 | /**
|
29 | * Determine if we are the open-paren in an expression like super.a()?.b.
|
30 | *
|
31 | * We can do this by walking backward to find the previous subscript. If that subscript was
|
32 | * preceded by a super, then we must be the subscript after it, so if this is a call expression,
|
33 | * we'll need to attach the right context.
|
34 | */
|
35 | justSkippedSuper(): boolean;
|
36 | }
|