@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
69 lines • 2.03 kB
TypeScript
/**
* @import { Word } from "@helios-lang/compiler-utils"
* @typedef {import("@helios-lang/ir").SourceMappedStringI} SourceMappedStringI
*/
/**
* Function argument class
*/
export class FuncArg extends NameTypePair {
/**
* @param {SourceMappedStringI} bodyIR
* @param {string} name
* @param {SourceMappedStringI} defaultIR
* @returns {SourceMappedStringI}
*/
static wrapWithDefaultInternal(bodyIR: SourceMappedStringI, name: string, defaultIR: SourceMappedStringI): SourceMappedStringI;
/**
* @param {Word} name
* @param {Expr | undefined} typeExpr
* @param {Expr | undefined} defaultValueExpr
*/
constructor(name: Word, typeExpr: Expr | undefined, defaultValueExpr?: Expr | undefined);
/**
* @private
* @readonly
* @type {Expr | undefined}
*/
private readonly _defaultValueExpr;
/**
* @type {boolean}
*/
get isOptional(): boolean;
/**
* @param {Scope} scope
*/
evalDefault(scope: Scope): void;
/**
* @param {Scope} scope
* @returns {ArgType}
*/
evalArgType(scope: Scope): ArgType;
/**
* (argName) -> {
* <bodyIR>
* }(
* ifThenElse(
* __useoptarg__argName,
* () -> {
* argName
* },
* () -> {
* <defaultValueExpr>
* }
* )()
* )
* TODO: indentation
* @param {ToIRContext} ctx
* @param {SourceMappedStringI} bodyIR
* @returns {SourceMappedStringI}
*/
wrapWithDefault(ctx: ToIRContext, bodyIR: SourceMappedStringI): SourceMappedStringI;
}
export type SourceMappedStringI = import("@helios-lang/ir").SourceMappedStringI;
import { NameTypePair } from "./NameTypePair.js";
import { Scope } from "../scopes/index.js";
import { ArgType } from "../typecheck/index.js";
import { ToIRContext } from "../codegen/ToIRContext.js";
import type { Word } from "@helios-lang/compiler-utils";
import { Expr } from "./Expr.js";
//# sourceMappingURL=FuncArg.d.ts.map