Skip to content

Commit

Permalink
Stop auto-generating AST code.
Browse files Browse the repository at this point in the history
This moves all the previously auto-generated code into the normal
source tree, to be manually maintained going forward. It also removes
some additional refactoring scripts that were useful during the AST
rewrite, but are no longer needed now.
  • Loading branch information
rsmmr committed Feb 23, 2024
1 parent 5efcbed commit dc47214
Show file tree
Hide file tree
Showing 55 changed files with 2,790 additions and 1,622 deletions.
19 changes: 0 additions & 19 deletions cmake/ASTOperators.cmake

This file was deleted.

4 changes: 0 additions & 4 deletions hilti/toolchain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ bison_source(src/compiler/parser/driver.cc ${AUTOGEN_CC})
bison_source(${AUTOGEN_CC}/__scanner.cc ${AUTOGEN_CC})
bison_source(${AUTOGEN_CC}/__parser.cc ${AUTOGEN_CC})

include(ASTOperators)

autogen_operators(SOURCES_OPERATORS hilti src/ast/operators ${AUTOGEN_H} ${AUTOGEN_CC})

set(SOURCES
src/ast/ast-context.cc
src/ast/attribute.cc
Expand Down
717 changes: 0 additions & 717 deletions hilti/toolchain/include/ast/builder/autogen/__node-factory.h

This file was deleted.

12 changes: 6 additions & 6 deletions hilti/toolchain/include/ast/builder/builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ class Builder : public builder::NodeFactory {
return statementDeclaration(declarationLocalVariable(std::move(id_), t, {}, std::move(m)));
}

auto local(ID id_, ExpressionPtr init, Meta m = Meta()) {
return statementDeclaration(declarationLocalVariable(std::move(id_), std::move(init), std::move(m)));
auto local(ID id_, ExpressionPtr init, const Meta& m = Meta()) {
return statementDeclaration(declarationLocalVariable(std::move(id_), std::move(init), m));
}

auto local(ID id_, const QualifiedTypePtr& t, ExpressionPtr init, Meta m = Meta()) {
Expand All @@ -114,8 +114,8 @@ class Builder : public builder::NodeFactory {
}

auto global(ID id_, const ExpressionPtr& init, declaration::Linkage linkage = declaration::Linkage::Private,
Meta m = Meta()) {
return declarationGlobalVariable(std::move(id_), init, linkage, std::move(m));
const Meta& m = Meta()) {
return declarationGlobalVariable(std::move(id_), init, linkage, m);
}

auto global(ID id_, const QualifiedTypePtr& t, ExpressionPtr init,
Expand Down Expand Up @@ -558,8 +558,8 @@ class Builder : public builder::NodeFactory {
block()->_add(context(), statementComment(std::move(comment), separator, m));
}

void addReturn(ExpressionPtr e, Meta m = Meta()) {
block()->_add(context(), statementReturn(std::move(e), std::move(m)));
void addReturn(const ExpressionPtr& e, Meta m = Meta()) {
block()->_add(context(), statementReturn(e, std::move(m)));
}

void addReturn(const CtorPtr& c, const Meta& m = Meta()) {
Expand Down
624 changes: 620 additions & 4 deletions hilti/toolchain/include/ast/builder/node-factory.h

Large diffs are not rendered by default.

Loading

0 comments on commit dc47214

Please sign in to comment.