Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed try/catch #123

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 24 additions & 30 deletions src/program/Program.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,40 +314,34 @@ export class Program {
optimize: optimize
})

try {
const alt = withAlt ? this.compile({ optimize: false }) : undefined
// todo: re-use the IR from alt version to shorten the IR compilation for optimized version (~0.5 seconds in one sample)
// todo: or can we re-use some intermediate result within the IR-compilation process, to reduce overhead even further?

const uplc = compileIR(ir, {
optimize: optimize,
alt: alt,
parseOptions: IR_PARSE_OPTIONS,
optimizeOptions:
options.optimize && typeof options.optimize != "boolean"
? options.optimize
: undefined
})

// userfuncs might depend on own hash, which is easer to inject after compilation of main program
if (options.onCompileUserFunc) {
if (options.optimize) {
hashDependencies[this.name] = bytesToHex(uplc.hash())
}
const alt = withAlt ? this.compile({ optimize: false }) : undefined
// todo: re-use the IR from alt version to shorten the IR compilation for optimized version (~0.5 seconds in one sample)
// todo: or can we re-use some intermediate result within the IR-compilation process, to reduce overhead even further?

const uplc = compileIR(ir, {
optimize: optimize,
alt: alt,
parseOptions: IR_PARSE_OPTIONS,
optimizeOptions:
options.optimize && typeof options.optimize != "boolean"
? options.optimize
: undefined
})

this.compileUserFuncs(options.onCompileUserFunc, {
excludeUserFuncs: options.excludeUserFuncs ?? new Set(),
hashDependencies: hashDependencies,
validatorIndices: options.validatorIndices
})
// userfuncs might depend on own hash, which is easer to inject after compilation of main program
if (options.onCompileUserFunc) {
if (options.optimize) {
hashDependencies[this.name] = bytesToHex(uplc.hash())
}

return uplc
} catch (e) {
debugger
console.error("Error compiling program", e)
throw e
this.compileUserFuncs(options.onCompileUserFunc, {
excludeUserFuncs: options.excludeUserFuncs ?? new Set(),
hashDependencies: hashDependencies,
validatorIndices: options.validatorIndices
})
}

return uplc
}

/**
Expand Down
Loading