Skip to content
Snippets Groups Projects
Commit 86851213 authored by Alan Schmitt's avatar Alan Schmitt Committed by Thomas Wood
Browse files

alloc

parent 8e3cecaf
Branches
No related tags found
No related merge requests found
...@@ -445,6 +445,10 @@ function trm_get(line, loc, field) { ...@@ -445,6 +445,10 @@ function trm_get(line, loc, field) {
return {tag: "trm_get", loc: loc, field: field, line: line}; return {tag: "trm_get", loc: loc, field: field, line: line};
} }
function trm_alloc(line) {
return {tag: "trm_alloc", line: line};
}
//----------------demo--------------- //----------------demo---------------
var trm1 = var trm1 =
...@@ -552,7 +556,10 @@ function esprimaExprToAST(expr) { ...@@ -552,7 +556,10 @@ function esprimaExprToAST(expr) {
if (!isNumeric(value)) throw ("Literal not a number: " + value); if (!isNumeric(value)) throw ("Literal not a number: " + value);
return trm_number(expr.loc.start.line, expr.value); return trm_number(expr.loc.start.line, expr.value);
case "Identifier": case "Identifier":
return trm_var(expr.loc.start.line, expr.name); switch (expr.name) {
case "alloc": return trm_alloc(expr.loc.start.line);
default: return trm_var(expr.loc.start.line, expr.name);
}
case "AssignmentExpression": case "AssignmentExpression":
if (expr.operator !== "=") throw ("AssignmentExpression NI: " + expr.operator); if (expr.operator !== "=") throw ("AssignmentExpression NI: " + expr.operator);
if (expr.left.type !== "MemberExpression") throw ("Expected MemberExpression"); if (expr.left.type !== "MemberExpression") throw ("Expected MemberExpression");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment