-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert stub and stable symbols changes (#1030)
Bug fixes: - Revert stubs and stable symbols changes that caused phantom errors in VSCode (caused by #1027)
- Loading branch information
Showing
18 changed files
with
173 additions
and
34 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
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,71 @@ | ||
namespace Semantic is | ||
use Collections.MAP; | ||
|
||
use Syntax.Trees.Node; | ||
|
||
struct STABLE_SYMBOL is | ||
generation: int; | ||
symbol: Scope; | ||
|
||
init(generation: int, symbol: Scope) is | ||
self.generation = generation; | ||
self.symbol = symbol; | ||
si | ||
|
||
to_string() -> string => "" + symbol + " gen " + generation; | ||
si | ||
|
||
class STABLE_SYMBOLS is | ||
_generation: int; | ||
_symbols: MAP[Node,STABLE_SYMBOL]; | ||
_is_enabled: bool; | ||
|
||
[node: Node] -> Scope is | ||
let result: STABLE_SYMBOL; | ||
|
||
_symbols.try_get_value(node, result ref); | ||
|
||
return result.symbol; | ||
si | ||
|
||
init() is | ||
_symbols = new MAP[Node,STABLE_SYMBOL](); | ||
si | ||
|
||
enable() is | ||
_is_enabled = true; | ||
si | ||
|
||
is_stable(node: Node) -> bool is | ||
let symbol: STABLE_SYMBOL; | ||
|
||
if !_is_enabled then | ||
return false; | ||
fi | ||
|
||
if _symbols.try_get_value(node, symbol ref) then | ||
return _generation > symbol.generation; | ||
fi | ||
si | ||
|
||
try_get_symbol(node: Node, result: STABLE_SYMBOL ref) -> bool is | ||
if !_is_enabled then | ||
return false; | ||
fi | ||
|
||
return _symbols.try_get_value(node, result); | ||
si | ||
|
||
add(node: Node, scope: Scope) is | ||
if !_is_enabled then | ||
return; | ||
fi | ||
|
||
_symbols[node] = new STABLE_SYMBOL(_generation, scope); | ||
si | ||
|
||
next_generation() is | ||
_generation = _generation + 1; | ||
si | ||
si | ||
si |
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
Oops, something went wrong.