- VariableParameter's now have their `Type` object extracted and type transformed as part of function definitions.

Tests cases

- Updated `simple_cast.t` to test new typeTransform() usage on VariableParameter (as stated above)
This commit is contained in:
Tristan B. Velloza Kildaire 2023-01-15 12:40:42 +02:00
parent b1d168ab44
commit 7f8973a4aa
2 changed files with 6 additions and 2 deletions

View File

@ -597,6 +597,7 @@ public final class DCodeEmitter : CodeEmitter
{
string signature;
// Extract the Function's return Type
Type returnType = typeChecker.getType(func.context.container, func.getType());
// <type> <functionName> (
@ -612,13 +613,16 @@ public final class DCodeEmitter : CodeEmitter
{
Variable currentParameter = parameters[parIdx];
// Extract the variable's type
Type parameterType = typeChecker.getType(currentParameter.context.container, currentParameter.getType());
// Generate the symbol-mapped names for the parameters
Variable typedEntityVariable = cast(Variable)typeChecker.getResolver().resolveBest(func, currentParameter.getName()); //TODO: Remove `auto`
string renamedSymbol = SymbolMapper.symbolLookup(typedEntityVariable);
// Generate <type> <parameter-name (symbol mapped)>
parameterString~=currentParameter.getType()~" "~renamedSymbol;
parameterString~=typeTransform(parameterType)~" "~renamedSymbol;
if(parIdx != (parameters.length-1))
{

View File

@ -2,7 +2,7 @@ module simple_cast;
int myInt;
void function()
void function(int x)
{
byte bruh;
byte myByte = (cast(byte)myInt)+bruh;