-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added custom selected imports (finally)
- Loading branch information
1 parent
35351ac
commit f1e192f
Showing
11 changed files
with
80 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
#include "../../Transformer.h" | ||
|
||
using namespace snowball::utils; | ||
using namespace snowball::Syntax; | ||
|
||
namespace snowball { | ||
namespace Syntax { | ||
|
||
void Transformer::createModuleAliases(std::shared_ptr<ir::Module> mod, Statement::ImportStmt* import, const std::string& exportName) { | ||
auto aliases = import->getVariables(); | ||
if (aliases.size() == 0) return; | ||
|
||
auto baseIdentifier = N<Expression::Identifier>(exportName); | ||
baseIdentifier->setDBGInfo(import->getDBGInfo()); | ||
for (auto [alias, identifier] : aliases) { | ||
auto aliasIdentifier = N<Expression::Identifier>(alias); | ||
auto moduleIndex = N<Expression::Index>(baseIdentifier, aliasIdentifier, true); | ||
moduleIndex->setDBGInfo(import->getDBGInfo()); | ||
auto item = std::make_shared<transform::Item>(moduleIndex); | ||
ctx->addItem(identifier, item); | ||
} | ||
} | ||
|
||
} // namespace Syntax | ||
} // namespace snowball |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters