Another variant of export added - export {Name}. (#1737)

This commit is contained in:
Ondřej Španěl
2017-03-31 11:51:27 +02:00
committed by Alex Lam S.L
parent 66e9039350
commit a729c43e87
2 changed files with 29 additions and 19 deletions

View File

@@ -2294,26 +2294,35 @@ function parse($TEXT, options) {
}
if (exported_names) {
expect_token("name", "from");
if (is("name", "from")) {
next();
var mod_str = S.token;
if (mod_str.type !== 'string') {
unexpected();
var mod_str = S.token;
if (mod_str.type !== 'string') {
unexpected();
}
next();
return new AST_Export({
start: start,
is_default: is_default,
exported_names: exported_names,
module_name: new AST_String({
start: mod_str,
value: mod_str.value,
quote: mod_str.quote,
end: mod_str,
}),
end: prev(),
});
} else {
return new AST_Export({
start: start,
is_default: is_default,
exported_names: exported_names,
end: prev(),
});
}
next();
return new AST_Export({
start: start,
is_default: is_default,
exported_names: exported_names,
module_name: new AST_String({
start: mod_str,
value: mod_str.value,
quote: mod_str.quote,
end: mod_str,
}),
end: prev(),
});
}
var is_definition =