Importing names from places

This commit is contained in:
Fábio Santos
2016-02-21 17:06:09 +00:00
committed by Richard van Velzen
parent 0465bd270d
commit d35a9e7839
5 changed files with 56 additions and 9 deletions

View File

@@ -1611,15 +1611,27 @@ function parse($TEXT, options) {
}
function import_() {
var start = prev();
var imported_name;
if (is("name")) {
imported_name = as_symbol(AST_SymbolImport);
expect_token("name", "from");
}
var mod_str = S.token;
if (mod_str.type !== 'string') {
unexpected();
}
next();
return new AST_Import({
start: prev(),
start: start,
imported_name: imported_name,
module_name: new AST_String({
start : S.token,
value : S.token.value,
quote : S.token.quote,
end : S.token,
start: mod_str,
value: mod_str.value,
quote: mod_str.quote,
end: mod_str,
}),
end: next(),
end: S.token,
});
}