Skip to content

Commit

Permalink
fix: improve internal error message for pc mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-p committed Oct 23, 2024
1 parent a796179 commit bd92778
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7613,6 +7613,16 @@ declare type AssetFreezeTxn = Required<AssetFreezeParams>;
this.sourceInfo.forEach((sm) => {
if (this.hasDynamicTemplateVar) {
if (sm.teal - 1 <= lastCblockLine) return;
const pcs = this.lineToPc[sm.teal - 1];

if (pcs === undefined) {
throw new Error(
`Internal Compiler Error: PC values not found when trying to calculate cblock offsets for TEAL line ${
sm.teal
} (${this.teal[program][sm.teal - 1].teal}). Last cblock line was ${lastCblockLine}.`
);
}

// eslint-disable-next-line no-param-reassign
sm.pc = this.lineToPc[sm.teal - 1].map((pc) => pc - lastCblockPc);
return;
Expand Down

0 comments on commit bd92778

Please sign in to comment.