-
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.
Add logic to ignore unsupported contexts (#44)
* Added logic to ignore unsupported contexts * Fixed typo * Improved message structure * Fixed typo * Fixed typo * Simplified logic * Added comment * Resolved imports * Updated versions * Fixed typos * Deleted colon
- Loading branch information
Showing
9 changed files
with
108 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { SpinnerProcessor } from "../../reporter"; | ||
import { BaseReporter } from "../../reporter/reporters/BaseReporter"; | ||
|
||
import { SimpleParserRuleContext } from "../../types/core"; | ||
|
||
export class WarningsReporter extends BaseReporter { | ||
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; | ||
|
||
this.warnings.add( | ||
`\nInside the ${templateName} circuit (${context.start.line}:${context.start.column}) | ||
\rExpression structure "${context.getText()}" is not supported if used to determine the dimension of an input signal!`, | ||
); | ||
} | ||
|
||
public reportAllWarnings(spinnerId: string | null) { | ||
if (this.isQuiet() || !spinnerId || !this.hasWarnings()) return; | ||
|
||
const resolvingTimeMessage: string = this._getSpinnerWorkingTimeMessage( | ||
SpinnerProcessor!.getWorkingTime(spinnerId), | ||
); | ||
|
||
SpinnerProcessor!.warnSpinner( | ||
spinnerId, | ||
`Circuits are ready for the compilation ${resolvingTimeMessage}, however, 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
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