Hack to allow binary operators on userdata
This commit is contained in:
parent
97f3a4d879
commit
bb51fb3853
|
@ -41,8 +41,7 @@ namespace Upsilon.Binder
|
||||||
OutType = outType;
|
OutType = outType;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly BoundBinaryOperator[] Operators = new[]
|
private static readonly BoundBinaryOperator[] Operators = {
|
||||||
{
|
|
||||||
// Math operators
|
// Math operators
|
||||||
new BoundBinaryOperator(OperatorKind.Addition, Type.Number),
|
new BoundBinaryOperator(OperatorKind.Addition, Type.Number),
|
||||||
new BoundBinaryOperator(OperatorKind.Subtraction, Type.Number),
|
new BoundBinaryOperator(OperatorKind.Subtraction, Type.Number),
|
||||||
|
@ -97,6 +96,8 @@ namespace Upsilon.Binder
|
||||||
|
|
||||||
public static BoundBinaryOperator Bind(SyntaxKind operatorToken, Type left, Type right)
|
public static BoundBinaryOperator Bind(SyntaxKind operatorToken, Type left, Type right)
|
||||||
{
|
{
|
||||||
|
if (left == Type.UserData) left = Type.Unknown;
|
||||||
|
if (right == Type.UserData) right = Type.Unknown;
|
||||||
OperatorKind kind;
|
OperatorKind kind;
|
||||||
switch (operatorToken)
|
switch (operatorToken)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue