summaryrefslogtreecommitdiff
path: root/Context.cc
diff options
context:
space:
mode:
authorNagi5Yeq <wu@x-nagi.com>2020-05-25 00:53:57 +0800
committerNagi5Yeq <wu@x-nagi.com>2020-05-25 00:53:57 +0800
commitc5e9f890dab0e4595482301d77876793c8bceb8c (patch)
treecb115b6b5b8ffaa5d0de88f9ad5df34016223ec6 /Context.cc
parent3832be8be4b23fb9e93a3f181e4205eadbdbf4de (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.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/Context.cc b/Context.cc
index 64c9d58..d009835 100644
--- a/Context.cc
+++ b/Context.cc
@@ -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