...
This commit is contained in:
@@ -427,7 +427,7 @@ public sealed class TypeChecker
|
|||||||
case BinaryOperatorSyntax.LogicalOr:
|
case BinaryOperatorSyntax.LogicalOr:
|
||||||
{
|
{
|
||||||
var left = CheckExpression(expression.Left);
|
var left = CheckExpression(expression.Left);
|
||||||
if (left.Type is not NubIntType or NubFloatType)
|
if (left.Type is not NubIntType and not NubFloatType)
|
||||||
{
|
{
|
||||||
throw new TypeCheckerException(Diagnostic.Error("Logical operators must must be used with int or float types").At(expression.Left).Build());
|
throw new TypeCheckerException(Diagnostic.Error("Logical operators must must be used with int or float types").At(expression.Left).Build());
|
||||||
}
|
}
|
||||||
@@ -453,7 +453,7 @@ public sealed class TypeChecker
|
|||||||
case BinaryOperatorSyntax.Modulo:
|
case BinaryOperatorSyntax.Modulo:
|
||||||
{
|
{
|
||||||
var left = CheckExpression(expression.Left);
|
var left = CheckExpression(expression.Left);
|
||||||
if (left.Type is not NubIntType or NubFloatType)
|
if (left.Type is not NubIntType and not NubFloatType)
|
||||||
{
|
{
|
||||||
throw new TypeCheckerException(Diagnostic.Error("Math operators must be used with int or float types").At(expression.Left).Build());
|
throw new TypeCheckerException(Diagnostic.Error("Math operators must be used with int or float types").At(expression.Left).Build());
|
||||||
}
|
}
|
||||||
@@ -492,7 +492,7 @@ public sealed class TypeChecker
|
|||||||
case UnaryOperatorSyntax.Negate:
|
case UnaryOperatorSyntax.Negate:
|
||||||
{
|
{
|
||||||
var operand = CheckExpression(expression.Operand);
|
var operand = CheckExpression(expression.Operand);
|
||||||
if (operand.Type is not NubIntType { Signed: false } or NubFloatType)
|
if (operand.Type is not NubIntType { Signed: false } and not NubFloatType)
|
||||||
{
|
{
|
||||||
throw new TypeCheckerException(Diagnostic.Error("Negation operator must be used with signed integer or float types").At(expression).Build());
|
throw new TypeCheckerException(Diagnostic.Error("Negation operator must be used with signed integer or float types").At(expression).Build());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,16 @@ extern "main" func main(args: []cstring): i64
|
|||||||
}
|
}
|
||||||
raylib::EndDrawing()
|
raylib::EndDrawing()
|
||||||
|
|
||||||
|
if x + width > raylib::GetScreenWidth()
|
||||||
|
{
|
||||||
|
direction.x = -direction.x
|
||||||
|
}
|
||||||
|
|
||||||
|
if y + height > raylib::GetScreenHeight()
|
||||||
|
{
|
||||||
|
direction.y = -direction.y
|
||||||
|
}
|
||||||
|
|
||||||
x = x + @floatToInt(i32, direction.x)
|
x = x + @floatToInt(i32, direction.x)
|
||||||
y = y + @floatToInt(i32, direction.y)
|
y = y + @floatToInt(i32, direction.y)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user