mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
Support export { default as (name) }
This commit is contained in:
@@ -2,8 +2,6 @@ export default function foo() {
|
||||
return "this is the foo function";
|
||||
}
|
||||
|
||||
export { foo };
|
||||
|
||||
export function other() {
|
||||
return "this is the other function";
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export { foo } from "./foo.ts";
|
||||
export { default as foo } from "./foo.ts";
|
||||
export { barExported as bar } from "./bar.ts";
|
||||
|
||||
@@ -523,17 +523,23 @@ impl ModuleCompiler {
|
||||
self.module.definitions.push(Definition {
|
||||
pointer: defn.clone(),
|
||||
content: DefinitionContent::Lazy(Lazy {
|
||||
body: vec![
|
||||
InstructionOrLabel::Instruction(Instruction::ImportStar(
|
||||
body: match orig_name == "default" {
|
||||
true => vec![InstructionOrLabel::Instruction(Instruction::Import(
|
||||
Value::String(src.value.to_string()),
|
||||
Register::Return,
|
||||
)),
|
||||
InstructionOrLabel::Instruction(Instruction::Sub(
|
||||
Value::Register(Register::Return),
|
||||
Value::String(orig_name.clone()),
|
||||
Register::Return,
|
||||
)),
|
||||
],
|
||||
))],
|
||||
false => vec![
|
||||
InstructionOrLabel::Instruction(Instruction::ImportStar(
|
||||
Value::String(src.value.to_string()),
|
||||
Register::Return,
|
||||
)),
|
||||
InstructionOrLabel::Instruction(Instruction::Sub(
|
||||
Value::Register(Register::Return),
|
||||
Value::String(orig_name.clone()),
|
||||
Register::Return,
|
||||
)),
|
||||
],
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user