This repository has been archived by the owner on Jun 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: report errors on unresolved actions (#38)
Fixes $5
- Loading branch information
1 parent
1e82159
commit 61a2eec
Showing
7 changed files
with
105 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/*! | ||
* Copyright 2019 Omar Tawfik. Please see LICENSE file at the root of this repository. | ||
*/ | ||
|
||
import { BoundNodeVisitor } from "../bound-node-visitor"; | ||
import { DiagnosticBag } from "../../util/diagnostics"; | ||
import { BoundDocument, BoundResolves } from "../bound-nodes"; | ||
|
||
export class ResolvesAnalyzer extends BoundNodeVisitor { | ||
private constructor( | ||
document: BoundDocument, | ||
private readonly actions: ReadonlySet<string>, | ||
private readonly bag: DiagnosticBag, | ||
) { | ||
super(); | ||
this.visit(document); | ||
} | ||
|
||
public static analyze(document: BoundDocument, actions: ReadonlySet<string>, bag: DiagnosticBag): void { | ||
new ResolvesAnalyzer(document, actions, bag); | ||
} | ||
|
||
protected visitResolves(node: BoundResolves): void { | ||
for (const action of node.actions) { | ||
if (!this.actions.has(action.value)) { | ||
this.bag.actionDoesNotExist(action.value, action.syntax.range); | ||
} | ||
} | ||
|
||
super.visitResolves(node); | ||
} | ||
} |
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