Skip to content

Commit

Permalink
Track if had second pass consistency error so only report once (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy9 authored May 11, 2024
1 parent 6032334 commit b99ad68
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/server/beebasm-ts/lineparser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3601,10 +3601,13 @@ export class LineParser {
typeof value !== 'number' ||
value !== ObjectCode.Instance.GetPC()
) {
throw new AsmException.SyntaxError_SecondPassProblem(
this._line,
oldColumn,
)
if (!ObjectCode.Instance.HadSecondPassError) {
ObjectCode.Instance.HadSecondPassError = true
throw new AsmException.SyntaxError_SecondPassProblem(
this._line,
oldColumn,
)
}
}
SymbolTable.Instance.AddLabel(symbolName)
}
Expand Down
10 changes: 10 additions & 0 deletions src/server/beebasm-ts/objectcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class ObjectCode {
// After one consistency error, all subsequent code will probably be wrong, so just raise once
// or we'll get a lot of errors and potentially cause severe slowdown
private _hadConsistencyError = false
private _hadSecondPassError = false

private constructor() {
//SymbolTable.Instance.AddSymbol( "CPU", this._CPU );
Expand All @@ -62,6 +63,7 @@ export class ObjectCode {
this._aFlags.fill(0)
this._aMapChar.fill(0)
this._hadConsistencyError = false
this._hadSecondPassError = false
}

public GetCPU(): number {
Expand All @@ -81,6 +83,14 @@ export class ObjectCode {
this._PC = i
}

public get HadSecondPassError(): boolean {
return this._hadSecondPassError
}

public set HadSecondPassError(s: boolean) {
this._hadSecondPassError = s
}

public PutByte(b: number): void {
if (this._PC > 0xffff) {
throw new AsmException.AssembleError_OutOfMemory()
Expand Down

0 comments on commit b99ad68

Please sign in to comment.