Fixed issues where userdata types could sometimes cause crashes
This commit is contained in:
parent
8829df0ba3
commit
80afeacda6
|
@ -16,7 +16,7 @@ namespace Upsilon.Binder
|
||||||
public bool IsCoroutine { get; }
|
public bool IsCoroutine { get; }
|
||||||
|
|
||||||
public BoundFunctionExpression(ImmutableArray<BoundVariableSymbol> parameters, BoundBlockStatement block,
|
public BoundFunctionExpression(ImmutableArray<BoundVariableSymbol> parameters, BoundBlockStatement block,
|
||||||
TextSpan span, BoundScope scope, Type returnType, bool isCoroutine) : base(span)
|
TextSpan span, BoundScope scope, TypeContainer returnType, bool isCoroutine) : base(span)
|
||||||
{
|
{
|
||||||
Parameters = parameters;
|
Parameters = parameters;
|
||||||
Block = block;
|
Block = block;
|
||||||
|
@ -36,7 +36,7 @@ namespace Upsilon.Binder
|
||||||
yield return Block;
|
yield return Block;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override TypeContainer ValueType => BaseTypes.Type.Function;
|
public override TypeContainer ValueType => Type.Function;
|
||||||
internal override ScriptType Evaluate(EvaluationScope scope, Diagnostics diagnostics, ref EvaluationState state)
|
internal override ScriptType Evaluate(EvaluationScope scope, Diagnostics diagnostics, ref EvaluationState state)
|
||||||
{
|
{
|
||||||
var option = new ScriptRuntimeFunction.ScriptRuntimeFunctionOption(Parameters, Block, scope);
|
var option = new ScriptRuntimeFunction.ScriptRuntimeFunctionOption(Parameters, Block, scope);
|
||||||
|
@ -47,6 +47,6 @@ namespace Upsilon.Binder
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundScope Scope { get; set; }
|
public BoundScope Scope { get; set; }
|
||||||
public Type ReturnType { get; }
|
public TypeContainer ReturnType { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Upsilon.BaseTypes;
|
||||||
using Upsilon.Binder.VariableSymbols;
|
using Upsilon.Binder.VariableSymbols;
|
||||||
using Type = Upsilon.BaseTypes.Type;
|
using Type = Upsilon.BaseTypes.Type;
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ namespace Upsilon.Binder
|
||||||
public readonly BoundScope ParentScope;
|
public readonly BoundScope ParentScope;
|
||||||
public BoundScope ReadOnlyScope { get; private set; }
|
public BoundScope ReadOnlyScope { get; private set; }
|
||||||
public readonly Dictionary<string, VariableSymbol> Variables;
|
public readonly Dictionary<string, VariableSymbol> Variables;
|
||||||
public Type ReturnType { get; set; } = Type.Nil;
|
public TypeContainer ReturnType { get; set; } = Type.Nil;
|
||||||
|
|
||||||
public BoundScope(BoundScope parentScope)
|
public BoundScope(BoundScope parentScope)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace Upsilon.Binder.VariableSymbols
|
||||||
{
|
{
|
||||||
public class ScriptFunctionVariableSymbol : FunctionVariableSymbol
|
public class ScriptFunctionVariableSymbol : FunctionVariableSymbol
|
||||||
{
|
{
|
||||||
public ScriptFunctionVariableSymbol(string name, bool local, ImmutableArray<VariableSymbol> parameters, Type resultType,
|
public ScriptFunctionVariableSymbol(string name, bool local, ImmutableArray<VariableSymbol> parameters, TypeContainer resultType,
|
||||||
bool isCoroutine)
|
bool isCoroutine)
|
||||||
: base(name, local, isCoroutine)
|
: base(name, local, isCoroutine)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue