Reworked diagnostics, saves line positions in memory, instead of calculating later.

This commit is contained in:
2019-01-16 23:57:42 +01:00
parent b5bfb7997b
commit 1d6b5673d6
55 changed files with 322 additions and 351 deletions

View File

@@ -7,9 +7,9 @@ namespace Upsilon.Utilities
{
public static class SearchHelper
{
public static BoundScope GetScopeAt(this BoundScript script, int characterPosition)
public static BoundScope GetScopeAt(this BoundScript script, int linePosition, int characterPosition)
{
foreach (var node in script.GetNodeAtPosition(characterPosition))
foreach (var node in script.GetNodeAtPosition(linePosition, characterPosition))
{
if (node is IBoundNodeScopeOwner scopeOwner && scopeOwner.Scope != null)
{
@@ -19,14 +19,14 @@ namespace Upsilon.Utilities
return script.Scope;
}
public static BoundNode GetBottomNodeAtPosition(this BoundNode node, int characterPosition)
public static BoundNode GetBottomNodeAtPosition(this BoundNode node, int linePosition, int characterPosition)
{
return node.GetNodeAtPosition(characterPosition).First();
return node.GetNodeAtPosition(linePosition, characterPosition).First();
}
public static BoundStatement GetBottomStatementAtPosition(this BoundNode node, int characterPosition)
public static BoundStatement GetBottomStatementAtPosition(this BoundNode node, int linePosition, int characterPosition)
{
return (BoundStatement) node.GetNodeAtPosition(characterPosition).First(x => x is BoundStatement);
return (BoundStatement) node.GetNodeAtPosition(linePosition, characterPosition).First(x => x is BoundStatement);
}
public static Dictionary<string, VariableSymbol> GetBoundScopeVisibleVariables(this BoundScope scope)