.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / table / node_modules / ajv / dist / compile / codegen / scope.d.ts
1 import { Code, Name } from "./code";
2 interface NameGroup {
3     prefix: string;
4     index: number;
5 }
6 export interface NameValue {
7     ref: ValueReference;
8     key?: unknown;
9     code?: Code;
10 }
11 export declare type ValueReference = unknown;
12 interface ScopeOptions {
13     prefixes?: Set<string>;
14     parent?: Scope;
15 }
16 interface ValueScopeOptions extends ScopeOptions {
17     scope: ScopeStore;
18     es5?: boolean;
19     lines?: boolean;
20 }
21 export declare type ScopeStore = Record<string, ValueReference[] | undefined>;
22 declare type ScopeValues = {
23     [Prefix in string]?: Map<unknown, ValueScopeName>;
24 };
25 export declare type ScopeValueSets = {
26     [Prefix in string]?: Set<ValueScopeName>;
27 };
28 export declare enum UsedValueState {
29     Started = 0,
30     Completed = 1
31 }
32 export declare type UsedScopeValues = {
33     [Prefix in string]?: Map<ValueScopeName, UsedValueState | undefined>;
34 };
35 export declare const varKinds: {
36     const: Name;
37     let: Name;
38     var: Name;
39 };
40 export declare class Scope {
41     protected readonly _names: {
42         [Prefix in string]?: NameGroup;
43     };
44     protected readonly _prefixes?: Set<string>;
45     protected readonly _parent?: Scope;
46     constructor({ prefixes, parent }?: ScopeOptions);
47     toName(nameOrPrefix: Name | string): Name;
48     name(prefix: string): Name;
49     protected _newName(prefix: string): string;
50     private _nameGroup;
51 }
52 interface ScopePath {
53     property: string;
54     itemIndex: number;
55 }
56 export declare class ValueScopeName extends Name {
57     readonly prefix: string;
58     value?: NameValue;
59     scopePath?: Code;
60     constructor(prefix: string, nameStr: string);
61     setValue(value: NameValue, { property, itemIndex }: ScopePath): void;
62 }
63 interface VSOptions extends ValueScopeOptions {
64     _n: Code;
65 }
66 export declare class ValueScope extends Scope {
67     protected readonly _values: ScopeValues;
68     protected readonly _scope: ScopeStore;
69     readonly opts: VSOptions;
70     constructor(opts: ValueScopeOptions);
71     get(): ScopeStore;
72     name(prefix: string): ValueScopeName;
73     value(nameOrPrefix: ValueScopeName | string, value: NameValue): ValueScopeName;
74     getValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined;
75     scopeRefs(scopeName: Name, values?: ScopeValues | ScopeValueSets): Code;
76     scopeCode(values?: ScopeValues | ScopeValueSets, usedValues?: UsedScopeValues, getCode?: (n: ValueScopeName) => Code | undefined): Code;
77     private _reduceValues;
78 }
79 export {};