From fafe7cd1356f485445590f3f1563079f4bce904d Mon Sep 17 00:00:00 2001 From: Malinin Andrey Date: Tue, 19 Dec 2023 16:38:03 +0300 Subject: [PATCH] Fixing checked files Issue: I8WCNH Testing: CI Signed-off-by: Malinin Andrey --- ets2panda/checker/ets/helpers.cpp | 2 ++ ets2panda/checker/ts/destructuringContext.h | 2 +- ets2panda/compiler/core/ETSGen.h | 6 +++--- ets2panda/compiler/core/ETSemitter.h | 2 +- ets2panda/compiler/core/JSemitter.h | 2 +- ets2panda/compiler/core/emitter.h | 2 +- ets2panda/ir/ts/tsTupleType.cpp | 2 +- ets2panda/lexer/lexer.cpp | 2 -- ets2panda/parser/ETSparser.cpp | 3 ++- ets2panda/parser/TypedParser.h | 2 +- ets2panda/parser/parserImpl.cpp | 4 ++-- ets2panda/parser/parserImpl.h | 4 ++-- ets2panda/parser/statementParser.cpp | 2 +- ets2panda/varbinder/ASBinder.h | 2 +- ets2panda/varbinder/ETSBinder.h | 2 +- ets2panda/varbinder/JSBinder.h | 2 +- ets2panda/varbinder/TSBinder.h | 2 +- ets2panda/varbinder/TypedBinder.h | 2 +- ets2panda/varbinder/varbinder.h | 2 +- 19 files changed, 24 insertions(+), 23 deletions(-) diff --git a/ets2panda/checker/ets/helpers.cpp b/ets2panda/checker/ets/helpers.cpp index 41e52fafab..ea259c04ec 100644 --- a/ets2panda/checker/ets/helpers.cpp +++ b/ets2panda/checker/ets/helpers.cpp @@ -2110,6 +2110,7 @@ void ETSChecker::CheckUnboxedTypesAssignable(TypeRelation *relation, Type *sourc void ETSChecker::CheckBoxedSourceTypeAssignable(TypeRelation *relation, Type *source, Type *target) { + ASSERT(relation != nullptr); checker::SavedTypeRelationFlagsContext savedTypeRelationFlagCtx( relation, (relation->ApplyWidening() ? TypeRelationFlag::WIDENING : TypeRelationFlag::NONE) | (relation->ApplyNarrowing() ? TypeRelationFlag::NARROWING : TypeRelationFlag::NONE)); @@ -2117,6 +2118,7 @@ void ETSChecker::CheckBoxedSourceTypeAssignable(TypeRelation *relation, Type *so if (boxedSourceType == nullptr) { return; } + ASSERT(target != nullptr); // Do not box primitive in case of cast to dynamic types if (target->IsETSDynamicType()) { return; diff --git a/ets2panda/checker/ts/destructuringContext.h b/ets2panda/checker/ts/destructuringContext.h index 173e299549..54e8212bcd 100644 --- a/ets2panda/checker/ts/destructuringContext.h +++ b/ets2panda/checker/ts/destructuringContext.h @@ -61,7 +61,7 @@ public: DEFAULT_COPY_SEMANTIC(DestructuringContext); DEFAULT_MOVE_SEMANTIC(DestructuringContext); - ~DestructuringContext() = default; + virtual ~DestructuringContext() = default; virtual void Start() = 0; virtual void ValidateInferredType() = 0; diff --git a/ets2panda/compiler/core/ETSGen.h b/ets2panda/compiler/core/ETSGen.h index b1c5907351..30a35943e6 100644 --- a/ets2panda/compiler/core/ETSGen.h +++ b/ets2panda/compiler/core/ETSGen.h @@ -70,14 +70,14 @@ public: void LoadProperty(const ir::AstNode *node, const checker::Type *propType, VReg objReg, const util::StringView &fullName); void StorePropertyDynamic(const ir::AstNode *node, const checker::Type *propType, VReg objReg, - const util::StringView &name); + const util::StringView &propName); void LoadPropertyDynamic(const ir::AstNode *node, const checker::Type *propType, VReg objReg, const util::StringView &propName); void StoreElementDynamic(const ir::AstNode *node, VReg objectReg, VReg index); void LoadElementDynamic(const ir::AstNode *node, VReg objectReg); - void StoreUnionProperty(const ir::AstNode *node, VReg objReg, const util::StringView &name); + void StoreUnionProperty(const ir::AstNode *node, VReg objReg, const util::StringView &propName); void LoadUnionProperty(const ir::AstNode *node, const checker::Type *propType, VReg objReg, const util::StringView &propName); @@ -435,7 +435,7 @@ public: void EmitLocalBoxCtor(ir::AstNode const *node); void EmitLocalBoxGet(ir::AstNode const *node, checker::Type const *contentType); - void EmitLocalBoxSet(ir::AstNode const *node, varbinder::LocalVariable *lhs); + void EmitLocalBoxSet(ir::AstNode const *node, varbinder::LocalVariable *lhsVar); void LoadArrayLength(const ir::AstNode *node, VReg arrayReg); void LoadArrayElement(const ir::AstNode *node, VReg objectReg); diff --git a/ets2panda/compiler/core/ETSemitter.h b/ets2panda/compiler/core/ETSemitter.h index 57e2414817..4bd7331acd 100644 --- a/ets2panda/compiler/core/ETSemitter.h +++ b/ets2panda/compiler/core/ETSemitter.h @@ -44,7 +44,7 @@ namespace panda::es2panda::compiler { class ETSFunctionEmitter : public FunctionEmitter { public: ETSFunctionEmitter(const CodeGen *cg, ProgramElement *programElement) : FunctionEmitter(cg, programElement) {} - ~ETSFunctionEmitter() = default; + ~ETSFunctionEmitter() override = default; NO_COPY_SEMANTIC(ETSFunctionEmitter); NO_MOVE_SEMANTIC(ETSFunctionEmitter); diff --git a/ets2panda/compiler/core/JSemitter.h b/ets2panda/compiler/core/JSemitter.h index 2125a200af..41b886e3d5 100644 --- a/ets2panda/compiler/core/JSemitter.h +++ b/ets2panda/compiler/core/JSemitter.h @@ -23,7 +23,7 @@ namespace panda::es2panda::compiler { class JSFunctionEmitter : public FunctionEmitter { public: JSFunctionEmitter(const CodeGen *cg, ProgramElement *programElement) : FunctionEmitter(cg, programElement) {} - ~JSFunctionEmitter() = default; + ~JSFunctionEmitter() override = default; NO_COPY_SEMANTIC(JSFunctionEmitter); NO_MOVE_SEMANTIC(JSFunctionEmitter); diff --git a/ets2panda/compiler/core/emitter.h b/ets2panda/compiler/core/emitter.h index 8df8b5350d..caab8673b8 100644 --- a/ets2panda/compiler/core/emitter.h +++ b/ets2panda/compiler/core/emitter.h @@ -56,7 +56,7 @@ public: { } - ~FunctionEmitter() = default; + virtual ~FunctionEmitter() = default; NO_COPY_SEMANTIC(FunctionEmitter); NO_MOVE_SEMANTIC(FunctionEmitter); diff --git a/ets2panda/ir/ts/tsTupleType.cpp b/ets2panda/ir/ts/tsTupleType.cpp index ee4fca861c..78f59f91f5 100644 --- a/ets2panda/ir/ts/tsTupleType.cpp +++ b/ets2panda/ir/ts/tsTupleType.cpp @@ -80,7 +80,7 @@ checker::Type *TSTupleType::GetType(checker::TSChecker *checker) auto *memberVar = varbinder::Scope::CreateVar(checker->Allocator(), memberIndex, varbinder::VariableFlags::PROPERTY, it); - checker::ElementFlags memberFlag = checker::ElementFlags::NO_OPTS; + checker::ElementFlags memberFlag; if (it->IsTSNamedTupleMember()) { auto *namedMember = it->AsTSNamedTupleMember(); checker::Type *memberType = namedMember->ElementType()->GetType(checker); diff --git a/ets2panda/lexer/lexer.cpp b/ets2panda/lexer/lexer.cpp index f92fdbe968..4eb224ad80 100644 --- a/ets2panda/lexer/lexer.cpp +++ b/ets2panda/lexer/lexer.cpp @@ -154,7 +154,6 @@ void Lexer::SkipMultiLineComment() switch (Iterator().Next()) { case util::StringView::Iterator::INVALID_CP: { ThrowError("Unterminated multi-line comment"); - break; } case LEX_CHAR_LF: case LEX_CHAR_CR: @@ -1010,7 +1009,6 @@ void Lexer::ScanRegExpPattern() case LEX_CHAR_LS: case LEX_CHAR_PS: { ThrowError("Unterminated RegExp"); - break; } case LEX_CHAR_SLASH: { if (!isCharClass) { diff --git a/ets2panda/parser/ETSparser.cpp b/ets2panda/parser/ETSparser.cpp index b91b25f816..4b53c06dc3 100644 --- a/ets2panda/parser/ETSparser.cpp +++ b/ets2panda/parser/ETSparser.cpp @@ -1205,7 +1205,7 @@ ir::ModifierFlags ETSParser::ParseClassFieldModifiers(bool seenStatic) return flags; } - ir::ModifierFlags currentFlag = ir::ModifierFlags::NONE; + ir::ModifierFlags currentFlag; lexer::TokenFlags tokenFlags = Lexer()->GetToken().Flags(); if ((tokenFlags & lexer::TokenFlags::HAS_ESCAPE) != 0) { @@ -3206,6 +3206,7 @@ std::tuple> ETSParser::ParseFromCla auto *importSource = Allocator()->New(source, resolvedSource, importData.lang, importData.hasDecl, module); + ASSERT(importSource != nullptr); return {importSource, userPaths}; } diff --git a/ets2panda/parser/TypedParser.h b/ets2panda/parser/TypedParser.h index fc04ce492f..e3fc4fe32d 100644 --- a/ets2panda/parser/TypedParser.h +++ b/ets2panda/parser/TypedParser.h @@ -71,7 +71,7 @@ protected: ir::ModifierFlags ParseModifiers() override; ParserStatus ValidateArrowParameter(ir::Expression *expr, bool *seenOptional) override; - ir::Expression *ParsePotentialAsExpression(ir::Expression *primaryExpr) override; + ir::Expression *ParsePotentialAsExpression(ir::Expression *primaryExpression) override; std::tuple ParseSuperClass() override; ir::Expression *ParseSuperClassReference() override; diff --git a/ets2panda/parser/parserImpl.cpp b/ets2panda/parser/parserImpl.cpp index 5f4d6b623c..38d29e24bf 100644 --- a/ets2panda/parser/parserImpl.cpp +++ b/ets2panda/parser/parserImpl.cpp @@ -240,8 +240,8 @@ void ParserImpl::CheckAccessorPair(const ArenaVector &properties, continue; } - ir::ModifierFlags getAccess = ir::ModifierFlags::NONE; - ir::ModifierFlags setAccess = ir::ModifierFlags::NONE; + ir::ModifierFlags getAccess; + ir::ModifierFlags setAccess; if (methodKind == ir::MethodDefinitionKind::GET) { setAccess = access; diff --git a/ets2panda/parser/parserImpl.h b/ets2panda/parser/parserImpl.h index 7939cd0fcf..5f25ec509f 100644 --- a/ets2panda/parser/parserImpl.h +++ b/ets2panda/parser/parserImpl.h @@ -318,7 +318,7 @@ protected: ArrowFunctionDescriptor *desc, ir::TSTypeParameterDeclaration *typeParamDecl, ir::TypeNode *returnTypeAnnotation); - ir::Expression *ParseAssignmentExpression(ir::Expression *expression, + ir::Expression *ParseAssignmentExpression(ir::Expression *lhsExpression, ExpressionParseFlags flags = ExpressionParseFlags::NO_OPTS); ir::SequenceExpression *ParseSequenceExpression(ir::Expression *startExpr, bool acceptRest = false); ir::FunctionExpression *ParseFunctionExpression(ParserStatus newStatus = ParserStatus::NO_OPTS); @@ -434,7 +434,7 @@ protected: const lexer::SourcePosition &startLoc); virtual bool ParsePotentialGenericFunctionCall(ir::Expression *primaryExpr, ir::Expression **returnExpression, const lexer::SourcePosition &startLoc, bool ignoreCallExpression); - virtual ir::Expression *ParsePotentialAsExpression(ir::Expression *primaryExpr); + virtual ir::Expression *ParsePotentialAsExpression(ir::Expression *primaryExpression); virtual bool IsNamedFunctionExpression(); virtual ir::Identifier *ParsePrimaryExpressionIdent(ExpressionParseFlags flags); virtual void ValidateArrowFunctionRestParameter(ir::SpreadElement *restElement); diff --git a/ets2panda/parser/statementParser.cpp b/ets2panda/parser/statementParser.cpp index e56be215f7..a206523b8e 100644 --- a/ets2panda/parser/statementParser.cpp +++ b/ets2panda/parser/statementParser.cpp @@ -958,7 +958,7 @@ void ParserImpl::ThrowIfBodyEmptyError([[maybe_unused]] ir::Statement *consequen ir::IfStatement *ParserImpl::ParseIfStatement() { lexer::SourcePosition startLoc = lexer_->GetToken().Start(); - lexer::SourcePosition endLoc = lexer_->GetToken().End(); + lexer::SourcePosition endLoc; lexer_->NextToken(); if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS) { diff --git a/ets2panda/varbinder/ASBinder.h b/ets2panda/varbinder/ASBinder.h index b23e59db4c..353dc6477f 100644 --- a/ets2panda/varbinder/ASBinder.h +++ b/ets2panda/varbinder/ASBinder.h @@ -25,7 +25,7 @@ public: NO_COPY_SEMANTIC(ASBinder); NO_MOVE_SEMANTIC(ASBinder); - ~ASBinder() = default; + ~ASBinder() override = default; ScriptExtension Extension() const override { diff --git a/ets2panda/varbinder/ETSBinder.h b/ets2panda/varbinder/ETSBinder.h index edd27f9a43..6aafed14e8 100644 --- a/ets2panda/varbinder/ETSBinder.h +++ b/ets2panda/varbinder/ETSBinder.h @@ -53,7 +53,7 @@ public: NO_COPY_SEMANTIC(ETSBinder); NO_MOVE_SEMANTIC(ETSBinder); - ~ETSBinder() = default; + ~ETSBinder() override = default; ScriptExtension Extension() const override { diff --git a/ets2panda/varbinder/JSBinder.h b/ets2panda/varbinder/JSBinder.h index 0b94c31ee0..2af139b054 100644 --- a/ets2panda/varbinder/JSBinder.h +++ b/ets2panda/varbinder/JSBinder.h @@ -25,7 +25,7 @@ public: NO_COPY_SEMANTIC(JSBinder); NO_MOVE_SEMANTIC(JSBinder); - ~JSBinder() = default; + ~JSBinder() override = default; private: }; diff --git a/ets2panda/varbinder/TSBinder.h b/ets2panda/varbinder/TSBinder.h index 943a515a27..7547201f58 100644 --- a/ets2panda/varbinder/TSBinder.h +++ b/ets2panda/varbinder/TSBinder.h @@ -25,7 +25,7 @@ public: NO_COPY_SEMANTIC(TSBinder); NO_MOVE_SEMANTIC(TSBinder); - ~TSBinder() = default; + ~TSBinder() override = default; ScriptExtension Extension() const override { diff --git a/ets2panda/varbinder/TypedBinder.h b/ets2panda/varbinder/TypedBinder.h index 3aab5faddb..b294d63945 100644 --- a/ets2panda/varbinder/TypedBinder.h +++ b/ets2panda/varbinder/TypedBinder.h @@ -25,7 +25,7 @@ public: NO_COPY_SEMANTIC(TypedBinder); NO_MOVE_SEMANTIC(TypedBinder); - ~TypedBinder() = default; + ~TypedBinder() override = default; protected: void HandleCustomNodes(ir::AstNode *childNode) override; diff --git a/ets2panda/varbinder/varbinder.h b/ets2panda/varbinder/varbinder.h index 48aa8c7166..e2e6f01e23 100644 --- a/ets2panda/varbinder/varbinder.h +++ b/ets2panda/varbinder/varbinder.h @@ -52,7 +52,7 @@ public: NO_COPY_SEMANTIC(VarBinder); NO_MOVE_SEMANTIC(VarBinder); - ~VarBinder() = default; + virtual ~VarBinder() = default; void InitTopScope(); virtual void IdentifierAnalysis(); -- Gitee