Type check when calling script function from CSharp
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Upsilon.BaseTypes;
|
||||
|
||||
@@ -5,7 +6,7 @@ namespace Upsilon.BoundTypes
|
||||
{
|
||||
public static class BoundTypeHandler
|
||||
{
|
||||
private static Dictionary<string, BoundTypeDefinition> _typeDefinitions = new Dictionary<string, BoundTypeDefinition>
|
||||
private static readonly Dictionary<string, BoundTypeDefinition> TypeDefinitions = new Dictionary<string, BoundTypeDefinition>
|
||||
{
|
||||
{"string", new BoundTypeDefinition(Type.String, typeof(string))},
|
||||
{
|
||||
@@ -13,12 +14,14 @@ namespace Upsilon.BoundTypes
|
||||
new BoundTypeDefinition(Type.Number,
|
||||
new[] {typeof(int), typeof(long), typeof(float), typeof(double)})
|
||||
},
|
||||
{"bool", new BoundTypeDefinition(Type.Boolean, typeof(bool))}
|
||||
{"bool", new BoundTypeDefinition(Type.Boolean, typeof(bool))},
|
||||
{"table", new BoundTypeDefinition(Type.Table, typeof(IEnumerator))},
|
||||
{"function", new BoundTypeDefinition(Type.Function, new System.Type[0])},
|
||||
};
|
||||
|
||||
public static BoundTypeDefinition GetTypeDefinition(string key)
|
||||
{
|
||||
return _typeDefinitions[key.ToLowerInvariant()];
|
||||
return TypeDefinitions[key.ToLowerInvariant()];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user