From 64aedceb85998648a3ad04733bf2c82a2a1fe4fe Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Thu, 17 Jan 2019 19:24:00 +0100 Subject: [PATCH] Fix finding bottom node when two nodes are on the same line not working --- Upsilon/Binder/VariableSymbols/FunctionVariableSymbol.cs | 6 ++++++ Upsilon/StandardLibraries/ScriptLibrary.cs | 1 - Upsilon/StandardLibraries/StaticScope.cs | 8 +++++--- Upsilon/Text/TextSpan.cs | 6 ++++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Upsilon/Binder/VariableSymbols/FunctionVariableSymbol.cs b/Upsilon/Binder/VariableSymbols/FunctionVariableSymbol.cs index 0e3581d..13953c7 100644 --- a/Upsilon/Binder/VariableSymbols/FunctionVariableSymbol.cs +++ b/Upsilon/Binder/VariableSymbols/FunctionVariableSymbol.cs @@ -15,5 +15,11 @@ namespace Upsilon.Binder.VariableSymbols public abstract (bool IsValid, string Error, BoundExpression WrongParameter) ValidateParameters( ImmutableArray callingParameters); + + public override Type Type + { + get => Type.Function; + set{} + } } } \ No newline at end of file diff --git a/Upsilon/StandardLibraries/ScriptLibrary.cs b/Upsilon/StandardLibraries/ScriptLibrary.cs index daec8cf..c60d7fc 100644 --- a/Upsilon/StandardLibraries/ScriptLibrary.cs +++ b/Upsilon/StandardLibraries/ScriptLibrary.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Reflection; -using Upsilon.BaseTypes; using Upsilon.BaseTypes.ScriptFunction; using Upsilon.BaseTypes.UserData; diff --git a/Upsilon/StandardLibraries/StaticScope.cs b/Upsilon/StandardLibraries/StaticScope.cs index 40d4f73..e55e56c 100644 --- a/Upsilon/StandardLibraries/StaticScope.cs +++ b/Upsilon/StandardLibraries/StaticScope.cs @@ -176,9 +176,6 @@ namespace Upsilon.StandardLibraries return Type.Boolean; if (typeof(ScriptTable).IsAssignableFrom(type)) return Type.Table; - if (type == typeof(ScriptType)) - // allows every type - return (Type) 255; if (type == typeof(IIterable)) @@ -186,6 +183,11 @@ namespace Upsilon.StandardLibraries if (typeof(IEnumerable).IsAssignableFrom(type)) return Type.Table | Type.UserData; + + if (type == typeof(ScriptType)) + // allows every type + return (Type) 255; + return Type.UserData; } } diff --git a/Upsilon/Text/TextSpan.cs b/Upsilon/Text/TextSpan.cs index a8dbf5c..744af4a 100644 --- a/Upsilon/Text/TextSpan.cs +++ b/Upsilon/Text/TextSpan.cs @@ -27,6 +27,12 @@ namespace Upsilon.Text public bool Contains(int linePosition, int characterPosition) { + if (StartLine == EndLine && linePosition == StartLine) + { + if (characterPosition >= StartPosition && characterPosition <= EndPosition) + return true; + return false; + } if (StartLine == linePosition && StartPosition <= characterPosition) return true; if (StartLine < linePosition && EndLine > linePosition) return true; if (EndLine == linePosition && EndPosition >= characterPosition) return true;