SymbolMapperV2

- Renamed
This commit is contained in:
Tristan B. Velloza Kildaire 2024-04-07 12:32:28 +02:00
parent aa1c19b6ed
commit 42ec17e5ee
5 changed files with 11 additions and 11 deletions

View File

@ -11,7 +11,7 @@ import std.range : walkLength;
import gogga;
import std.conv : to;
import tlang.compiler.configuration : CompilerConfiguration;
import tlang.compiler.codegen.mapper.api : SymbolMapperV2;
import tlang.compiler.codegen.mapper.api : SymbolMapper;
/**
* TODO: Perhaps have an interface that can emit(Context/Parent, Statement)
@ -24,7 +24,7 @@ public abstract class CodeEmitter
protected TypeChecker typeChecker;
protected File file;
protected CompilerConfiguration config;
protected SymbolMapperV2 mapper;
protected SymbolMapper mapper;
/**
* The selected queue is the queue to be used
@ -134,7 +134,7 @@ public abstract class CodeEmitter
return functionBodyInstrs.keys();
}
this(TypeChecker typeChecker, File file, CompilerConfiguration config, SymbolMapperV2 mapper)
this(TypeChecker typeChecker, File file, CompilerConfiguration config, SymbolMapper mapper)
{
this.typeChecker = typeChecker;
this.file = file;

View File

@ -33,7 +33,7 @@ public final class DCodeEmitter : CodeEmitter
private bool symbolMapping;
// NOTE: In future store the mapper in the config please
this(TypeChecker typeChecker, File file, CompilerConfiguration config, SymbolMapperV2 mapper)
this(TypeChecker typeChecker, File file, CompilerConfiguration config, SymbolMapper mapper)
{
super(typeChecker, file, config, mapper);

View File

@ -8,7 +8,7 @@ import tlang.compiler.symbols.data : Entity;
* implement in order to be used
* in the `DGen` code emitter
*/
public interface SymbolMapperV2
public interface SymbolMapper
{
/**
* Maps the given `Entity` to a symbol

View File

@ -6,7 +6,7 @@ import tlang.compiler.symbols.data : Entity;
import tlang.compiler.symbols.containers : Module;
import std.string : format;
public class LebanonMapper : SymbolMapperV2
public class LebanonMapper : SymbolMapper
{
private TypeChecker tc;
@ -73,7 +73,7 @@ unittest
TypeChecker tc = new TypeChecker(compiler);
SymbolMapperV2 lebMapper = new LebanonMapper(tc);
SymbolMapper lebMapper = new LebanonMapper(tc);
string withModPath = lebMapper.map(variable, ScopeType.GLOBAL);
writeln(format("withModPath: '%s'", withModPath));
@ -84,7 +84,7 @@ unittest
assert(cmp(withoutModPath, "varA") == 0);
}
public class HashMapper : SymbolMapperV2
public class HashMapper : SymbolMapper
{
private TypeChecker tc;
@ -149,7 +149,7 @@ unittest
TypeChecker tc = new TypeChecker(compiler);
SymbolMapperV2 hashMapper = new HashMapper(tc);
SymbolMapper hashMapper = new HashMapper(tc);
string withModPath = hashMapper.map(variable, ScopeType.GLOBAL);
writeln(format("withModPath: '%s'", withModPath));

View File

@ -14,7 +14,7 @@ import core.stdc.stdlib;
import tlang.compiler.codegen.emit.core;
import tlang.compiler.codegen.emit.dgen;
import misc.exceptions;
import tlang.compiler.codegen.mapper.api : SymbolMapperV2;
import tlang.compiler.codegen.mapper.api : SymbolMapper;
import tlang.compiler.codegen.mapper.impls : HashMapper, LebanonMapper;
import std.string : cmp;
import tlang.compiler.configuration : CompilerConfiguration, ConfigEntry;
@ -278,7 +278,7 @@ public class Compiler
throw new CompilerException(CompilerError.CONFIG_ERROR, "Missing a symbol mapper");
}
SymbolMapperV2 mapper;
SymbolMapper mapper;
string mapperType = config.getConfig("dgen:mapper").getText();
if(cmp(mapperType, "hashmapper") == 0)