-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
74 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,44 @@ | ||
import { SimpleParserRuleContext } from "../../types/core"; | ||
|
||
import { SpinnerProcessor } from "../../reporter"; | ||
import { BaseReporter } from "../../reporter/reporters/BaseReporter"; | ||
|
||
export class WarningsReporter extends BaseReporter { | ||
public reportUnsupportedExpression(contextText: string) { | ||
public warnings: Set<string> = new Set(); | ||
|
||
constructor(quiet: boolean) { | ||
super(quiet); | ||
|
||
this.warnings = new Set(); | ||
} | ||
|
||
public reportUnsupportedExpression(templateName: string, context: SimpleParserRuleContext) { | ||
if (this.isQuiet()) return; | ||
|
||
console.warn( | ||
`Expression structure: ${contextText} not supported if used to determine the dimension of an input signal!`, | ||
this.warnings.add( | ||
`Inside the ${templateName} circuit (${context.start.line}:${context.start.column})\r | ||
\rThe expression structure: ${context.getText()} not supported if used to determine the dimension of an input signal!`, | ||
); | ||
} | ||
|
||
public reportAllWarnings(spinnerId: string | null) { | ||
if (this.isQuiet() || !spinnerId) return; | ||
|
||
const resolvingTimeMessage: string = this._getSpinnerWorkingTimeMessage( | ||
SpinnerProcessor!.getWorkingTime(spinnerId), | ||
); | ||
|
||
SpinnerProcessor!.warnSpinner( | ||
spinnerId, | ||
`Circuits are ready for the compilation ${resolvingTimeMessage}. But the analysis ended with warnings:`, | ||
); | ||
|
||
for (const warning of this.warnings) { | ||
console.warn(warning); | ||
} | ||
} | ||
|
||
public hasWarnings(): boolean { | ||
return this.warnings.size > 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters