@helios-lang/compiler
Version:
Helios is a Domain Specific Language that compiles to Plutus-Core (i.e. Cardano on-chain validator scripts). Helios is a non-Haskell alternative to Plutus. With this library you can compile Helios scripts and build Cardano transactions, all you need to bu
111 lines • 3.44 kB
TypeScript
/**
* @import { Word } from "@helios-lang/compiler-utils"
* @typedef {import("../typecheck/index.js").EvalEntity} EvalEntity
* @typedef {import("../typecheck/index.js").Named} Named
* @typedef {import("../typecheck/index.js").Namespace} Namespace
* @typedef {import("../typecheck/index.js").Type} Type
*/
/**
* User scope
* @implements {EvalEntity}
*/
export class Scope extends Common implements EvalEntity {
/**
* @param {GlobalScope | Scope} parent
* @param {boolean} allowShadowing
*/
constructor(parent: GlobalScope | Scope, allowShadowing?: boolean);
/**
* @private
* @readonly
* @type {GlobalScope | Scope}
*/
private readonly _parent;
/**
* TopScope can elverage the _values to store ModuleScopes
* @private
* @type {[Word, (EvalEntity | Scope), boolean][]}
*/
private _values;
/**
* @private
* @readonly
* @type {boolean}
*/
private readonly _allowShadowing;
/**
* @type {boolean}
*/
get allowShadowing(): boolean;
/**
* Used by top-scope to loop over all the statements
*/
get values(): [Word, import("../typecheck/common.js").EvalEntity | Scope, boolean][];
/**
* Checks if scope contains a name
* @param {Word} name
* @returns {boolean}
*/
has(name: Word): boolean;
/**
* Sets a named value. Throws an error if not unique
* @param {Word} name
* @param {EvalEntity | Scope} value
*/
setInternal(name: Word, value: EvalEntity | Scope, allowShadowing?: boolean): void;
/**
* Sets a named value. Throws an error if not unique
* @param {Word} name
* @param {EvalEntity | Scope} value
*/
set(name: Word, value: EvalEntity | Scope): void;
/**
* @param {Word} name
*/
remove(name: Word): void;
/**
* @param {Word} name
* @returns {null | Scope}
*/
getScope(name: Word): null | Scope;
/**
* @param {Word} name
* @returns {(Named & Namespace) | undefined}
*/
getBuiltinNamespace(name: Word): (Named & Namespace) | undefined;
/**
* Gets a named value from the scope. Throws an error if not found
* @param {Word | string} name
* @param {boolean} dryRun - if false -> don't set used flag
* @returns {EvalEntity | Scope}
*/
get(name: Word | string, dryRun?: boolean): EvalEntity | Scope;
/**
* @returns {boolean}
*/
isStrict(): boolean;
/**
* Asserts that all named values are used.
* Throws an error if some are unused, unless they start with "_"
* Check is only run if we are in strict mode
* @param {boolean} onlyIfStrict
*/
assertAllUsed(onlyIfStrict?: boolean): void;
/**
* @param {Word} name
* @returns {boolean}
*/
isUsed(name: Word): boolean;
/**
* @param {(name: string, type: Type) => void} callback
*/
loopTypes(callback: (name: string, type: Type) => void): void;
}
export type EvalEntity = import("../typecheck/index.js").EvalEntity;
export type Named = import("../typecheck/index.js").Named;
export type Namespace = import("../typecheck/index.js").Namespace;
export type Type = import("../typecheck/index.js").Type;
import { Common } from "../typecheck/index.js";
import type { Word } from "@helios-lang/compiler-utils";
import { GlobalScope } from "./GlobalScope.js";
//# sourceMappingURL=Scope.d.ts.map