Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jsexplain
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Verified Software
jsexplain
Commits
86851213
Commit
86851213
authored
9 years ago
by
Alan Schmitt
Committed by
Thomas Wood
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
alloc
parent
8e3cecaf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
interp.js
+8
-1
8 additions, 1 deletion
interp.js
with
8 additions
and
1 deletion
interp.js
+
8
−
1
View file @
86851213
...
...
@@ -445,6 +445,10 @@ function trm_get(line, loc, field) {
return
{
tag
:
"
trm_get
"
,
loc
:
loc
,
field
:
field
,
line
:
line
};
}
function
trm_alloc
(
line
)
{
return
{
tag
:
"
trm_alloc
"
,
line
:
line
};
}
//----------------demo---------------
var
trm1
=
...
...
@@ -552,7 +556,10 @@ function esprimaExprToAST(expr) {
if
(
!
isNumeric
(
value
))
throw
(
"
Literal not a number:
"
+
value
);
return
trm_number
(
expr
.
loc
.
start
.
line
,
expr
.
value
);
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
"
:
if
(
expr
.
operator
!==
"
=
"
)
throw
(
"
AssignmentExpression NI:
"
+
expr
.
operator
);
if
(
expr
.
left
.
type
!==
"
MemberExpression
"
)
throw
(
"
Expected MemberExpression
"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment