Narrowing works
This commit is contained in:
@@ -18,6 +18,7 @@ namespace Solstice {
|
||||
class TypeChecker {
|
||||
std::unordered_map<std::string, PossibleType> variables;
|
||||
std::unordered_map<std::string, Type> types;
|
||||
std::unordered_map<std::string, Function> functions;
|
||||
|
||||
std::unordered_map<TypePair, Type> addOverloads;
|
||||
std::unordered_map<TypePair, Type> subtractOverloads;
|
||||
@@ -80,5 +81,13 @@ namespace Solstice {
|
||||
}
|
||||
|
||||
void checkTypes();
|
||||
|
||||
const Function* getFunction(const std::string& name) const {
|
||||
auto it = functions.find(name);
|
||||
if (it == functions.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return &it->second;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user