`import name [as alias]`: resolves and binds module as HeapObj::Module under alias. */
(&mut self)
| 17 | |
| 18 | /* `import name [as alias]`: resolves and binds module as HeapObj::Module under alias. */ |
| 19 | pub(super) fn do_import_stmt(&mut self) { |
| 20 | self.advance(); // 'import' |
| 21 | loop { |
| 22 | let (spec, span) = self.read_module_spec(); |
| 23 | let alias = if self.eat_if(TokenType::As) { |
| 24 | self.advance_text() |
| 25 | } else { |
| 26 | spec.split('.').next().unwrap_or(&spec).to_string() |
| 27 | }; |
| 28 | self.resolve_and_bind_all(&spec, span, &alias); |
| 29 | if !self.eat_if(TokenType::Comma) { break; } |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | /* `from <spec> import names|*`: spec is URL, path, or bare name; `*` binds all exports. Names may be parenthesized for multi-line lists, trailing comma allowed. */ |
| 34 | pub(super) fn do_from_stmt(&mut self) { |
no test coverage detected