Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare expand to be its own library by decoupling imports #676

Merged
merged 1 commit into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions compiler/ast_to_ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
from ir import *
from util import *
from parse import from_ast_objects_to_shell
from shell_ast.expand import expand_command
from shell_ast.expand import expand_command, ExpansionState
import subprocess
import config

## TODO: Separate the ir stuff to the bare minimum and
## try to move this to the shell_ast folder.
Expand Down Expand Up @@ -53,7 +52,10 @@ def compile_asts(ast_objects: "list[AstNode]", fileIdGen, config):
assert(isinstance(ast_object, AstNode))

## Compile subtrees of the AST to out intermediate representation
expanded_ast = expand_command(ast_object, config)
## KK 2023-05-25: Would we ever want to pass this state to the expansion
## of the next object? I don't think so.
exp_state = ExpansionState(config['shell_variables'])
expanded_ast = expand_command(ast_object, exp_state)
# log("Expanded:", expanded_ast)
compiled_ast = compile_node(expanded_ast, fileIdGen, config)

Expand Down
Loading