Module: Jade::Frontend::ForwardDeclaration::ImportDeclaration
- Extended by:
- ImportDeclaration
- Included in:
- ImportDeclaration
- Defined in:
- lib/jade/frontend/forward_declaration/import_declaration.rb
Instance Method Summary collapse
- #deep(_, entry, _) ⇒ Object
-
#shallow(ast, registry, entry) ⇒ Object
TODO: This does a lot, so It could just be import registration.
Instance Method Details
#deep(_, entry, _) ⇒ Object
28 29 30 |
# File 'lib/jade/frontend/forward_declaration/import_declaration.rb', line 28 def deep(_, entry, _) Result[entry, []] end |
#shallow(ast, registry, entry) ⇒ Object
TODO: This does a lot, so It could just be import registration.
everything else doesn't need the registry at all
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jade/frontend/forward_declaration/import_declaration.rb', line 9 def shallow(ast, registry, entry) ast => AST::ImportDeclaration(module_name:, as:, exposing:) importing_module = registry.get(module_name) unless importing_module return [ entry, [ModuleNotFound.new(entry, ast.range, name: module_name)], ] end exposing_to_symbol(exposing, entry, importing_module) .map { ImportEntry[module_name, as&.as || module_name, it, importing_module.exposes] } .on_err { return Result[entry, it] } => Ok(import_entry) Result[entry.import(import_entry), []] end |