source: trip-planner-front/node_modules/ajv/dist/compile/codegen/scope.d.ts@ 1ad8e64

Last change on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.4 KB
Line 
1import { Code, Name } from "./code";
2interface NameGroup {
3 prefix: string;
4 index: number;
5}
6export interface NameValue {
7 ref: ValueReference;
8 key?: unknown;
9 code?: Code;
10}
11export declare type ValueReference = unknown;
12interface ScopeOptions {
13 prefixes?: Set<string>;
14 parent?: Scope;
15}
16interface ValueScopeOptions extends ScopeOptions {
17 scope: ScopeStore;
18 es5?: boolean;
19 lines?: boolean;
20}
21export declare type ScopeStore = Record<string, ValueReference[] | undefined>;
22declare type ScopeValues = {
23 [Prefix in string]?: Map<unknown, ValueScopeName>;
24};
25export declare type ScopeValueSets = {
26 [Prefix in string]?: Set<ValueScopeName>;
27};
28export declare enum UsedValueState {
29 Started = 0,
30 Completed = 1
31}
32export declare type UsedScopeValues = {
33 [Prefix in string]?: Map<ValueScopeName, UsedValueState | undefined>;
34};
35export declare const varKinds: {
36 const: Name;
37 let: Name;
38 var: Name;
39};
40export 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}
52interface ScopePath {
53 property: string;
54 itemIndex: number;
55}
56export 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}
63interface VSOptions extends ValueScopeOptions {
64 _n: Code;
65}
66export 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}
79export {};
Note: See TracBrowser for help on using the repository browser.