UNPKG

@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

50 lines (44 loc) 1.08 kB
import { $ } from "@helios-lang/ir" import { ToIRContext } from "../codegen/index.js" import { Scope } from "../scopes/index.js" import { VoidEntity } from "../typecheck/index.js" import { Expr } from "./Expr.js" /** * @import { Site } from "@helios-lang/compiler-utils" * @import { SourceMappedStringI } from "@helios-lang/ir" * @import { TypeCheckContext } from "../index.js" * @typedef {import("../typecheck/index.js").Instance} Instance */ /** * Helios equivalent of unit * TODO: inherit from ParensExpr (with empty fields) */ export class VoidExpr extends Expr { /** * @param {Site} site */ constructor(site) { super(site) } /** * @param {TypeCheckContext} _ctx * @param {Scope} _scope * @returns {Instance} */ evalInternal(_ctx, _scope) { return new VoidEntity() } /** * @param {ToIRContext} ctx * @returns {SourceMappedStringI} */ toIR(ctx) { return $("()", this.site) } /** * @returns {string} */ toString() { return "()" } }