diff --git a/es2panda/compiler/core/compileQueue.h b/es2panda/compiler/core/compileQueue.h index 17392fe4a0409a48bc24a12994872b7ce6320a29..fe1f0da29090b54ee92606849af43b87edb76d36 100644 --- a/es2panda/compiler/core/compileQueue.h +++ b/es2panda/compiler/core/compileQueue.h @@ -55,7 +55,7 @@ public: explicit CompileFunctionJob(CompilerContext *context) : context_(context) {}; NO_COPY_SEMANTIC(CompileFunctionJob); NO_MOVE_SEMANTIC(CompileFunctionJob); - ~CompileFunctionJob() = default; + ~CompileFunctionJob() override = default; binder::FunctionScope *Scope() const { @@ -79,7 +79,7 @@ public: explicit CompileModuleRecordJob(CompilerContext *context) : context_(context) {}; NO_COPY_SEMANTIC(CompileModuleRecordJob); NO_MOVE_SEMANTIC(CompileModuleRecordJob); - ~CompileModuleRecordJob() = default; + ~CompileModuleRecordJob() override = default; void Run() override; @@ -95,7 +95,7 @@ public: : src_(src), options_(options), progsInfo_(progsInfo), symbolTable_(symbolTable), allocator_(allocator) {}; NO_COPY_SEMANTIC(CompileFileJob); NO_MOVE_SEMANTIC(CompileFileJob); - ~CompileFileJob() = default; + ~CompileFileJob() override = default; void Run() override; @@ -140,7 +140,7 @@ public: NO_COPY_SEMANTIC(CompileFuncQueue); NO_MOVE_SEMANTIC(CompileFuncQueue); - ~CompileFuncQueue() = default; + ~CompileFuncQueue() override = default; void Schedule() override; @@ -158,7 +158,7 @@ public: NO_COPY_SEMANTIC(CompileFileQueue); NO_MOVE_SEMANTIC(CompileFileQueue); - ~CompileFileQueue() = default; + ~CompileFileQueue() override = default; void Schedule() override; diff --git a/es2panda/es2panda.h b/es2panda/es2panda.h index c6144e2e6f206a8f12ef4ec9645837983010b2d5..9478bef35b46d061d4ebd384724734bc8c3ca86c 100644 --- a/es2panda/es2panda.h +++ b/es2panda/es2panda.h @@ -163,7 +163,7 @@ public: panda::pandasm::Program *Compile(const SourceFile &input, const CompilerOptions &options, util::SymbolTable *symbolTable = nullptr); - panda::pandasm::Program *CompileFile(CompilerOptions &options, SourceFile *src, util::SymbolTable *symbolTable_); + panda::pandasm::Program *CompileFile(CompilerOptions &options, SourceFile *src, util::SymbolTable *symbolTable); static int CompileFiles(CompilerOptions &options, std::map *cacheProgs, diff --git a/es2panda/parser/parserImpl.h b/es2panda/parser/parserImpl.h index 974a6a0baae91075adc06a9ce7e142d033afa6d5..ff4a6e6653321ab3128c1ae9b90af73c58ce13dd 100644 --- a/es2panda/parser/parserImpl.h +++ b/es2panda/parser/parserImpl.h @@ -282,7 +282,7 @@ private: ir::Statement *ParseClassProperty(ClassElmentDescriptor *desc, const ArenaVector &properties, ir::Expression *propName, ir::Expression *typeAnnotation, ArenaVector &&decorators, bool isDeclare); - void ParseClassKeyModifiers(ClassElmentDescriptor *descy); + void ParseClassKeyModifiers(ClassElmentDescriptor *desc); void CheckClassGeneratorMethod(ClassElmentDescriptor *desc); void CheckClassPrivateIdentifier(ClassElmentDescriptor *desc); ir::Expression *ParseClassKeyAnnotation(); diff --git a/es2panda/util/symbolTable.h b/es2panda/util/symbolTable.h index 518a1c7142162fa99af0d6ad533ad0d1df10b6c9..863f71f1770f161023c86f5fa92d676a96dc047a 100644 --- a/es2panda/util/symbolTable.h +++ b/es2panda/util/symbolTable.h @@ -33,8 +33,8 @@ public: ArenaMap> lexenv; // lexenv: > ArenaMap classHash; - OriginFunctionInfo(ArenaAllocator *allocator) : lexenv(allocator->Adapter()), - classHash(allocator->Adapter()) {} + explicit OriginFunctionInfo(ArenaAllocator *allocator) : lexenv(allocator->Adapter()), + classHash(allocator->Adapter()) {} }; SymbolTable(const std::string &inputSymbolTable, const std::string &dumpSymbolTable) diff --git a/ts2panda/ts2abc/main.cpp b/ts2panda/ts2abc/main.cpp index c2840600589426893f349ab34431cb1ae148d18f..3968658c842e5f9ce7a9649115aaeaa08207a25e 100644 --- a/ts2panda/ts2abc/main.cpp +++ b/ts2panda/ts2abc/main.cpp @@ -20,33 +20,35 @@ #include "ts2abc_options.h" #include "ts2abc.h" -int Preprocess(const panda::ts2abc::Options &options, const panda::PandArgParser &argParser, std::string &output, - std::string &data, const std::string &usage) -{ - std::string input; - if (!options.GetCompileByPipeArg()) { - input = options.GetTailArg1(); - output = options.GetTailArg2(); - if (input.empty() || output.empty()) { - std::cerr << "Incorrect args number" << std::endl; - std::cerr << "Usage example: ts2abc test.json test.abc"<< std::endl; - std::cerr << usage << std::endl; - std::cerr << argParser.GetHelpString(); - return panda::ts2abc::RETURN_FAILED; - } +namespace { + int Preprocess(const panda::ts2abc::Options &options, const panda::PandArgParser &argParser, std::string &output, + std::string &data, const std::string &usage) + { + std::string input; + if (!options.GetCompileByPipeArg()) { + input = options.GetTailArg1(); + output = options.GetTailArg2(); + if (input.empty() || output.empty()) { + std::cerr << "Incorrect args number" << std::endl; + std::cerr << "Usage example: ts2abc test.json test.abc"<< std::endl; + std::cerr << usage << std::endl; + std::cerr << argParser.GetHelpString(); + return panda::ts2abc::RETURN_FAILED; + } - if (!panda::ts2abc::HandleJsonFile(input, data)) { - return panda::ts2abc::RETURN_FAILED; - } - } else { - output = options.GetTailArg1(); - if (output.empty()) { - std::cerr << usage << std::endl; - std::cerr << argParser.GetHelpString(); - return panda::ts2abc::RETURN_FAILED; + if (!panda::ts2abc::HandleJsonFile(input, data)) { + return panda::ts2abc::RETURN_FAILED; + } + } else { + output = options.GetTailArg1(); + if (output.empty()) { + std::cerr << usage << std::endl; + std::cerr << argParser.GetHelpString(); + return panda::ts2abc::RETURN_FAILED; + } } + return panda::ts2abc::RETURN_SUCCESS; } - return panda::ts2abc::RETURN_SUCCESS; } int main(int argc, const char *argv[])