From f008fc38edc090408a141a34fc66b1dcbe06d224 Mon Sep 17 00:00:00 2001 From: Koji Takami Date: Sat, 23 Jan 2021 14:06:07 +0900 Subject: [PATCH] Modify to pass tests with nodejs 10 as well --- sample/calc.js | 4 ++-- test/language.test.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sample/calc.js b/sample/calc.js index 0a3c8b8..e3777f4 100644 --- a/sample/calc.js +++ b/sample/calc.js @@ -21,7 +21,7 @@ const calc = new Language([ */ (term) => { // get no whitespace tokens - const terms = term.contents().flat(); + const terms = [].concat(...term.contents()); let acc = terms[0]; for(let i = 1; i < terms.length; i += 2) { const ope = terms[i]; @@ -48,7 +48,7 @@ const calc = new Language([ ["unary-expression", "multiplicative-expression-rest*"], ], (term) => { - const terms = term.contents().flat(); + const terms = [].concat(...term.contents()); let acc = terms[0]; for(let i = 1; i < terms.length; i += 2) { const ope = terms[i]; diff --git a/test/language.test.js b/test/language.test.js index 9d7cdf6..f34f7d6 100644 --- a/test/language.test.js +++ b/test/language.test.js @@ -68,7 +68,7 @@ describe("Language", () => { [["integer-constant", "additive-expression-rest*"]], (term) => { debug(`additive-expression.term: ${JSON.stringify(term, null, 2)}`); - const terms = term.contents().flat(); + const terms = [].concat(...term.contents()); debug(`additive-expression.terms: ${JSON.stringify(terms, null, 2)}`); let acc = terms[0]; for(let i = 1; i < terms.length; i += 2) {