...
This commit is contained in:
@@ -541,6 +541,7 @@ public class Generator
|
||||
_builder.AppendLine($" %{outputLabel} =w ceqw {left}, {right}");
|
||||
return $"%{outputLabel}";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BinaryExpressionOperator.NotEqual:
|
||||
@@ -569,6 +570,7 @@ public class Generator
|
||||
_builder.AppendLine($" %{outputLabel} =w cnew {left}, {right}");
|
||||
return $"%{outputLabel}";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BinaryExpressionOperator.GreaterThan:
|
||||
@@ -590,6 +592,7 @@ public class Generator
|
||||
_builder.AppendLine($" %{outputLabel} =w csgtw {left}, {right}");
|
||||
return $"%{outputLabel}";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BinaryExpressionOperator.GreaterThanOrEqual:
|
||||
@@ -611,6 +614,7 @@ public class Generator
|
||||
_builder.AppendLine($" %{outputLabel} =w csgew {left}, {right}");
|
||||
return $"%{outputLabel}";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BinaryExpressionOperator.LessThan:
|
||||
@@ -632,6 +636,7 @@ public class Generator
|
||||
_builder.AppendLine($" %{outputLabel} =w csltw {left}, {right}");
|
||||
return $"%{outputLabel}";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BinaryExpressionOperator.LessThanOrEqual:
|
||||
@@ -653,6 +658,7 @@ public class Generator
|
||||
_builder.AppendLine($" %{outputLabel} =w cslew {left}, {right}");
|
||||
return $"%{outputLabel}";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BinaryExpressionOperator.Plus:
|
||||
@@ -668,6 +674,7 @@ public class Generator
|
||||
_builder.AppendLine($" %{outputLabel} =w add {left}, {right}");
|
||||
return $"%{outputLabel}";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BinaryExpressionOperator.Minus:
|
||||
@@ -683,6 +690,7 @@ public class Generator
|
||||
_builder.AppendLine($" %{outputLabel} =w sub {left}, {right}");
|
||||
return $"%{outputLabel}";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BinaryExpressionOperator.Multiply:
|
||||
@@ -698,6 +706,7 @@ public class Generator
|
||||
_builder.AppendLine($" %{outputLabel} =w mul {left}, {right}");
|
||||
return $"%{outputLabel}";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BinaryExpressionOperator.Divide:
|
||||
@@ -713,6 +722,7 @@ public class Generator
|
||||
_builder.AppendLine($" %{outputLabel} =w div {left}, {right}");
|
||||
return $"%{outputLabel}";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -721,7 +731,8 @@ public class Generator
|
||||
}
|
||||
}
|
||||
|
||||
throw new NotSupportedException($"Binary operator {binaryExpression.Operator} for types left: {binaryExpression.Left.Type}, right: {binaryExpression.Right.Type} not supported");
|
||||
throw new NotSupportedException(
|
||||
$"Binary operator {binaryExpression.Operator} for types left: {binaryExpression.Left.Type}, right: {binaryExpression.Right.Type} not supported");
|
||||
}
|
||||
|
||||
private string GenerateIdentifier(IdentifierNode identifier)
|
||||
@@ -750,6 +761,17 @@ public class Generator
|
||||
throw new NotSupportedException($"Literal {literal.LiteralType} is not supported");
|
||||
}
|
||||
|
||||
private string GenerateCast(string input, NubType inputType, string output, NubType outputType)
|
||||
{
|
||||
if (outputType is not NubPrimitiveType primitiveOutputType || inputType is not NubPrimitiveType primitiveInputType)
|
||||
{
|
||||
throw new NotSupportedException("Casting is only supported for primitive types");
|
||||
}
|
||||
|
||||
// var instruction =
|
||||
return ""
|
||||
}
|
||||
|
||||
private string GenerateStructInitializer(StructInitializerNode structInitializer)
|
||||
{
|
||||
var structDefinition = _definitions.OfType<StructDefinitionNode>()
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<PublishAot>true</PublishAot>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -81,16 +81,19 @@ public class NubPrimitiveType : NubType
|
||||
{
|
||||
return kind switch
|
||||
{
|
||||
PrimitiveTypeKind.I64 => "i64",
|
||||
PrimitiveTypeKind.I32 => "i32",
|
||||
PrimitiveTypeKind.I16 => "i16",
|
||||
PrimitiveTypeKind.I8 => "i8",
|
||||
PrimitiveTypeKind.U64 => "u64",
|
||||
PrimitiveTypeKind.U32 => "u32",
|
||||
PrimitiveTypeKind.U16 => "u16",
|
||||
PrimitiveTypeKind.I16 => "i16",
|
||||
PrimitiveTypeKind.I32 => "i32",
|
||||
PrimitiveTypeKind.I64 => "i64",
|
||||
|
||||
PrimitiveTypeKind.U8 => "u8",
|
||||
PrimitiveTypeKind.F64 => "f64",
|
||||
PrimitiveTypeKind.U16 => "u16",
|
||||
PrimitiveTypeKind.U32 => "u32",
|
||||
PrimitiveTypeKind.U64 => "u64",
|
||||
|
||||
PrimitiveTypeKind.F32 => "f32",
|
||||
PrimitiveTypeKind.F64 => "f64",
|
||||
|
||||
PrimitiveTypeKind.Bool => "bool",
|
||||
PrimitiveTypeKind.String => "string",
|
||||
PrimitiveTypeKind.Any => "any",
|
||||
|
||||
Reference in New Issue
Block a user