app.processing.post.sort_imports

Ensure unique imports at the front of the program.

Module Contents

class app.processing.post.sort_imports.SortImportsTransformer

Create unique imports at the top.

Makes following changes:

  • remove duplicate imports

  • move imports at the top

visit_Include(node: openqasm3.ast.Include) None

Store and remove all includes.

Parameters:

node (openqasm3.ast.Include) – The statement to process

Returns:

None removes the node

Return type:

None

visit_Program(node: openqasm3.ast.Program) openqasm3.ast.Program

Execute a normal (generic) visit, then add removed imports back.

Parameters:

node (openqasm3.ast.Program)

Return type:

openqasm3.ast.Program