diff --git a/es2panda/ir/expressions/literals/regExpLiteral.cpp b/es2panda/ir/expressions/literals/regExpLiteral.cpp index b87cd4ab3d171f95b18398d67872720dad7d2da0..f20ab4c534363fc38fe37f36bd17c1bc23ecd157 100644 --- a/es2panda/ir/expressions/literals/regExpLiteral.cpp +++ b/es2panda/ir/expressions/literals/regExpLiteral.cpp @@ -56,7 +56,6 @@ void RegExpLiteral::Compile(compiler::PandaGen *pg) const checker::Type *RegExpLiteral::Check(checker::Checker *checker) const { - // TODO(aszilagyi); return checker->GlobalAnyType(); } diff --git a/es2panda/lexer/lexer.cpp b/es2panda/lexer/lexer.cpp index bd7b785c80efc946ffc5b6569a8778a06e49913a..529ddea26aacbabb680c8d6389fcdec4e56e3ba3 100644 --- a/es2panda/lexer/lexer.cpp +++ b/es2panda/lexer/lexer.cpp @@ -249,6 +249,8 @@ void Lexer::ScanNumberLeadingZero() case LEX_CHAR_8: case LEX_CHAR_9: { ThrowError("Invalid octal digit"); + + [[fallthrough]]; } default: { break; diff --git a/es2panda/parser/expressionParser.cpp b/es2panda/parser/expressionParser.cpp index ed568b4c8088f78bf68573b26226ddce14b2a567..6058ff530c779720f79c4ffc084c269bfae1ca5c 100644 --- a/es2panda/parser/expressionParser.cpp +++ b/es2panda/parser/expressionParser.cpp @@ -616,7 +616,6 @@ ir::Expression *ParserImpl::ParseCoverParenthesizedExpressionAndArrowParameterLi if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_ARROW) { lexer_->Rewind(startPos); return expr; - // ThrowSyntaxError("'=>' expected."); } return ParseArrowFunctionExpression(expr, nullptr, returnTypeAnnotation, false); diff --git a/es2panda/parser/statementParser.cpp b/es2panda/parser/statementParser.cpp index 1768922cea834796c89dc5d592a864884f6be1ba..f5c91da85a77b1dcf5a77cb39653875b12fee37d 100644 --- a/es2panda/parser/statementParser.cpp +++ b/es2panda/parser/statementParser.cpp @@ -132,6 +132,8 @@ bool ParserImpl::IsLabelFollowedByIterationStatement() lexer_->NextToken(); return IsLabelFollowedByIterationStatement(); } + + [[fallthrough]]; } default: return false; diff --git a/es2panda/scripts/gen_isa.sh b/es2panda/scripts/gen_isa.sh index 28ab703f1b0856e7efe47de9712beceff7e0d30c..28a7938f7ddf95a0b741db822d3660f873c6d990 100755 --- a/es2panda/scripts/gen_isa.sh +++ b/es2panda/scripts/gen_isa.sh @@ -45,7 +45,7 @@ do esac done -if [ ! -d ${OUTDIR} ]; then +if [ ! -d "${OUTDIR}" ]; then mkdir -p ${OUTDIR} fi echo "${GENERATOR} --template ${TEMPLATE} --data ${DATA} --output ${OUTDIR}/${OUTPUT} --require ${REQUIRE}" diff --git a/es2panda/scripts/gen_keywords.sh b/es2panda/scripts/gen_keywords.sh index 43f4069f464845de95f1f72ed85e44f8e22c908f..5fd915a4466c80cc38ec32833e5f76f25aff7b14 100755 --- a/es2panda/scripts/gen_keywords.sh +++ b/es2panda/scripts/gen_keywords.sh @@ -39,7 +39,7 @@ do esac done -if [ ! -d ${OUTDIR} ]; then +if [ ! -d "${OUTDIR}" ]; then mkdir -p ${OUTDIR} fi diff --git a/es2panda/test/runner.py b/es2panda/test/runner.py index 1920314b7388b9316f20e508c6b84a4fc42ebb0f..ea03d3ac80b9a294c181c938b567682d2a7d1761 100755 --- a/es2panda/test/runner.py +++ b/es2panda/test/runner.py @@ -222,7 +222,7 @@ class Test262Test(Test): cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=runner.cmd_env) try: - out, err = process.communicate(runner.args.es2panda_timeout) + output_res, err = process.communicate(runner.args.es2panda_timeout) except subprocess.TimeoutExpired: process.kill() self.passed = False @@ -230,7 +230,7 @@ class Test262Test(Test): self.error = self.fail_kind.name return self - out = out.decode("utf-8", errors="ignore") + out = output_res.decode("utf-8", errors="ignore") err = err.decode("utf-8", errors="ignore") self.passed, need_exec = runner.util.validate_parse_result( process.returncode, err, desc, out) @@ -742,8 +742,6 @@ class TSCRunner(Runner): files = glob(glob_expression, recursive=True) files = fnmatch.filter(files, ts_suite_dir + '**' + self.args.filter) - failed_references = open(path.join(self.test_root, 'test_tsc_ignore_list.txt'), 'r').read() - for f in files: test_name = path.basename(f.split(".ts")[0]) negative_references = path.join( @@ -763,9 +761,10 @@ class TSCRunner(Runner): if is_negative or "filename" in test.options: continue - if self.args.skip: - if path.relpath(f, self.tsc_path) in failed_references: - continue + with open(path.join(self.test_root, 'test_tsc_ignore_list.txt'), 'r') as failed_references: + if self.args.skip: + if path.relpath(f, self.tsc_path) in failed_references.read(): + continue self.tests.append(test) diff --git a/es2panda/util/base64.cpp b/es2panda/util/base64.cpp index 2e691df23482a80963060715f7af1b2e1ad927d1..d727917242d235fd4f1417e87d6193930d076a9a 100644 --- a/es2panda/util/base64.cpp +++ b/es2panda/util/base64.cpp @@ -77,7 +77,10 @@ std::string Base64Decode(const std::string &base64String) decodedStrLen -= std::string("=").length(); } std::string decodedRes = std::string(decodedStrLen, '\0'); - int firstChar, secondChar, thirdChar, fourthChar = 0; + int firstChar = 0; + int secondChar = 0; + int thirdChar = 0; + int fourthChar = 0; for (size_t i = 0, j = 0; i < strLen - 2; i += TRANSFORMED_CHAR_NUM, j += TO_TRANSFORM_CHAR_NUM) { firstChar = decodeTable[static_cast(base64String[i])]; secondChar = decodeTable[static_cast(base64String[i + 1])]; diff --git a/es2panda/util/concurrent.cpp b/es2panda/util/concurrent.cpp index d6959c30ed36e677d6db6dc487c31bbc53b40941..3b5e953e1c87d9e3750bec6a49cfbdb414ae6056 100644 --- a/es2panda/util/concurrent.cpp +++ b/es2panda/util/concurrent.cpp @@ -97,7 +97,7 @@ void Concurrent::ThrowInvalidConcurrentFunction(const lexer::LineIndex &lineInde } void Concurrent::VerifyImportVarForConcurrentFunction(const lexer::LineIndex &lineIndex, const ir::AstNode *node, - const binder::ScopeFindResult &result) + const binder::ScopeFindResult &result) { if (!result.crossConcurrent) { return; diff --git a/test262/run_sunspider.py b/test262/run_sunspider.py index ce5bce355502f8bd3063a2cfa6b576de7c8660ca..949ecd3f17383343a1870af5d7d4c235c82da213 100755 --- a/test262/run_sunspider.py +++ b/test262/run_sunspider.py @@ -128,7 +128,7 @@ def exec_command(cmd_args, timeout=DEFAULT_TIMEOUT): code_format = 'gbk' try: - (msg, errs) = proc.communicate(timeout=timeout) + (output_res, errs) = proc.communicate(timeout=timeout) ret_code = proc.poll() if errs.decode(code_format, 'ignore') != '': @@ -141,7 +141,7 @@ def exec_command(cmd_args, timeout=DEFAULT_TIMEOUT): msg += f"error: {str(errs.decode(code_format,'ignore'))}" else: code = 0 - msg = str(msg.decode(code_format, 'ignore')) + msg = str(output_res.decode(code_format, 'ignore')) except subprocess.TimeoutExpired: proc.kill()