@@ -125,6 +125,16 @@
|
||||
body: normalize_directives(from_moz(M.body).body),
|
||||
});
|
||||
},
|
||||
CallExpression: function(M) {
|
||||
return new AST_Call({
|
||||
start: my_start_token(M),
|
||||
end: my_end_token(M),
|
||||
expression: from_moz(M.callee),
|
||||
args: M.arguments.map(from_moz),
|
||||
optional: M.optional,
|
||||
pure: M.pure,
|
||||
});
|
||||
},
|
||||
ClassDeclaration: function(M) {
|
||||
return new AST_DefClass({
|
||||
start: my_start_token(M),
|
||||
@@ -458,7 +468,7 @@
|
||||
end: my_end_token(M),
|
||||
};
|
||||
if (M.bigint) {
|
||||
args.value = M.bigint.toLowerCase() + "n";
|
||||
args.value = M.bigint.toLowerCase();
|
||||
return new AST_BigInt(args);
|
||||
}
|
||||
var val = M.value;
|
||||
@@ -631,7 +641,6 @@
|
||||
map("AssignmentPattern", AST_DefaultValue, "left>name, right>value");
|
||||
map("ConditionalExpression", AST_Conditional, "test>condition, consequent>consequent, alternate>alternative");
|
||||
map("NewExpression", AST_New, "callee>expression, arguments@args, pure=pure");
|
||||
map("CallExpression", AST_Call, "callee>expression, arguments@args, optional=optional, pure=pure");
|
||||
map("SequenceExpression", AST_Sequence, "expressions@expressions");
|
||||
map("SpreadElement", AST_Spread, "argument>expression");
|
||||
map("ObjectExpression", AST_Object, "properties@properties");
|
||||
@@ -668,6 +677,7 @@
|
||||
type: "ArrowFunctionExpression",
|
||||
async: is_async(M),
|
||||
params: params,
|
||||
expression: !!M.value,
|
||||
body: M.value ? to_moz(M.value) : to_moz_scope("BlockStatement", M),
|
||||
};
|
||||
return {
|
||||
@@ -680,6 +690,21 @@
|
||||
};
|
||||
});
|
||||
|
||||
def_to_moz(AST_Call, function To_Moz_CallExpression(M) {
|
||||
var expr = M.expression;
|
||||
if (M.args.length == 1 && expr instanceof AST_SymbolRef && expr.name == "import") return {
|
||||
type: "ImportExpression",
|
||||
source: to_moz(M.args[0]),
|
||||
};
|
||||
return {
|
||||
type: "CallExpression",
|
||||
callee: to_moz(expr),
|
||||
arguments: M.args.map(to_moz),
|
||||
optional: M.optional,
|
||||
pure: M.pure,
|
||||
};
|
||||
});
|
||||
|
||||
def_to_moz(AST_DefClass, function To_Moz_ClassDeclaration(M) {
|
||||
return {
|
||||
type: "ClassDeclaration",
|
||||
@@ -767,6 +792,7 @@
|
||||
def_to_moz(AST_Directive, function To_Moz_Directive(M) {
|
||||
return {
|
||||
type: "ExpressionStatement",
|
||||
directive: M.value,
|
||||
expression: set_moz_loc(M, {
|
||||
type: "Literal",
|
||||
value: M.value,
|
||||
@@ -787,7 +813,6 @@
|
||||
type: "TryStatement",
|
||||
block: to_moz_block(M),
|
||||
handler: to_moz(M.bcatch),
|
||||
guardedHandlers: [],
|
||||
finalizer: to_moz(M.bfinally),
|
||||
};
|
||||
});
|
||||
@@ -796,7 +821,6 @@
|
||||
return {
|
||||
type: "CatchClause",
|
||||
param: to_moz(M.argname),
|
||||
guard: null,
|
||||
body: to_moz_block(M),
|
||||
};
|
||||
});
|
||||
@@ -805,6 +829,7 @@
|
||||
return {
|
||||
type: "ExportNamedDeclaration",
|
||||
declaration: to_moz(M.body),
|
||||
specifiers: [],
|
||||
};
|
||||
});
|
||||
|
||||
@@ -954,6 +979,8 @@
|
||||
type: "Property",
|
||||
kind: "init",
|
||||
computed: computed,
|
||||
method: false,
|
||||
shorthand: false,
|
||||
key: key,
|
||||
value: to_moz(M.value),
|
||||
};
|
||||
@@ -990,6 +1017,7 @@
|
||||
kind: kind,
|
||||
computed: computed,
|
||||
method: M instanceof AST_ObjectMethod,
|
||||
shorthand: false,
|
||||
key: key,
|
||||
value: to_moz(M.value),
|
||||
};
|
||||
@@ -1043,8 +1071,8 @@
|
||||
var value = M.value;
|
||||
return {
|
||||
type: "Literal",
|
||||
bigint: value.slice(0, -1),
|
||||
raw: value,
|
||||
bigint: value,
|
||||
raw: value + "n",
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user