Fix finding bottom node when two nodes are on the same line not working

This commit is contained in:
Deukhoofd 2019-01-17 19:24:00 +01:00
parent c1fd6081fd
commit 64aedceb85
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
4 changed files with 17 additions and 4 deletions

View File

@ -15,5 +15,11 @@ namespace Upsilon.Binder.VariableSymbols
public abstract (bool IsValid, string Error, BoundExpression WrongParameter) ValidateParameters( public abstract (bool IsValid, string Error, BoundExpression WrongParameter) ValidateParameters(
ImmutableArray<BoundExpression> callingParameters); ImmutableArray<BoundExpression> callingParameters);
public override Type Type
{
get => Type.Function;
set{}
}
} }
} }

View File

@ -1,6 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using Upsilon.BaseTypes;
using Upsilon.BaseTypes.ScriptFunction; using Upsilon.BaseTypes.ScriptFunction;
using Upsilon.BaseTypes.UserData; using Upsilon.BaseTypes.UserData;

View File

@ -176,9 +176,6 @@ namespace Upsilon.StandardLibraries
return Type.Boolean; return Type.Boolean;
if (typeof(ScriptTable).IsAssignableFrom(type)) if (typeof(ScriptTable).IsAssignableFrom(type))
return Type.Table; return Type.Table;
if (type == typeof(ScriptType))
// allows every type
return (Type) 255;
if (type == typeof(IIterable)) if (type == typeof(IIterable))
@ -186,6 +183,11 @@ namespace Upsilon.StandardLibraries
if (typeof(IEnumerable).IsAssignableFrom(type)) if (typeof(IEnumerable).IsAssignableFrom(type))
return Type.Table | Type.UserData; return Type.Table | Type.UserData;
if (type == typeof(ScriptType))
// allows every type
return (Type) 255;
return Type.UserData; return Type.UserData;
} }
} }

View File

@ -27,6 +27,12 @@ namespace Upsilon.Text
public bool Contains(int linePosition, int characterPosition) 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 && StartPosition <= characterPosition) return true;
if (StartLine < linePosition && EndLine > linePosition) return true; if (StartLine < linePosition && EndLine > linePosition) return true;
if (EndLine == linePosition && EndPosition >= characterPosition) return true; if (EndLine == linePosition && EndPosition >= characterPosition) return true;