diff options
| author | Nagi5Yeq <wu@x-nagi.com> | 2020-05-25 00:53:57 +0800 |
|---|---|---|
| committer | Nagi5Yeq <wu@x-nagi.com> | 2020-05-25 00:53:57 +0800 |
| commit | c5e9f890dab0e4595482301d77876793c8bceb8c (patch) | |
| tree | cb115b6b5b8ffaa5d0de88f9ad5df34016223ec6 /Context.cc | |
| parent | 3832be8be4b23fb9e93a3f181e4205eadbdbf4de (diff) | |
finish function node.
Parser.y: rename 'context' to 'ctx' to avoid conflict in new version bison.
Diffstat (limited to 'Context.cc')
| -rw-r--r-- | Context.cc | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -9,11 +9,21 @@ llvm::LLVMContext GlobalLLVMContext; Context::Context(const char* name) : builder_(GlobalLLVMContext) - , module_(name, GlobalLLVMContext) {} + , module_(name, GlobalLLVMContext) { + scopes_.push(&globals_); +} TypeManager* Context::GetTypeManager() { return &TypeManager_; } +VariableList Context::GetGlobals() { return &globals_; } + llvm::Module* Context::GetModule() { return &module_; } llvm::IRBuilder<>* Context::GetBuilder() { return &builder_; } + +VariableList* Context::GetCurrentScope() { return scopes_.top(); } + +void Context::PushScope(VariableList* scope) { scopes_.push(scope); } + +void Context::PopScope() { scopes_.pop(); } } // namespace pcc |
