Skip to content

Commit

Permalink
XX
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
  • Loading branch information
mballance committed Nov 22, 2023
1 parent 75f57dc commit c73f6ff
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions ast/expr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ classes:
- image: string
- width: int32_t
- value: int64_t
# TODO: Remove this once it is safe to do so
- ExprStaticRefPath:
super: Expr
data:
Expand Down
6 changes: 6 additions & 0 deletions src/TaskBuildSymbolTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ void TaskBuildSymbolTree::visitFunctionDefinition(ast::IFunctionDefinition *i) {
func_sym->getChildren().at(sym_it->second),
it->get());
} else {
DEBUG("Add parameter %s to function symtab", (*it)->getName()->getId().c_str());
func_sym->getSymtab().insert({(*it)->getName()->getId(), id});
func_sym->getChildren().push_back(it->get());
}
Expand All @@ -372,6 +373,11 @@ void TaskBuildSymbolTree::visitFunctionDefinition(ast::IFunctionDefinition *i) {
m_scope_s.pop_back();

func_sym->setDefinition(i);
// Ensure that the definition takes the primary prototype location
func_sym->getPrototypes().insert(
func_sym->getPrototypes().begin(),
i->getProto()
);

DEBUG_LEAVE("visitFunctionDefinition %s", i->getProto()->getName()->getId().c_str());
}
Expand Down
7 changes: 5 additions & 2 deletions src/TaskResolveRefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,14 +447,17 @@ void TaskResolveRefs::visitSymbolFunctionScope(ast::ISymbolFunctionScope *i) {
}

if (i->getBody()) {
DEBUG("Push function scope %s", i->getName().c_str());
m_symtab_it->pushScope(i);
m_symtab_it->pushScope(i->getBody());
DEBUG(" has i: %d", (m_symtab_it->getScope()->getSymtab().find("i") != m_symtab_it->getScope()->getSymtab().end()));
// DEBUG("Push function body scope");
// m_symtab_it->pushScope(i->getBody());
for (std::vector<ast::IScopeChild *>::const_iterator
it=i->getBody()->getChildren().begin();
it!=i->getBody()->getChildren().end(); it++) {
(*it)->accept(m_this);
}
m_symtab_it->popScope();
// m_symtab_it->popScope();
m_symtab_it->popScope();
}

Expand Down
2 changes: 1 addition & 1 deletion src/TaskResolveRootRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void TaskResolveRootRef::visitSymbolTypeScope(ast::ISymbolTypeScope *i) {

void TaskResolveRootRef::visitSymbolFunctionScope(ast::ISymbolFunctionScope *i) {
DEBUG_ENTER("visitSymbolFunctionScope");

visitSymbolScope(i);
DEBUG_LEAVE("visitSymbolFunctionScope");
}

Expand Down

0 comments on commit c73f6ff

Please sign in to comment.