Skip to content

Commit

Permalink
DGen
Browse files Browse the repository at this point in the history
- When generating symbols for `Variable`, if it IS `isExternal()` then do not symbol map, else symbol map
  • Loading branch information
deavmi committed Apr 7, 2024
1 parent 99de4fe commit 59edbde
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions source/tlang/compiler/codegen/emit/dgen.d
Original file line number Diff line number Diff line change
Expand Up @@ -1194,13 +1194,23 @@ public final class DCodeEmitter : CodeEmitter
// Extract the Variable's type
Type varType = typeChecker.getType(var.context.container, var.getType());

// FIXME: Set proper scope type
string renamedSymbol = mapper.map(var, ScopeType.GLOBAL);
// Decide on the symbol's name
string symbolName;

// <type> <name>
signature = typeTransform(varType)~" "~renamedSymbol;
// If it is NOT extern then map it
if(!var.isExternal())
{
// FIXME: Set proper scope type
symbolName = mapper.map(var, ScopeType.GLOBAL);
}
// If it is extern, then leave it as such
else
{
symbolName = var.getName();
}

// TODO: Add extern here?
// <type> <name>
signature = typeTransform(varType)~" "~symbolName;

return signature;
}
Expand Down

0 comments on commit 59edbde

Please sign in to comment.