[Pkg-javascript-commits] [node-acorn-jsx] 337/484: Loose: yield support.
Bastien Roucariès
rouca at moszumanska.debian.org
Sat Aug 19 14:20:52 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-acorn-jsx.
commit 1589a959fad68bf9719ea4309a6c46d1192cb8e6
Author: Ingvar Stepanyan <me at rreverser.com>
Date: Mon Oct 27 02:37:27 2014 +0200
Loose: yield support.
---
acorn_loose.js | 14 +++++++++++++-
test/run.js | 5 +++--
test/tests-harmony.js | 3 +++
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/acorn_loose.js b/acorn_loose.js
index ec2c44b..8a75e3d 100644
--- a/acorn_loose.js
+++ b/acorn_loose.js
@@ -271,7 +271,7 @@
return (token.type === tt.eof || token.type === tt.braceR || newline.test(input.slice(lastEnd, token.start)));
}
function semicolon() {
- eat(tt.semi);
+ return eat(tt.semi);
}
function expect(type) {
@@ -734,6 +734,18 @@
case tt._new:
return parseNew();
+ case tt._yield:
+ var node = startNode();
+ next();
+ if (semicolon() || canInsertSemicolon()) {
+ node.delegate = false;
+ node.argument = null;
+ } else {
+ node.delegate = eat(tt.star);
+ node.argument = parseExpression(true);
+ }
+ return finishNode(node, "YieldExpression");
+
default:
return dummyIdent();
}
diff --git a/test/run.js b/test/run.js
index adc5eb9..04001c3 100644
--- a/test/run.js
+++ b/test/run.js
@@ -13,8 +13,9 @@ var stats, modes = {
parse: (typeof require === "undefined") ? window.acorn_loose : require("../acorn_loose").parse_dammit,
loose: true,
filter: function (test) {
- var ecmaVersion = (test.options || {}).ecmaVersion || 5;
- return ecmaVersion <= 6;
+ var opts = test.options || {};
+ if (opts.loose === false) return false;
+ return (opts.ecmaVersion || 5) <= 6;
}
}
}
diff --git a/test/tests-harmony.js b/test/tests-harmony.js
index 2302f58..84cf2be 100644
--- a/test/tests-harmony.js
+++ b/test/tests-harmony.js
@@ -13714,6 +13714,7 @@ test("yield* 10", {
}
}, {
ecmaVersion: 6,
+ loose: false,
ranges: true,
locations: true
});
@@ -13778,6 +13779,7 @@ test("e => yield* 10", {
}
}, {
ecmaVersion: 6,
+ loose: false,
ranges: true,
locations: true
});
@@ -13851,6 +13853,7 @@ test("(function () { yield* 10 })", {
}
}, {
ecmaVersion: 6,
+ loose: false,
ranges: true,
locations: true
});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git
More information about the Pkg-javascript-commits
mailing list