diff --git a/ets2panda/checker/ets/helpers.cpp b/ets2panda/checker/ets/helpers.cpp index d8d087c094a6d0bf5616b26a292be822ed695d17..88620a91bbf80da96807dcb6800414b20f4bec39 100644 --- a/ets2panda/checker/ets/helpers.cpp +++ b/ets2panda/checker/ets/helpers.cpp @@ -2476,14 +2476,6 @@ util::StringView ETSChecker::GetHashFromFunctionType(ir::ETSFunctionType *type) ss << ";"; - if (type->IsThrowing()) { - ss << "throws;"; - } - - if (type->IsRethrowing()) { - ss << "rethrows;"; - } - return util::UString(ss.str(), ProgramAllocator()).View(); } diff --git a/ets2panda/checker/ets/typeCreation.cpp b/ets2panda/checker/ets/typeCreation.cpp index fda77242a88ff3eb169751f630e4ff9fa0055c92..725024a0bb166273d69a53172c882399ecd87aee 100644 --- a/ets2panda/checker/ets/typeCreation.cpp +++ b/ets2panda/checker/ets/typeCreation.cpp @@ -197,9 +197,6 @@ static SignatureFlags ConvertToSignatureFlags(ir::ModifierFlags inModifiers, ir: } }; - convertFlag(ir::ScriptFunctionFlags::THROWS, SignatureFlags::THROWS); - convertFlag(ir::ScriptFunctionFlags::RETHROWS, SignatureFlags::RETHROWS); - convertFlag(ir::ScriptFunctionFlags::CONSTRUCTOR, SignatureFlags::CONSTRUCTOR); convertFlag(ir::ScriptFunctionFlags::SETTER, SignatureFlags::SETTER); convertFlag(ir::ScriptFunctionFlags::GETTER, SignatureFlags::GETTER); diff --git a/ets2panda/checker/types/ets/etsFunctionType.cpp b/ets2panda/checker/types/ets/etsFunctionType.cpp index 0ec3b4ecaca3259907143dc8f1e7358d05407ff4..41871c1cfd930d8e8a336efdfcf1df9e62b8cd48 100644 --- a/ets2panda/checker/types/ets/etsFunctionType.cpp +++ b/ets2panda/checker/types/ets/etsFunctionType.cpp @@ -197,13 +197,6 @@ static Signature *EnhanceSignatureSubstitution(TypeRelation *relation, Signature return sub->Substitute(relation, &substitution); } -static uint8_t SignatureThrowKindToOrder(Signature *sig) -{ - return sig->HasSignatureFlag(SignatureFlags::THROWS) ? 0U - : sig->HasSignatureFlag(SignatureFlags::RETHROWS) ? 1U - : 2U; -} - static bool SignatureIsSupertypeOf(TypeRelation *relation, Signature *super, Signature *sub) { if (super->MinArgCount() < sub->MinArgCount()) { @@ -230,7 +223,7 @@ static bool SignatureIsSupertypeOf(TypeRelation *relation, Signature *super, Sig if (!relation->IsSupertypeOf(super->ReturnType(), sub->ReturnType())) { return false; } - return SignatureThrowKindToOrder(super) <= SignatureThrowKindToOrder(sub); + return true; } static ETSFunctionType *CoerceToArrowType(TypeRelation *relation, Type *type) diff --git a/ets2panda/checker/types/signature.cpp b/ets2panda/checker/types/signature.cpp index be45282d5f95b09d4a98d5cc6a18a04096a96d88..cac1b14a0ab7eb4859f09290a1fb79c208b37243 100644 --- a/ets2panda/checker/types/signature.cpp +++ b/ets2panda/checker/types/signature.cpp @@ -186,12 +186,6 @@ void Signature::ToString(std::stringstream &ss, const varbinder::Variable *varia } returnType_->ToString(ss, precise); - - if (HasSignatureFlag(SignatureFlags::THROWS)) { - ss << " throws"; - } else if (HasSignatureFlag(SignatureFlags::RETHROWS)) { - ss << " rethrows"; - } } std::string Signature::ToString() const diff --git a/ets2panda/ir/base/scriptFunction.cpp b/ets2panda/ir/base/scriptFunction.cpp index 71fe36ba69d9ead1439534435835a77178d1bcfd..733d69eb83713e029479d9db349479a8b0f00876 100644 --- a/ets2panda/ir/base/scriptFunction.cpp +++ b/ets2panda/ir/base/scriptFunction.cpp @@ -256,12 +256,6 @@ void ScriptFunction::SetReturnTypeAnnotation(TypeNode *node) noexcept void ScriptFunction::Dump(ir::AstDumper *dumper) const { - const char *throwMarker = nullptr; - if (IsThrowing()) { - throwMarker = "throws"; - } else if (IsRethrowing()) { - throwMarker = "rethrows"; - } dumper->Add({{"type", "ScriptFunction"}, {"id", AstDumper::Nullish(Id())}, {"generator", IsGenerator()}, @@ -272,8 +266,7 @@ void ScriptFunction::Dump(ir::AstDumper *dumper) const {"typeParameters", AstDumper::Optional(TypeParams())}, {"declare", AstDumper::Optional(IsDeclare())}, {"body", AstDumper::Optional(Body())}, - {"annotations", AstDumper::Optional(Annotations())}, - {"throwMarker", AstDumper::Optional(throwMarker)}}); + {"annotations", AstDumper::Optional(Annotations())}}); } void ScriptFunction::DumpCheckerTypeForDeclGen(ir::SrcDumper *dumper) const @@ -321,11 +314,6 @@ void ScriptFunction::Dump(ir::SrcDumper *dumper) const ReturnTypeAnnotation()->Dump(dumper); } DumpCheckerTypeForDeclGen(dumper); - if (IsThrowing()) { - dumper->Add(" throws"); - } else if (IsRethrowing()) { - dumper->Add(" rethrows"); - } if (dumper->IsDeclgen()) { dumper->Add(";"); dumper->Endl(); diff --git a/ets2panda/ir/base/scriptFunction.h b/ets2panda/ir/base/scriptFunction.h index f8d619152e96272aa1603872c61186c8b5e8a6ac..ebafe16d94ad2cbc8b7776bd95daf9278fa5284f 100644 --- a/ets2panda/ir/base/scriptFunction.h +++ b/ets2panda/ir/base/scriptFunction.h @@ -242,16 +242,6 @@ public: return (Flags() & ir::ScriptFunctionFlags::HAS_THROW) != 0; } - [[nodiscard]] bool IsThrowing() const noexcept - { - return (Flags() & ir::ScriptFunctionFlags::THROWS) != 0; - } - - [[nodiscard]] bool IsRethrowing() const noexcept - { - return (Flags() & ir::ScriptFunctionFlags::RETHROWS) != 0; - } - [[nodiscard]] bool IsTrailingLambda() const noexcept { return (Flags() & ir::ScriptFunctionFlags::TRAILING_LAMBDA) != 0; diff --git a/ets2panda/ir/ets/etsFunctionType.cpp b/ets2panda/ir/ets/etsFunctionType.cpp index ef128fde8a20fb09aa5bb682ee70d0470ae135d7..097b326d26c89b0cbba7edf65177fcc5e3dc55fe 100644 --- a/ets2panda/ir/ets/etsFunctionType.cpp +++ b/ets2panda/ir/ets/etsFunctionType.cpp @@ -37,17 +37,10 @@ void ETSFunctionType::Iterate(const NodeTraverser &cb) const void ETSFunctionType::Dump(ir::AstDumper *dumper) const { - const char *throwMarker = nullptr; - if (IsThrowing()) { - throwMarker = "throws"; - } else if (IsRethrowing()) { - throwMarker = "rethrows"; - } dumper->Add({{"type", "ETSFunctionType"}, {"params", Params()}, {"typeParameters", AstDumper::Optional(TypeParams())}, {"returnType", ReturnType()}, - {"throwMarker", AstDumper::Optional(throwMarker)}, {"annotations", AstDumper::Optional(Annotations())}}); } @@ -76,12 +69,6 @@ void ETSFunctionType::Dump(ir::SrcDumper *dumper) const ReturnType()->Dump(dumper); } - if (IsThrowing()) { - dumper->Add(" throws"); - } else if (IsRethrowing()) { - dumper->Add(" rethrows"); - } - dumper->Add(")"); } diff --git a/ets2panda/ir/ets/etsFunctionType.h b/ets2panda/ir/ets/etsFunctionType.h index 142e16671c030f44110dc26e1fdf04be458432fb..f013fc3ea4653275caf053f4af03bbeb59dcbbd9 100644 --- a/ets2panda/ir/ets/etsFunctionType.h +++ b/ets2panda/ir/ets/etsFunctionType.h @@ -110,16 +110,6 @@ public: return GetHistoryNodeAs()->funcFlags_; } - bool IsThrowing() const - { - return (Flags() & ir::ScriptFunctionFlags::THROWS) != 0; - } - - bool IsRethrowing() const - { - return (Flags() & ir::ScriptFunctionFlags::RETHROWS) != 0; - } - bool IsExtensionFunction() const { return GetHistoryNodeAs()->signature_.HasReceiver(); diff --git a/ets2panda/lexer/scripts/keywords.yaml b/ets2panda/lexer/scripts/keywords.yaml index 58cffbda4fbd75b568a2fadefcd37caf34866b09..920a68e9e4b185c8a59cbae95660521066c7d254 100644 --- a/ets2panda/lexer/scripts/keywords.yaml +++ b/ets2panda/lexer/scripts/keywords.yaml @@ -454,10 +454,6 @@ keywords: token: KEYW_READONLY keyword_like: [as, ts, ets] - - name: 'rethrows' - token: KEYW_RETHROWS - keyword_like: [ets] - - name: 'return' token: KEYW_RETURN keyword: [as, js, ets, ts] @@ -519,10 +515,6 @@ keywords: token: KEYW_THROW keyword: [js, ets, ts, as] - - name: 'throws' - token: KEYW_THROWS - keyword_like: [ets] - - name: 'true' token: LITERAL_TRUE keyword: [as, js, ets, ts] diff --git a/ets2panda/lsp/src/signature_help_items.cpp b/ets2panda/lsp/src/signature_help_items.cpp index 01f5fc651ff81fb26db7972a8094c9d683facca6..69bc6f2950b31adeef105267a95227428679efdd 100644 --- a/ets2panda/lsp/src/signature_help_items.cpp +++ b/ets2panda/lsp/src/signature_help_items.cpp @@ -111,12 +111,6 @@ SignatureHelpItem CreateSignatureHelpItem(checker::Signature &signature) std::string returnType = signature.ReturnType()->ToString(); item.SetSuffixDisplayParts(CreateTypeName(returnType)); - if (signature.HasSignatureFlag(checker::SignatureFlags::THROWS)) { - item.SetSuffixDisplayParts(CreateKeyword("throws")); - } else if (signature.HasSignatureFlag(checker::SignatureFlags::RETHROWS)) { - item.SetSuffixDisplayParts(CreateKeyword("rethrows")); - } - return item; } diff --git a/ets2panda/parser/ETSparser.cpp b/ets2panda/parser/ETSparser.cpp index e967c0009f9106cf07475225d2397b4017121516..d572dc44901503d107d8066872ffc0c097b0b076 100644 --- a/ets2panda/parser/ETSparser.cpp +++ b/ets2panda/parser/ETSparser.cpp @@ -579,25 +579,6 @@ std::tuple ETSParser::P return {true, body, body->End(), false}; } -ir::ScriptFunctionFlags ETSParser::ParseFunctionThrowMarker(bool isRethrowsAllowed) -{ - ir::ScriptFunctionFlags throwMarker = ir::ScriptFunctionFlags::NONE; - - if (Lexer()->GetToken().Type() == lexer::TokenType::LITERAL_IDENT) { - if (Lexer()->TryEatTokenKeyword(lexer::TokenType::KEYW_THROWS)) { - throwMarker = ir::ScriptFunctionFlags::THROWS; - } else if (Lexer()->TryEatTokenKeyword(lexer::TokenType::KEYW_RETHROWS)) { - if (isRethrowsAllowed) { - throwMarker = ir::ScriptFunctionFlags::RETHROWS; - } else { - LogError(diagnostic::ONLY_THROWS_IN_FUN_TYPE); - } - } - } - - return throwMarker; -} - ir::AstNode *ETSParser::ParseInnerTypeDeclaration(ir::ModifierFlags memberModifiers, lexer::LexerPosition savedPos, bool isStepToken, bool seenStatic) { diff --git a/ets2panda/parser/ETSparser.h b/ets2panda/parser/ETSparser.h index 46b62895de0ea5331cbffd20e5b5031e458e0891..b9be64d56c89daa7a37c2ad3e9a7951555c77af3 100644 --- a/ets2panda/parser/ETSparser.h +++ b/ets2panda/parser/ETSparser.h @@ -250,7 +250,6 @@ private: std::tuple ParseFunctionBody( const ArenaVector ¶ms, ParserStatus newStatus, ParserStatus contextStatus) override; ir::TypeNode *ParseFunctionReturnType(ParserStatus status) override; - ir::ScriptFunctionFlags ParseFunctionThrowMarker(bool isRethrowsAllowed) override; ir::Expression *CreateParameterThis(ir::TypeNode *typeAnnotation) override; ir::TypeNode *ConvertToOptionalUnionType(ir::TypeNode *typeAnno); void ValidateFieldModifiers(ir::ModifierFlags modifiers, bool optionalField, ir::Expression *initializer, diff --git a/ets2panda/parser/ETSparserTypes.cpp b/ets2panda/parser/ETSparserTypes.cpp index cca9894f1ec46d52758640ef084a54a304781a6e..dc590faec018f73ce1255c61b370754742c15ed5 100644 --- a/ets2panda/parser/ETSparserTypes.cpp +++ b/ets2panda/parser/ETSparserTypes.cpp @@ -209,10 +209,9 @@ ir::TypeNode *ETSParser::ParseFunctionType(TypeAnnotationParsingOptions *options return nullptr; } - ir::ScriptFunctionFlags throwMarker = ParseFunctionThrowMarker(false); auto *funcType = AllocNode( - ir::FunctionSignature(typeParamDecl, std::move(params), returnTypeAnnotation, hasReceiver), throwMarker, - Allocator()); + ir::FunctionSignature(typeParamDecl, std::move(params), returnTypeAnnotation, hasReceiver), + ir::ScriptFunctionFlags::NONE, Allocator()); funcType->SetRange({startLoc, returnTypeAnnotation->End()}); return funcType; diff --git a/ets2panda/parser/parserImpl.cpp b/ets2panda/parser/parserImpl.cpp index b5c33731a213b000ab11040109ae594f9471d783..7058b6d95da5e268b01023b325f73fd7f8863e86 100644 --- a/ets2panda/parser/parserImpl.cpp +++ b/ets2panda/parser/parserImpl.cpp @@ -976,10 +976,8 @@ FunctionSignature ParserImpl::ParseFunctionSignature(ParserStatus status) LogError(diagnostic::EXTENSION_ACCESSOR_RECEIVER); } - ir::ScriptFunctionFlags throwMarker = ParseFunctionThrowMarker(true); - auto res = ir::FunctionSignature(typeParamDecl, std::move(params), returnTypeAnnotation, hasReceiver); - return {std::move(res), throwMarker}; + return {std::move(res), ir::ScriptFunctionFlags::NONE}; } ir::ScriptFunction *ParserImpl::ParseFunction(ParserStatus newStatus) diff --git a/ets2panda/parser/parserImpl.h b/ets2panda/parser/parserImpl.h index 30da9aa1ce5d3216d0d79c7e9961bf3649ddbe3c..169f3c2e7f49a443771c04a09613a608d7d56159 100644 --- a/ets2panda/parser/parserImpl.h +++ b/ets2panda/parser/parserImpl.h @@ -475,11 +475,6 @@ protected: return nullptr; } - virtual ir::ScriptFunctionFlags ParseFunctionThrowMarker([[maybe_unused]] const bool isRethrowsAllowed) - { - return ir::ScriptFunctionFlags::NONE; - } - using NodeFormatType = std::tuple; virtual ir::Identifier *ParseIdentifierFormatPlaceholder(std::optional nodeFormat); virtual ir::Statement *ParseStatementFormatPlaceholder(); diff --git a/ets2panda/test/ast/parser/ets/FixedArray/MultipleParserErrors.ets b/ets2panda/test/ast/parser/ets/FixedArray/MultipleParserErrors.ets index bfd2a41f7ce970122601da20883d86c0f4cf65ea..7fa2468144f7fe14e9182bdb19ef92e8bc7ab075 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/MultipleParserErrors.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/MultipleParserErrors.ets @@ -169,7 +169,8 @@ function main(): void { /* @@? 18:14 Error SyntaxError: Optional variable is not allowed in for of statements. */ /* @@? 28:29 Error TypeError: Native, Abstract and Declare methods cannot have body. */ /* @@? 34:14 Error SyntaxError: The modifier for a constructor should be limited to access modifiers (private, internal, protected, public), and 'native' modifiers. */ -/* @@? 37:41 Error SyntaxError: Only 'throws' can be used with function types. */ +/* @@? 37:33 Error SyntaxError: Unexpected token 'rethrows'. */ +/* @@? 37:33 Error TypeError: Unresolved reference rethrows */ /* @@? 39:14 Error SyntaxError: Parameter declaration should have an explicit type annotation. */ /* @@? 39:14 Error SyntaxError: Unexpected token, expected ',' or ')'. */ /* @@? 39:14 Error SyntaxError: Unexpected token, expected an identifier. */ @@ -284,4 +285,4 @@ function main(): void { /* @@? 165:5 Error TypeError: This expression is not callable. */ /* @@? 166:5 Error TypeError: Expected 1 arguments, got 0. */ /* @@? 166:5 Error TypeError: No matching call signature */ -/* @@? 288:1 Error SyntaxError: Expected '}', got 'end of stream'. */ +/* @@? 289:1 Error SyntaxError: Expected '}', got 'end of stream'. */ diff --git a/ets2panda/test/ast/parser/ets/MultipleParserErrors.ets b/ets2panda/test/ast/parser/ets/MultipleParserErrors.ets index f90392bf9397c420ff47cec0efefe2482686bb13..804e16d1ad836a82c4596faf50287174b5ecbf9f 100644 --- a/ets2panda/test/ast/parser/ets/MultipleParserErrors.ets +++ b/ets2panda/test/ast/parser/ets/MultipleParserErrors.ets @@ -169,7 +169,8 @@ function main(): void { /* @@? 18:14 Error SyntaxError: Optional variable is not allowed in for of statements. */ /* @@? 28:29 Error TypeError: Native, Abstract and Declare methods cannot have body. */ /* @@? 34:14 Error SyntaxError: The modifier for a constructor should be limited to access modifiers (private, internal, protected, public), and 'native' modifiers. */ -/* @@? 37:41 Error SyntaxError: Only 'throws' can be used with function types. */ +/* @@? 37:33 Error SyntaxError: Unexpected token 'rethrows'. */ +/* @@? 37:33 Error TypeError: Unresolved reference rethrows */ /* @@? 39:14 Error SyntaxError: Parameter declaration should have an explicit type annotation. */ /* @@? 39:14 Error SyntaxError: Unexpected token, expected ',' or ')'. */ /* @@? 39:14 Error SyntaxError: Unexpected token, expected an identifier. */ @@ -282,4 +283,4 @@ function main(): void { /* @@? 165:5 Error TypeError: This expression is not callable. */ /* @@? 166:5 Error TypeError: Expected 1 arguments, got 0. */ /* @@? 166:5 Error TypeError: No matching call signature */ -/* @@? 286:1 Error SyntaxError: Expected '}', got 'end of stream'. */ +/* @@? 287:1 Error SyntaxError: Expected '}', got 'end of stream'. */ diff --git a/ets2panda/test/ast/parser/ets/functionTypeRethrows.ets b/ets2panda/test/ast/parser/ets/functionTypeRethrows.ets index 78d713ba541703baf4477570efe18c8d8d13f9b9..97ae8eaf9d04cc628a91d08b821648e500ea654a 100644 --- a/ets2panda/test/ast/parser/ets/functionTypeRethrows.ets +++ b/ets2panda/test/ast/parser/ets/functionTypeRethrows.ets @@ -13,6 +13,8 @@ * limitations under the License. */ -let a: (c: int, b: int) => char rethrows/* @@ label */; +let a: (c: int, b: int) => char /* @@ label */rethrows; -/* @@@ label Error SyntaxError: Only 'throws' can be used with function types. */ + +/* @@@ label Error SyntaxError: Unexpected token 'rethrows'. */ +/* @@@ label Error TypeError: Unresolved reference rethrows */ diff --git a/ets2panda/test/ast/parser/ets/variable_throw_function_2.ets b/ets2panda/test/ast/parser/ets/variable_throw_function_2.ets deleted file mode 100644 index 1c151d7bb23fa0b4504f5a71f429c0f69e830deb..0000000000000000000000000000000000000000 --- a/ets2panda/test/ast/parser/ets/variable_throw_function_2.ets +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function foo() : void throws {} - -function main(): void { - let non_throwing: () => void = foo; -} - -/* @@? 19:36 Error TypeError: Type '() => void throws' cannot be assigned to type '() => void' */ - diff --git a/ets2panda/test/compiler/ets/generic_function_call_5-expected.txt b/ets2panda/test/compiler/ets/generic_function_call_5-expected.txt index f2e28c450036b05dc7021959a027c259f75232ed..91bd40a6df67a60a7c4b91004fa048ae53d3eefb 100644 --- a/ets2panda/test/compiler/ets/generic_function_call_5-expected.txt +++ b/ets2panda/test/compiler/ets/generic_function_call_5-expected.txt @@ -289,7 +289,6 @@ } } }, - "throwMarker": "throws", "loc": { "start": { "line": 17, @@ -337,7 +336,7 @@ "loc": { "start": { "line": 17, - "column": 73, + "column": 66, "program": "generic_function_call_5.ets" }, "end": { diff --git a/ets2panda/test/compiler/ets/generic_function_call_5.ets b/ets2panda/test/compiler/ets/generic_function_call_5.ets index fc068f145670e83dd805cd3a496830976917ddf0..2814f6f0f3f0034c5fa55add5076b69b9b17d424 100644 --- a/ets2panda/test/compiler/ets/generic_function_call_5.ets +++ b/ets2panda/test/compiler/ets/generic_function_call_5.ets @@ -14,7 +14,7 @@ */ class P { - constructor(callback: (resolve: (value: T) => void) => void throws) { + constructor(callback: (resolve: (value: T) => void) => void) { } private ref: Object = new Object(); diff --git a/ets2panda/test/compiler/ets/generic_override_2-expected.txt b/ets2panda/test/compiler/ets/generic_override_2-expected.txt index fb2c29a366fd054823275bb0bef2d5fbda80822a..d7b122dd9aa2069b6d0539c4143747469afe6339 100644 --- a/ets2panda/test/compiler/ets/generic_override_2-expected.txt +++ b/ets2panda/test/compiler/ets/generic_override_2-expected.txt @@ -286,7 +286,7 @@ }, "end": { "line": 17, - "column": 66, + "column": 60, "program": "generic_override_2.ets" } } @@ -299,7 +299,7 @@ }, "end": { "line": 17, - "column": 66, + "column": 60, "program": "generic_override_2.ets" } } @@ -313,12 +313,11 @@ }, "end": { "line": 17, - "column": 66, + "column": 60, "program": "generic_override_2.ets" } } }, - "throwMarker": "throws", "loc": { "start": { "line": 17, @@ -327,7 +326,7 @@ }, "end": { "line": 17, - "column": 66, + "column": 60, "program": "generic_override_2.ets" } } @@ -341,7 +340,7 @@ }, "end": { "line": 17, - "column": 66, + "column": 60, "program": "generic_override_2.ets" } } @@ -354,7 +353,7 @@ }, "end": { "line": 17, - "column": 66, + "column": 60, "program": "generic_override_2.ets" } } @@ -590,7 +589,7 @@ }, "end": { "line": 18, - "column": 64, + "column": 58, "program": "generic_override_2.ets" } } @@ -603,7 +602,7 @@ }, "end": { "line": 18, - "column": 64, + "column": 58, "program": "generic_override_2.ets" } } @@ -617,12 +616,11 @@ }, "end": { "line": 18, - "column": 64, + "column": 58, "program": "generic_override_2.ets" } } }, - "throwMarker": "throws", "loc": { "start": { "line": 18, @@ -631,7 +629,7 @@ }, "end": { "line": 18, - "column": 64, + "column": 58, "program": "generic_override_2.ets" } } @@ -645,7 +643,7 @@ }, "end": { "line": 18, - "column": 64, + "column": 58, "program": "generic_override_2.ets" } } @@ -658,7 +656,7 @@ }, "end": { "line": 18, - "column": 64, + "column": 58, "program": "generic_override_2.ets" } } @@ -675,12 +673,12 @@ "loc": { "start": { "line": 18, - "column": 67, + "column": 60, "program": "generic_override_2.ets" }, "end": { "line": 18, - "column": 69, + "column": 62, "program": "generic_override_2.ets" } } @@ -702,12 +700,12 @@ "loc": { "start": { "line": 18, - "column": 70, + "column": 63, "program": "generic_override_2.ets" }, "end": { "line": 18, - "column": 71, + "column": 64, "program": "generic_override_2.ets" } } @@ -715,12 +713,12 @@ "loc": { "start": { "line": 18, - "column": 70, + "column": 63, "program": "generic_override_2.ets" }, "end": { "line": 18, - "column": 72, + "column": 65, "program": "generic_override_2.ets" } } @@ -728,12 +726,12 @@ "loc": { "start": { "line": 18, - "column": 70, + "column": 63, "program": "generic_override_2.ets" }, "end": { "line": 18, - "column": 72, + "column": 65, "program": "generic_override_2.ets" } } @@ -749,12 +747,12 @@ "loc": { "start": { "line": 18, - "column": 72, + "column": 65, "program": "generic_override_2.ets" }, "end": { "line": 18, - "column": 73, + "column": 66, "program": "generic_override_2.ets" } } @@ -762,12 +760,12 @@ "loc": { "start": { "line": 18, - "column": 72, + "column": 65, "program": "generic_override_2.ets" }, "end": { "line": 18, - "column": 74, + "column": 67, "program": "generic_override_2.ets" } } @@ -775,12 +773,12 @@ "loc": { "start": { "line": 18, - "column": 72, + "column": 65, "program": "generic_override_2.ets" }, "end": { "line": 18, - "column": 74, + "column": 67, "program": "generic_override_2.ets" } } @@ -789,12 +787,12 @@ "loc": { "start": { "line": 18, - "column": 70, + "column": 63, "program": "generic_override_2.ets" }, "end": { "line": 18, - "column": 74, + "column": 67, "program": "generic_override_2.ets" } } @@ -803,12 +801,12 @@ "loc": { "start": { "line": 18, - "column": 69, + "column": 62, "program": "generic_override_2.ets" }, "end": { "line": 18, - "column": 74, + "column": 67, "program": "generic_override_2.ets" } } @@ -816,12 +814,12 @@ "loc": { "start": { "line": 18, - "column": 67, + "column": 60, "program": "generic_override_2.ets" }, "end": { "line": 18, - "column": 75, + "column": 68, "program": "generic_override_2.ets" } } @@ -829,12 +827,12 @@ "loc": { "start": { "line": 18, - "column": 67, + "column": 60, "program": "generic_override_2.ets" }, "end": { "line": 18, - "column": 75, + "column": 68, "program": "generic_override_2.ets" } } @@ -987,7 +985,7 @@ }, "end": { "line": 18, - "column": 75, + "column": 68, "program": "generic_override_2.ets" } } @@ -1004,7 +1002,7 @@ }, "end": { "line": 18, - "column": 75, + "column": 68, "program": "generic_override_2.ets" } } @@ -1017,7 +1015,7 @@ }, "end": { "line": 18, - "column": 75, + "column": 68, "program": "generic_override_2.ets" } } @@ -1030,7 +1028,7 @@ }, "end": { "line": 18, - "column": 75, + "column": 68, "program": "generic_override_2.ets" } } @@ -1043,7 +1041,7 @@ }, "end": { "line": 18, - "column": 75, + "column": 68, "program": "generic_override_2.ets" } } @@ -1063,7 +1061,7 @@ }, "end": { "line": 18, - "column": 75, + "column": 68, "program": "generic_override_2.ets" } } @@ -1079,7 +1077,7 @@ }, "end": { "line": 18, - "column": 75, + "column": 68, "program": "generic_override_2.ets" } } @@ -1099,7 +1097,7 @@ }, "end": { "line": 18, - "column": 75, + "column": 68, "program": "generic_override_2.ets" } } @@ -1113,7 +1111,7 @@ }, "end": { "line": 18, - "column": 75, + "column": 68, "program": "generic_override_2.ets" } } @@ -1127,7 +1125,7 @@ }, "end": { "line": 18, - "column": 75, + "column": 68, "program": "generic_override_2.ets" } } @@ -1140,7 +1138,7 @@ }, "end": { "line": 18, - "column": 75, + "column": 68, "program": "generic_override_2.ets" } } @@ -1155,7 +1153,7 @@ }, "end": { "line": 18, - "column": 75, + "column": 68, "program": "generic_override_2.ets" } } @@ -1733,7 +1731,7 @@ }, "end": { "line": 22, - "column": 66, + "column": 60, "program": "generic_override_2.ets" } } @@ -1746,7 +1744,7 @@ }, "end": { "line": 22, - "column": 66, + "column": 60, "program": "generic_override_2.ets" } } @@ -1760,12 +1758,11 @@ }, "end": { "line": 22, - "column": 66, + "column": 60, "program": "generic_override_2.ets" } } }, - "throwMarker": "throws", "loc": { "start": { "line": 22, @@ -1774,7 +1771,7 @@ }, "end": { "line": 22, - "column": 66, + "column": 60, "program": "generic_override_2.ets" } } @@ -1788,7 +1785,7 @@ }, "end": { "line": 22, - "column": 66, + "column": 60, "program": "generic_override_2.ets" } } @@ -1801,7 +1798,7 @@ }, "end": { "line": 22, - "column": 66, + "column": 60, "program": "generic_override_2.ets" } } @@ -2037,7 +2034,7 @@ }, "end": { "line": 23, - "column": 64, + "column": 58, "program": "generic_override_2.ets" } } @@ -2050,7 +2047,7 @@ }, "end": { "line": 23, - "column": 64, + "column": 58, "program": "generic_override_2.ets" } } @@ -2064,12 +2061,11 @@ }, "end": { "line": 23, - "column": 64, + "column": 58, "program": "generic_override_2.ets" } } }, - "throwMarker": "throws", "loc": { "start": { "line": 23, @@ -2078,7 +2074,7 @@ }, "end": { "line": 23, - "column": 64, + "column": 58, "program": "generic_override_2.ets" } } @@ -2092,7 +2088,7 @@ }, "end": { "line": 23, - "column": 64, + "column": 58, "program": "generic_override_2.ets" } } @@ -2105,7 +2101,7 @@ }, "end": { "line": 23, - "column": 64, + "column": 58, "program": "generic_override_2.ets" } } @@ -2122,12 +2118,12 @@ "loc": { "start": { "line": 23, - "column": 67, + "column": 60, "program": "generic_override_2.ets" }, "end": { "line": 23, - "column": 69, + "column": 62, "program": "generic_override_2.ets" } } @@ -2149,12 +2145,12 @@ "loc": { "start": { "line": 23, - "column": 70, + "column": 63, "program": "generic_override_2.ets" }, "end": { "line": 23, - "column": 71, + "column": 64, "program": "generic_override_2.ets" } } @@ -2162,12 +2158,12 @@ "loc": { "start": { "line": 23, - "column": 70, + "column": 63, "program": "generic_override_2.ets" }, "end": { "line": 23, - "column": 72, + "column": 65, "program": "generic_override_2.ets" } } @@ -2175,12 +2171,12 @@ "loc": { "start": { "line": 23, - "column": 70, + "column": 63, "program": "generic_override_2.ets" }, "end": { "line": 23, - "column": 72, + "column": 65, "program": "generic_override_2.ets" } } @@ -2196,12 +2192,12 @@ "loc": { "start": { "line": 23, - "column": 72, + "column": 65, "program": "generic_override_2.ets" }, "end": { "line": 23, - "column": 73, + "column": 66, "program": "generic_override_2.ets" } } @@ -2209,12 +2205,12 @@ "loc": { "start": { "line": 23, - "column": 72, + "column": 65, "program": "generic_override_2.ets" }, "end": { "line": 23, - "column": 74, + "column": 67, "program": "generic_override_2.ets" } } @@ -2222,12 +2218,12 @@ "loc": { "start": { "line": 23, - "column": 72, + "column": 65, "program": "generic_override_2.ets" }, "end": { "line": 23, - "column": 74, + "column": 67, "program": "generic_override_2.ets" } } @@ -2236,12 +2232,12 @@ "loc": { "start": { "line": 23, - "column": 70, + "column": 63, "program": "generic_override_2.ets" }, "end": { "line": 23, - "column": 74, + "column": 67, "program": "generic_override_2.ets" } } @@ -2250,12 +2246,12 @@ "loc": { "start": { "line": 23, - "column": 69, + "column": 62, "program": "generic_override_2.ets" }, "end": { "line": 23, - "column": 74, + "column": 67, "program": "generic_override_2.ets" } } @@ -2263,12 +2259,12 @@ "loc": { "start": { "line": 23, - "column": 67, + "column": 60, "program": "generic_override_2.ets" }, "end": { "line": 23, - "column": 76, + "column": 69, "program": "generic_override_2.ets" } } @@ -2276,12 +2272,12 @@ "loc": { "start": { "line": 23, - "column": 67, + "column": 60, "program": "generic_override_2.ets" }, "end": { "line": 23, - "column": 76, + "column": 69, "program": "generic_override_2.ets" } } @@ -2627,7 +2623,7 @@ "loc": { "start": { "line": 23, - "column": 75, + "column": 68, "program": "generic_override_2.ets" }, "end": { diff --git a/ets2panda/test/compiler/ets/generic_override_2.ets b/ets2panda/test/compiler/ets/generic_override_2.ets index 2fa18c8cd1b221471cf42564868a454dbdcd6bb3..b574f303442d8feac63bbe97fa66206b04a51863 100644 --- a/ets2panda/test/compiler/ets/generic_override_2.ets +++ b/ets2panda/test/compiler/ets/generic_override_2.ets @@ -14,13 +14,13 @@ */ interface PL { - then(onFulfilled?: (value: T) => U|PL throws, - onRejected?: (error: NullishType) => E|PL throws): PL; + then(onFulfilled?: (value: T) => U|PL, + onRejected?: (error: NullishType) => E|PL): PL; } class P implements PL { - then(onFulfilled?: (value: T) => U|PL throws, - onRejected?: (error: NullishType) => E|PL throws): PL { + then(onFulfilled?: (value: T) => U|PL, + onRejected?: (error: NullishType) => E|PL): PL { return new P() } } diff --git a/ets2panda/test/compiler/ets/rethrowingCheck1-expected.txt b/ets2panda/test/compiler/ets/rethrowingCheck1-expected.txt deleted file mode 100644 index 0bec23824ce964aceeaa693401afd35fdcbedaf8..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/rethrowingCheck1-expected.txt +++ /dev/null @@ -1,787 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 16, - "column": 13, - "program": "rethrowingCheck1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 16, - "column": 13, - "program": "rethrowingCheck1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ThrowStatement", - "argument": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Exception", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 15, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 17, - "column": 24, - "program": "rethrowingCheck1.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 15, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 17, - "column": 25, - "program": "rethrowingCheck1.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 15, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 17, - "column": 25, - "program": "rethrowingCheck1.ets" - } - } - }, - "arguments": [ - { - "type": "StringLiteral", - "value": "I am an exception", - "loc": { - "start": { - "line": 17, - "column": 25, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 17, - "column": 44, - "program": "rethrowingCheck1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 17, - "column": 11, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 17, - "column": 46, - "program": "rethrowingCheck1.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 5, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 17, - "column": 46, - "program": "rethrowingCheck1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 23, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "rethrowingCheck1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "rethrowingCheck1.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "rethrowingCheck1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "rethrowingCheck1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "bar", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 20, - "column": 13, - "program": "rethrowingCheck1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "bar", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 20, - "column": 13, - "program": "rethrowingCheck1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "a", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 23, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 20, - "column": 27, - "program": "rethrowingCheck1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 20, - "column": 17, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 20, - "column": 27, - "program": "rethrowingCheck1.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 14, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 20, - "column": 27, - "program": "rethrowingCheck1.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 14, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 20, - "column": 27, - "program": "rethrowingCheck1.ets" - } - } - } - ], - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 9, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 22, - "column": 12, - "program": "rethrowingCheck1.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 22, - "column": 9, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 22, - "column": 14, - "program": "rethrowingCheck1.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 9, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 22, - "column": 15, - "program": "rethrowingCheck1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 21, - "column": 9, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 23, - "column": 6, - "program": "rethrowingCheck1.ets" - } - } - }, - "handler": [ - { - "type": "CatchClause", - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 23, - "column": 17, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 25, - "column": 6, - "program": "rethrowingCheck1.ets" - } - } - }, - "param": { - "type": "Identifier", - "name": "e", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 14, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 23, - "column": 15, - "program": "rethrowingCheck1.ets" - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 7, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 25, - "column": 6, - "program": "rethrowingCheck1.ets" - } - } - } - ], - "finalizer": null, - "loc": { - "start": { - "line": 21, - "column": 5, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 25, - "column": 6, - "program": "rethrowingCheck1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 20, - "column": 45, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "rethrowingCheck1.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "rethrowingCheck1.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "rethrowingCheck1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 1, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "rethrowingCheck1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck1.ets" - }, - "end": { - "line": 27, - "column": 1, - "program": "rethrowingCheck1.ets" - } - } -} diff --git a/ets2panda/test/compiler/ets/rethrowingCheck1.ets b/ets2panda/test/compiler/ets/rethrowingCheck1.ets deleted file mode 100644 index b2a3ba24b39cedf894af44f65eaf54b99f6dd172..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/rethrowingCheck1.ets +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2023-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function foo() throws { - throw new Exception("I am an exception"); -} - -function bar(a: () => void throws) rethrows { - try { - foo(); - } catch (e) { - // error handling - } -} diff --git a/ets2panda/test/compiler/ets/rethrowingCheck4-expected.txt b/ets2panda/test/compiler/ets/rethrowingCheck4-expected.txt deleted file mode 100644 index 3e40070d3f79a9fe972d6a8b00331dbba1445289..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/rethrowingCheck4-expected.txt +++ /dev/null @@ -1,926 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "b", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 16, - "column": 11, - "program": "rethrowingCheck4.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "b", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 16, - "column": 11, - "program": "rethrowingCheck4.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "foo", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 23, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 16, - "column": 27, - "program": "rethrowingCheck4.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 16, - "column": 17, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 16, - "column": 27, - "program": "rethrowingCheck4.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 12, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 16, - "column": 27, - "program": "rethrowingCheck4.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 12, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 16, - "column": 27, - "program": "rethrowingCheck4.ets" - } - } - } - ], - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 5, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 17, - "column": 8, - "program": "rethrowingCheck4.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 17, - "column": 5, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 17, - "column": 10, - "program": "rethrowingCheck4.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 5, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 17, - "column": 11, - "program": "rethrowingCheck4.ets" - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 45, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "rethrowingCheck4.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "rethrowingCheck4.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "rethrowingCheck4.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "rethrowingCheck4.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 20, - "column": 13, - "program": "rethrowingCheck4.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 20, - "column": 13, - "program": "rethrowingCheck4.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ThrowStatement", - "argument": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Exception", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 15, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 21, - "column": 24, - "program": "rethrowingCheck4.ets" - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 15, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 21, - "column": 25, - "program": "rethrowingCheck4.ets" - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 15, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 21, - "column": 25, - "program": "rethrowingCheck4.ets" - } - } - }, - "arguments": [ - { - "type": "StringLiteral", - "value": "I am an exception", - "loc": { - "start": { - "line": 21, - "column": 25, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 21, - "column": 44, - "program": "rethrowingCheck4.ets" - } - } - } - ], - "loc": { - "start": { - "line": 21, - "column": 11, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 21, - "column": 46, - "program": "rethrowingCheck4.ets" - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 5, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 21, - "column": 46, - "program": "rethrowingCheck4.ets" - } - } - } - ], - "loc": { - "start": { - "line": 20, - "column": 23, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 22, - "column": 2, - "program": "rethrowingCheck4.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 22, - "column": 2, - "program": "rethrowingCheck4.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 22, - "column": 2, - "program": "rethrowingCheck4.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 1, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 22, - "column": 2, - "program": "rethrowingCheck4.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "bar", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 10, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 24, - "column": 13, - "program": "rethrowingCheck4.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "bar", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 10, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 24, - "column": 13, - "program": "rethrowingCheck4.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "b", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 24, - "column": 23, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 24, - "column": 27, - "program": "rethrowingCheck4.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 24, - "column": 17, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 24, - "column": 27, - "program": "rethrowingCheck4.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 14, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 24, - "column": 27, - "program": "rethrowingCheck4.ets" - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 14, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 24, - "column": 27, - "program": "rethrowingCheck4.ets" - } - } - } - ], - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "b", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 5, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 25, - "column": 6, - "program": "rethrowingCheck4.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 25, - "column": 5, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 25, - "column": 8, - "program": "rethrowingCheck4.ets" - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 5, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 25, - "column": 9, - "program": "rethrowingCheck4.ets" - } - } - } - ], - "loc": { - "start": { - "line": 24, - "column": 45, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "rethrowingCheck4.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 24, - "column": 10, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "rethrowingCheck4.ets" - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 10, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "rethrowingCheck4.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 1, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "rethrowingCheck4.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingCheck4.ets" - }, - "end": { - "line": 27, - "column": 1, - "program": "rethrowingCheck4.ets" - } - } -} diff --git a/ets2panda/test/compiler/ets/rethrowingCheck4.ets b/ets2panda/test/compiler/ets/rethrowingCheck4.ets deleted file mode 100644 index 7541229e7f3cbd04610433727913053c5ade1b39..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/rethrowingCheck4.ets +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2023-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function b(foo: () => void throws) rethrows { - foo(); -} - -function foo() throws { - throw new Exception("I am an exception"); -} - -function bar(b: () => void throws) rethrows { - b(); -} diff --git a/ets2panda/test/compiler/ets/rethrowingConstructorCheck3-expected.txt b/ets2panda/test/compiler/ets/rethrowingConstructorCheck3-expected.txt deleted file mode 100644 index 0f3228d3087a74aba5042023950b1073c62268f6..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/rethrowingConstructorCheck3-expected.txt +++ /dev/null @@ -1,853 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "TestClass", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 7, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 16, - "column": 16, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "constructor", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "f", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 17, - "column": 24, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 17, - "column": 28, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 17, - "column": 18, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 17, - "column": 28, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 15, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 17, - "column": 28, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 15, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 17, - "column": 28, - "program": "rethrowingConstructorCheck3.ets" - } - } - } - ], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 17, - "column": 46, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 17, - "column": 48, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 17, - "column": 14, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 17, - "column": 48, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 14, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 17, - "column": 48, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 3, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 17, - "column": 48, - "program": "rethrowingConstructorCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 17, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 20, - "column": 9, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 20, - "column": 9, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 20, - "column": 22, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 20, - "column": 22, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 26, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 20, - "column": 30, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 20, - "column": 38, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 20, - "column": 40, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 20, - "column": 40, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 20, - "column": 40, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 20, - "column": 40, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 22, - "column": 14, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 22, - "column": 14, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 22, - "column": 18, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 22, - "column": 22, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 9, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 24, - "column": 10, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "init": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "TestClass", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 17, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 24, - "column": 26, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 17, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 24, - "column": 27, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 17, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 24, - "column": 27, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 27, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 24, - "column": 39, - "program": "rethrowingConstructorCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 24, - "column": 13, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 24, - "column": 41, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 9, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 24, - "column": 41, - "program": "rethrowingConstructorCheck3.ets" - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 24, - "column": 5, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 24, - "column": 41, - "program": "rethrowingConstructorCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 23, - "column": 7, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 25, - "column": 4, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "handler": [ - { - "type": "CatchClause", - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 25, - "column": 15, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 25, - "column": 17, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "param": { - "type": "Identifier", - "name": "e", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 12, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 25, - "column": 13, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 5, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 25, - "column": 17, - "program": "rethrowingConstructorCheck3.ets" - } - } - } - ], - "finalizer": null, - "loc": { - "start": { - "line": 23, - "column": 3, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 25, - "column": 17, - "program": "rethrowingConstructorCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 22, - "column": 23, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "rethrowingConstructorCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - }, - "end": { - "line": 27, - "column": 1, - "program": "rethrowingConstructorCheck3.ets" - } - } -} diff --git a/ets2panda/test/compiler/ets/rethrowingConstructorCheck3.ets b/ets2panda/test/compiler/ets/rethrowingConstructorCheck3.ets deleted file mode 100644 index 1d2b87024fb68d4c7cb37a6d3fc05b34e47a604e..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/rethrowingConstructorCheck3.ets +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2023-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -class TestClass { - constructor(f: () => void throws) rethrows {} -} - -function TestFunction(): void throws {} - -function main(): void { - try { - let a = new TestClass(TestFunction); - } catch (e) {} -} diff --git a/ets2panda/test/compiler/ets/rethrowingFunctionCheck3-expected.txt b/ets2panda/test/compiler/ets/rethrowingFunctionCheck3-expected.txt deleted file mode 100644 index c2ee021bda143e8c9ee3151718590e65b8d38413..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/rethrowingFunctionCheck3-expected.txt +++ /dev/null @@ -1,754 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 16, - "column": 22, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 16, - "column": 22, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "f", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 32, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 16, - "column": 36, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 16, - "column": 26, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 16, - "column": 36, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 23, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 16, - "column": 36, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 23, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 16, - "column": 36, - "program": "rethrowingFunctionCheck3.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 46, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 16, - "column": 50, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 16, - "column": 60, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 16, - "column": 62, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 16, - "column": 62, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 16, - "column": 62, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 16, - "column": 62, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "TestFunctionToo", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 18, - "column": 25, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "TestFunctionToo", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 18, - "column": 25, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 29, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 18, - "column": 33, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 18, - "column": 41, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 18, - "column": 43, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 18, - "column": 43, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 18, - "column": 43, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 18, - "column": 43, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 20, - "column": 14, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 20, - "column": 14, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 18, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 20, - "column": 22, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 5, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 22, - "column": 17, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "TestFunctionToo", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 22, - "column": 33, - "program": "rethrowingFunctionCheck3.ets" - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 22, - "column": 5, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 22, - "column": 34, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 5, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 22, - "column": 35, - "program": "rethrowingFunctionCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 21, - "column": 7, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 23, - "column": 4, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "handler": [ - { - "type": "CatchClause", - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 23, - "column": 15, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 23, - "column": 17, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "param": { - "type": "Identifier", - "name": "e", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 12, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 23, - "column": 13, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 5, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 23, - "column": 17, - "program": "rethrowingFunctionCheck3.ets" - } - } - } - ], - "finalizer": null, - "loc": { - "start": { - "line": 21, - "column": 3, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 23, - "column": 17, - "program": "rethrowingFunctionCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 20, - "column": 23, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 24, - "column": 2, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 24, - "column": 2, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 24, - "column": 2, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 24, - "column": 2, - "program": "rethrowingFunctionCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - }, - "end": { - "line": 25, - "column": 1, - "program": "rethrowingFunctionCheck3.ets" - } - } -} diff --git a/ets2panda/test/compiler/ets/rethrowingFunctionCheck3.ets b/ets2panda/test/compiler/ets/rethrowingFunctionCheck3.ets deleted file mode 100644 index 49b10445488f5a2f6b509e8422dd2724992ad5de..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/rethrowingFunctionCheck3.ets +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2023-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function TestFunction(f: () => void throws): void rethrows {} - -function TestFunctionToo(): void throws {} - -function main(): void { - try { - TestFunction(TestFunctionToo); - } catch (e) {} -} diff --git a/ets2panda/test/compiler/ets/rethrowingMethodCheck3-expected.txt b/ets2panda/test/compiler/ets/rethrowingMethodCheck3-expected.txt deleted file mode 100644 index d5b6ad05b8a0327ebad87455112f6200bc132926..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/rethrowingMethodCheck3-expected.txt +++ /dev/null @@ -1,1056 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "TestClass", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 7, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 16, - "column": 16, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "testMethod", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 3, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 17, - "column": 13, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "testMethod", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 3, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 17, - "column": 13, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "f", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 17, - "column": 23, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 17, - "column": 27, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 17, - "column": 17, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 17, - "column": 27, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 14, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 17, - "column": 27, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 14, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 17, - "column": 27, - "program": "rethrowingMethodCheck3.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 17, - "column": 37, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 17, - "column": 41, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 17, - "column": 51, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 17, - "column": 53, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 17, - "column": 13, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 17, - "column": 53, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 13, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 17, - "column": 53, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 3, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 17, - "column": 53, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 16, - "column": 18, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 16, - "column": 18, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 16, - "column": 18, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 16, - "column": 18, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 16, - "column": 18, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 16, - "column": 18, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 17, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 20, - "column": 9, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 20, - "column": 9, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 20, - "column": 22, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 20, - "column": 22, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 26, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 20, - "column": 30, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 20, - "column": 38, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 20, - "column": 40, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 20, - "column": 40, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 20, - "column": 40, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 20, - "column": 40, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 22, - "column": 14, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 22, - "column": 14, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 22, - "column": 18, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 22, - "column": 22, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "testClass", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 7, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 23, - "column": 16, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "init": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "TestClass", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 23, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 23, - "column": 32, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 23, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 23, - "column": 33, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 23, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 23, - "column": 33, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "arguments": [], - "loc": { - "start": { - "line": 23, - "column": 19, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 23, - "column": 35, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 7, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 23, - "column": 35, - "program": "rethrowingMethodCheck3.ets" - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 23, - "column": 3, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 23, - "column": 35, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "testClass", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 5, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 26, - "column": 14, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "property": { - "type": "Identifier", - "name": "testMethod", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 15, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 26, - "column": 25, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 26, - "column": 5, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 26, - "column": 25, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 26, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 26, - "column": 38, - "program": "rethrowingMethodCheck3.ets" - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 26, - "column": 5, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 26, - "column": 39, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 5, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 26, - "column": 40, - "program": "rethrowingMethodCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 25, - "column": 7, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 27, - "column": 4, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "handler": [ - { - "type": "CatchClause", - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 27, - "column": 15, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 27, - "column": 17, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "param": { - "type": "Identifier", - "name": "e", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 12, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 27, - "column": 13, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 5, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 27, - "column": 17, - "program": "rethrowingMethodCheck3.ets" - } - } - } - ], - "finalizer": null, - "loc": { - "start": { - "line": 25, - "column": 3, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 27, - "column": 17, - "program": "rethrowingMethodCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 22, - "column": 23, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 28, - "column": 2, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 28, - "column": 2, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 28, - "column": 2, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 28, - "column": 2, - "program": "rethrowingMethodCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - }, - "end": { - "line": 29, - "column": 1, - "program": "rethrowingMethodCheck3.ets" - } - } -} diff --git a/ets2panda/test/compiler/ets/rethrowingMethodCheck3.ets b/ets2panda/test/compiler/ets/rethrowingMethodCheck3.ets deleted file mode 100644 index 20c2c087e58fd7440a2e4a41c8f67a256bf4461e..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/rethrowingMethodCheck3.ets +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2023-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -class TestClass { - testMethod(f: () => void throws): void rethrows {} -} - -function TestFunction(): void throws {} - -function main(): void { - let testClass = new TestClass(); - - try { - testClass.testMethod(TestFunction); - } catch (e) {} -} diff --git a/ets2panda/test/compiler/ets/throwInRethrowingFunction2-expected.txt b/ets2panda/test/compiler/ets/throwInRethrowingFunction2-expected.txt deleted file mode 100644 index 831332f4df25824d86de5cee06b8a97417b617d7..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/throwInRethrowingFunction2-expected.txt +++ /dev/null @@ -1,662 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "RethrowingFunc", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 16, - "column": 24, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "RethrowingFunc", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 16, - "column": 24, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "f", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 34, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 16, - "column": 38, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 16, - "column": 28, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 16, - "column": 38, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 25, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 16, - "column": 38, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 25, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 16, - "column": 38, - "program": "throwInRethrowingFunction2.ets" - } - } - } - ], - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "statements": [ - { - "type": "ThrowStatement", - "argument": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Exception", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 15, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 18, - "column": 24, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 15, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 18, - "column": 25, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 15, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 18, - "column": 25, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "arguments": [], - "loc": { - "start": { - "line": 18, - "column": 11, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 18, - "column": 27, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 5, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 18, - "column": 27, - "program": "throwInRethrowingFunction2.ets" - } - } - } - ], - "loc": { - "start": { - "line": 17, - "column": 7, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 19, - "column": 4, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "handler": [ - { - "type": "CatchClause", - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 19, - "column": 15, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 19, - "column": 17, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "param": { - "type": "Identifier", - "name": "e", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 12, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 19, - "column": 13, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 5, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 19, - "column": 17, - "program": "throwInRethrowingFunction2.ets" - } - } - } - ], - "finalizer": null, - "loc": { - "start": { - "line": 17, - "column": 3, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 19, - "column": 17, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "f", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 3, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 21, - "column": 4, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 21, - "column": 3, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 21, - "column": 6, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 3, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 21, - "column": 7, - "program": "throwInRethrowingFunction2.ets" - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 56, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 22, - "column": 2, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 22, - "column": 2, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 22, - "column": 2, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 22, - "column": 2, - "program": "throwInRethrowingFunction2.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - }, - "end": { - "line": 23, - "column": 1, - "program": "throwInRethrowingFunction2.ets" - } - } -} diff --git a/ets2panda/test/compiler/ets/throwInRethrowingFunction2.ets b/ets2panda/test/compiler/ets/throwInRethrowingFunction2.ets deleted file mode 100644 index f16c3eb65914ff08283cd0502dcd1ca23fd5eedd..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/throwInRethrowingFunction2.ets +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2023-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function RethrowingFunc(f: () => void throws) rethrows { - try { - throw new Exception(); - } catch (e) {} - - f(); -} diff --git a/ets2panda/test/compiler/ets/throwInThrowingFunction-expected.txt b/ets2panda/test/compiler/ets/throwInThrowingFunction-expected.txt deleted file mode 100644 index 1033f671408b4ec2c591e0405d9690fd7fb9caaf..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/throwInThrowingFunction-expected.txt +++ /dev/null @@ -1,480 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 16, - "column": 22, - "program": "throwInThrowingFunction.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 16, - "column": 22, - "program": "throwInThrowingFunction.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 26, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 16, - "column": 30, - "program": "throwInThrowingFunction.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ThrowStatement", - "argument": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Exception", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 13, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 17, - "column": 22, - "program": "throwInThrowingFunction.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 13, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 17, - "column": 23, - "program": "throwInThrowingFunction.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 13, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 17, - "column": 23, - "program": "throwInThrowingFunction.ets" - } - } - }, - "arguments": [], - "loc": { - "start": { - "line": 17, - "column": 9, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 17, - "column": 25, - "program": "throwInThrowingFunction.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 3, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 17, - "column": 25, - "program": "throwInThrowingFunction.ets" - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 38, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "throwInThrowingFunction.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "throwInThrowingFunction.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "throwInThrowingFunction.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "throwInThrowingFunction.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwInThrowingFunction.ets" - }, - "end": { - "line": 19, - "column": 1, - "program": "throwInThrowingFunction.ets" - } - } -} diff --git a/ets2panda/test/compiler/ets/throwInThrowingFunction.ets b/ets2panda/test/compiler/ets/throwInThrowingFunction.ets deleted file mode 100644 index 9c70112c57015a43a5124d3dcc7d170c3c5ff25f..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/throwInThrowingFunction.ets +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2023-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function TestFunction(): void throws { - throw new Exception(); -} diff --git a/ets2panda/test/compiler/ets/throwingFunctionAsParameter1-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionAsParameter1-expected.txt deleted file mode 100644 index 3197e2d47ebdda5777d295fa29a9efc9921ea7d4..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/throwingFunctionAsParameter1-expected.txt +++ /dev/null @@ -1,835 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "RethrowingFunc", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 16, - "column": 24, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "RethrowingFunc", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 16, - "column": 24, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "func", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 37, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 16, - "column": 41, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 16, - "column": 31, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 16, - "column": 41, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 25, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 16, - "column": 41, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 25, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 16, - "column": 41, - "program": "throwingFunctionAsParameter1.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 51, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 16, - "column": 55, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "func", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 3, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 17, - "column": 7, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 17, - "column": 3, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 17, - "column": 9, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 3, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 17, - "column": 10, - "program": "throwingFunctionAsParameter1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 65, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "NonThrowingFunc", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 20, - "column": 25, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "NonThrowingFunc", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 20, - "column": 25, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "func", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 38, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 20, - "column": 42, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 20, - "column": 32, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 20, - "column": 42, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 26, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 20, - "column": 42, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 26, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 20, - "column": 42, - "program": "throwingFunctionAsParameter1.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 52, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 20, - "column": 56, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "func", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 5, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 22, - "column": 9, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 22, - "column": 5, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 22, - "column": 11, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 5, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 22, - "column": 12, - "program": "throwingFunctionAsParameter1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 21, - "column": 7, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 23, - "column": 4, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "handler": [ - { - "type": "CatchClause", - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 23, - "column": 15, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 23, - "column": 17, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "param": { - "type": "Identifier", - "name": "e", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 12, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 23, - "column": 13, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 5, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 23, - "column": 17, - "program": "throwingFunctionAsParameter1.ets" - } - } - } - ], - "finalizer": null, - "loc": { - "start": { - "line": 21, - "column": 3, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 23, - "column": 17, - "program": "throwingFunctionAsParameter1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 20, - "column": 57, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 24, - "column": 2, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 24, - "column": 2, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 24, - "column": 2, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 24, - "column": 2, - "program": "throwingFunctionAsParameter1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - }, - "end": { - "line": 25, - "column": 1, - "program": "throwingFunctionAsParameter1.ets" - } - } -} diff --git a/ets2panda/test/compiler/ets/throwingFunctionAsParameter1.ets b/ets2panda/test/compiler/ets/throwingFunctionAsParameter1.ets deleted file mode 100644 index 523a7c09d068875cec1ac73a2d69eee48e7b8167..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/throwingFunctionAsParameter1.ets +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2023-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function RethrowingFunc(func: () => void throws): void rethrows { - func(); -} - -function NonThrowingFunc(func: () => void throws): void { - try { - func(); - } catch (e) {} -} diff --git a/ets2panda/test/compiler/ets/throwingFunctionCheck2-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionCheck2-expected.txt deleted file mode 100644 index c41bca3df3148fae235f7256c524a223e473c966..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/throwingFunctionCheck2-expected.txt +++ /dev/null @@ -1,809 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck2.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 16, - "column": 22, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 16, - "column": 22, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 26, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 16, - "column": 30, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 16, - "column": 38, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 16, - "column": 40, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 16, - "column": 40, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 16, - "column": 40, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 16, - "column": 40, - "program": "throwingFunctionCheck2.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 18, - "column": 14, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 18, - "column": 14, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 18, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 18, - "column": 22, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "statements": [ - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "statements": [ - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 17, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 22, - "column": 29, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 22, - "column": 17, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 22, - "column": 31, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 17, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 22, - "column": 32, - "program": "throwingFunctionCheck2.ets" - } - } - } - ], - "loc": { - "start": { - "line": 21, - "column": 17, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 23, - "column": 14, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "handler": [ - { - "type": "CatchClause", - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 23, - "column": 36, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 23, - "column": 38, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "param": { - "type": "Identifier", - "name": "e", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Exception", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 25, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 23, - "column": 34, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 25, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 23, - "column": 35, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 25, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 23, - "column": 35, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 22, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 23, - "column": 23, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 15, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 23, - "column": 38, - "program": "throwingFunctionCheck2.ets" - } - } - } - ], - "finalizer": null, - "loc": { - "start": { - "line": 21, - "column": 13, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 23, - "column": 38, - "program": "throwingFunctionCheck2.ets" - } - } - } - ], - "loc": { - "start": { - "line": 20, - "column": 13, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 24, - "column": 10, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "handler": [ - { - "type": "CatchClause", - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 24, - "column": 21, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 24, - "column": 23, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "param": { - "type": "Identifier", - "name": "e", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 18, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 24, - "column": 19, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 11, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 24, - "column": 23, - "program": "throwingFunctionCheck2.ets" - } - } - } - ], - "finalizer": null, - "loc": { - "start": { - "line": 20, - "column": 9, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 24, - "column": 23, - "program": "throwingFunctionCheck2.ets" - } - } - } - ], - "loc": { - "start": { - "line": 19, - "column": 9, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 25, - "column": 6, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "handler": [ - { - "type": "CatchClause", - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 25, - "column": 28, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 25, - "column": 30, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "param": { - "type": "Identifier", - "name": "e", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Exception", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 17, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 25, - "column": 26, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 17, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 25, - "column": 27, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 17, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 25, - "column": 27, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 14, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 25, - "column": 15, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 7, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 25, - "column": 30, - "program": "throwingFunctionCheck2.ets" - } - } - } - ], - "finalizer": null, - "loc": { - "start": { - "line": 19, - "column": 5, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 25, - "column": 30, - "program": "throwingFunctionCheck2.ets" - } - } - } - ], - "loc": { - "start": { - "line": 18, - "column": 23, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 1, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 26, - "column": 2, - "program": "throwingFunctionCheck2.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck2.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck2.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck2.ets" - }, - "end": { - "line": 27, - "column": 1, - "program": "throwingFunctionCheck2.ets" - } - } -} diff --git a/ets2panda/test/compiler/ets/throwingFunctionCheck2.ets b/ets2panda/test/compiler/ets/throwingFunctionCheck2.ets deleted file mode 100644 index 3f8e4a6ef9d0ae999207ce80eff730c314df71e7..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/throwingFunctionCheck2.ets +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2023-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function TestFunction(): void throws {} - -function main(): void { - try { - try { - try { - TestFunction(); - } catch (e: Exception) {} - } catch (e) {} - } catch (e: Exception) {} -} diff --git a/ets2panda/test/compiler/ets/throwingFunctionCheck3-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionCheck3-expected.txt deleted file mode 100644 index 379a1fef2d8100b77b71627bd86922fb3d92a5ed..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/throwingFunctionCheck3-expected.txt +++ /dev/null @@ -1,1154 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "TestClass", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 7, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 16, - "column": 16, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "constructor", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 17, - "column": 26, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 17, - "column": 28, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 17, - "column": 16, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 17, - "column": 28, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 16, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 17, - "column": 28, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 5, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 17, - "column": 28, - "program": "throwingFunctionCheck3.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "TestMethod", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 5, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 18, - "column": 15, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "TestMethod", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 5, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 18, - "column": 15, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 19, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 18, - "column": 23, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 18, - "column": 24, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 18, - "column": 26, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 15, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 18, - "column": 26, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 15, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 18, - "column": 26, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 5, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 18, - "column": 26, - "program": "throwingFunctionCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 17, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 21, - "column": 9, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 21, - "column": 9, - "program": "throwingFunctionCheck3.ets" - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck3.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 10, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 21, - "column": 22, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 10, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 21, - "column": 22, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 21, - "column": 26, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 21, - "column": 30, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 9, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 22, - "column": 10, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "init": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "TestClass", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 17, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 22, - "column": 26, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 17, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 22, - "column": 27, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 17, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 22, - "column": 27, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "arguments": [], - "loc": { - "start": { - "line": 22, - "column": 13, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 22, - "column": 29, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 9, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 22, - "column": 29, - "program": "throwingFunctionCheck3.ets" - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 22, - "column": 5, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 22, - "column": 29, - "program": "throwingFunctionCheck3.ets" - } - } - }, - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 9, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 25, - "column": 10, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "property": { - "type": "Identifier", - "name": "TestMethod", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 11, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 25, - "column": 21, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 25, - "column": 9, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 25, - "column": 21, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 25, - "column": 9, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 25, - "column": 23, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 9, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 25, - "column": 24, - "program": "throwingFunctionCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 24, - "column": 9, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 26, - "column": 6, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "handler": [ - { - "type": "CatchClause", - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 26, - "column": 28, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 26, - "column": 30, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "param": { - "type": "Identifier", - "name": "e", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Exception", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 17, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 26, - "column": 26, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 17, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 26, - "column": 27, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 17, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 26, - "column": 27, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 14, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 26, - "column": 15, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 7, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 26, - "column": 30, - "program": "throwingFunctionCheck3.ets" - } - } - } - ], - "finalizer": null, - "loc": { - "start": { - "line": 24, - "column": 5, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 26, - "column": 30, - "program": "throwingFunctionCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 21, - "column": 38, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 27, - "column": 2, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 21, - "column": 10, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 27, - "column": 2, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 10, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 27, - "column": 2, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 1, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 27, - "column": 2, - "program": "throwingFunctionCheck3.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 10, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 29, - "column": 14, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 10, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 29, - "column": 14, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 29, - "column": 18, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 29, - "column": 22, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 9, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 31, - "column": 21, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 31, - "column": 9, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 31, - "column": 23, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 9, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 31, - "column": 24, - "program": "throwingFunctionCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 30, - "column": 9, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 32, - "column": 6, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "handler": [ - { - "type": "CatchClause", - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 32, - "column": 17, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 32, - "column": 19, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "param": { - "type": "Identifier", - "name": "e", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 14, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 32, - "column": 15, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 7, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 32, - "column": 19, - "program": "throwingFunctionCheck3.ets" - } - } - } - ], - "finalizer": null, - "loc": { - "start": { - "line": 30, - "column": 5, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 32, - "column": 19, - "program": "throwingFunctionCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 29, - "column": 23, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 33, - "column": 2, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 10, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 33, - "column": 2, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 10, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 33, - "column": 2, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 1, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 33, - "column": 2, - "program": "throwingFunctionCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck3.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck3.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck3.ets" - }, - "end": { - "line": 34, - "column": 1, - "program": "throwingFunctionCheck3.ets" - } - } -} diff --git a/ets2panda/test/compiler/ets/throwingFunctionCheck3.ets b/ets2panda/test/compiler/ets/throwingFunctionCheck3.ets deleted file mode 100644 index 0559788039c919cfc8b46ce6f754d19e17f168e1..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/throwingFunctionCheck3.ets +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2023-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -class TestClass { - constructor() throws {} - TestMethod(): void {} -} - -function TestFunction(): void throws { - let a = new TestClass(); - - try { - a.TestMethod(); - } catch (e: Exception) {} -} - -function main(): void { - try { - TestFunction(); - } catch (e) {} -} diff --git a/ets2panda/test/compiler/ets/throwingFunctionCheck6-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionCheck6-expected.txt deleted file mode 100644 index c32efe6a7fa94a54b84b72a0f0457bea6464797e..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/throwingFunctionCheck6-expected.txt +++ /dev/null @@ -1,1180 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "TestClass", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 7, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 20, - "column": 16, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "testMethod", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 3, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 21, - "column": 13, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "testMethod", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 3, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 21, - "column": 13, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 21, - "column": 17, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 21, - "column": 21, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ThrowStatement", - "argument": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Exception", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 15, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 22, - "column": 24, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 15, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 22, - "column": 25, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 15, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 22, - "column": 25, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "arguments": [], - "loc": { - "start": { - "line": 22, - "column": 11, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 22, - "column": 27, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 5, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 22, - "column": 27, - "program": "throwingFunctionCheck6.ets" - } - } - } - ], - "loc": { - "start": { - "line": 21, - "column": 29, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 23, - "column": 4, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 21, - "column": 13, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 23, - "column": 4, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 13, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 23, - "column": 4, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 3, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 23, - "column": 4, - "program": "throwingFunctionCheck6.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 20, - "column": 18, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 20, - "column": 18, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 20, - "column": 18, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 20, - "column": 18, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 20, - "column": 18, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 20, - "column": 18, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - } - ], - "loc": { - "start": { - "line": 20, - "column": 17, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 26, - "column": 9, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 1, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 26, - "column": 9, - "program": "throwingFunctionCheck6.ets" - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck6.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 16, - "column": 22, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 16, - "column": 22, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 26, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 16, - "column": 30, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ThrowStatement", - "argument": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Exception", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 13, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 17, - "column": 22, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 13, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 17, - "column": 23, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 13, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 17, - "column": 23, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "arguments": [], - "loc": { - "start": { - "line": 17, - "column": 9, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 17, - "column": 25, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 3, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 17, - "column": 25, - "program": "throwingFunctionCheck6.ets" - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 38, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "throwingFunctionCheck6.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 10, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 26, - "column": 14, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 10, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 26, - "column": 14, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 26, - "column": 18, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 26, - "column": 22, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "testClass", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 7, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 27, - "column": 16, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "init": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "TestClass", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 23, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 27, - "column": 32, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 23, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 27, - "column": 33, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 23, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 27, - "column": 33, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "arguments": [], - "loc": { - "start": { - "line": 27, - "column": 19, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 27, - "column": 35, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 7, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 27, - "column": 35, - "program": "throwingFunctionCheck6.ets" - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 27, - "column": 3, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 27, - "column": 35, - "program": "throwingFunctionCheck6.ets" - } - } - }, - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "TestFunction", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 5, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 30, - "column": 17, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 30, - "column": 5, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 30, - "column": 19, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 5, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 30, - "column": 20, - "program": "throwingFunctionCheck6.ets" - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "testClass", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 5, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 31, - "column": 14, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "property": { - "type": "Identifier", - "name": "testMethod", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 15, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 31, - "column": 25, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 31, - "column": 5, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 31, - "column": 25, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 31, - "column": 5, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 31, - "column": 27, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 5, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 31, - "column": 28, - "program": "throwingFunctionCheck6.ets" - } - } - } - ], - "loc": { - "start": { - "line": 29, - "column": 7, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 32, - "column": 4, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "handler": [ - { - "type": "CatchClause", - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 32, - "column": 15, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 32, - "column": 17, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "param": { - "type": "Identifier", - "name": "e", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 12, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 32, - "column": 13, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 5, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 32, - "column": 17, - "program": "throwingFunctionCheck6.ets" - } - } - } - ], - "finalizer": null, - "loc": { - "start": { - "line": 29, - "column": 3, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 32, - "column": 17, - "program": "throwingFunctionCheck6.ets" - } - } - } - ], - "loc": { - "start": { - "line": 26, - "column": 23, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 33, - "column": 2, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 10, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 33, - "column": 2, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 10, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 33, - "column": 2, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 1, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 33, - "column": 2, - "program": "throwingFunctionCheck6.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck6.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck6.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionCheck6.ets" - }, - "end": { - "line": 34, - "column": 1, - "program": "throwingFunctionCheck6.ets" - } - } -} diff --git a/ets2panda/test/compiler/ets/throwingFunctionCheck6.ets b/ets2panda/test/compiler/ets/throwingFunctionCheck6.ets deleted file mode 100644 index 68e086afb3e8f065f9d7612bc7b1f389025e20ba..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/throwingFunctionCheck6.ets +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2023-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function TestFunction(): void throws { - throw new Exception(); -} - -class TestClass { - testMethod(): void throws { - throw new Exception(); - } -} - -function main(): void { - let testClass = new TestClass(); - - try { - TestFunction(); - testClass.testMethod(); - } catch (e) {} -} diff --git a/ets2panda/test/compiler/ets/throwingFunctionType1-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionType1-expected.txt deleted file mode 100644 index 27e49fb62650dee71dbbe83077b7141f98546f65..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/throwingFunctionType1-expected.txt +++ /dev/null @@ -1,654 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "TSTypeAliasDeclaration", - "id": { - "type": "Identifier", - "name": "func_type", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 6, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 16, - "column": 15, - "program": "throwingFunctionType1.ets" - } - } - }, - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 24, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 16, - "column": 28, - "program": "throwingFunctionType1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 16, - "column": 18, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 16, - "column": 28, - "program": "throwingFunctionType1.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 16, - "column": 36, - "program": "throwingFunctionType1.ets" - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionType1.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionType1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionType1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionType1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionType1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 18, - "column": 14, - "program": "throwingFunctionType1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 18, - "column": 14, - "program": "throwingFunctionType1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 18, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 18, - "column": 22, - "program": "throwingFunctionType1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "a", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "func_type", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 10, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 19, - "column": 19, - "program": "throwingFunctionType1.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 10, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 19, - "column": 21, - "program": "throwingFunctionType1.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 10, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 19, - "column": 21, - "program": "throwingFunctionType1.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 7, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 19, - "column": 8, - "program": "throwingFunctionType1.ets" - } - } - }, - "init": { - "type": "ArrowFunctionExpression", - "function": { - "type": "ScriptFunction", - "id": null, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 19, - "column": 26, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 19, - "column": 30, - "program": "throwingFunctionType1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 19, - "column": 34, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 19, - "column": 36, - "program": "throwingFunctionType1.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 22, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 19, - "column": 36, - "program": "throwingFunctionType1.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 22, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 19, - "column": 36, - "program": "throwingFunctionType1.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 7, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 19, - "column": 36, - "program": "throwingFunctionType1.ets" - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 19, - "column": 3, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 19, - "column": 37, - "program": "throwingFunctionType1.ets" - } - } - }, - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 5, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 22, - "column": 6, - "program": "throwingFunctionType1.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 22, - "column": 5, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 22, - "column": 8, - "program": "throwingFunctionType1.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 5, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 22, - "column": 9, - "program": "throwingFunctionType1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 21, - "column": 7, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 23, - "column": 4, - "program": "throwingFunctionType1.ets" - } - } - }, - "handler": [ - { - "type": "CatchClause", - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 23, - "column": 15, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 23, - "column": 17, - "program": "throwingFunctionType1.ets" - } - } - }, - "param": { - "type": "Identifier", - "name": "e", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 12, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 23, - "column": 13, - "program": "throwingFunctionType1.ets" - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 5, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 23, - "column": 17, - "program": "throwingFunctionType1.ets" - } - } - } - ], - "finalizer": null, - "loc": { - "start": { - "line": 21, - "column": 3, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 23, - "column": 17, - "program": "throwingFunctionType1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 18, - "column": 23, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 24, - "column": 2, - "program": "throwingFunctionType1.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 24, - "column": 2, - "program": "throwingFunctionType1.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 24, - "column": 2, - "program": "throwingFunctionType1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 1, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 24, - "column": 2, - "program": "throwingFunctionType1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionType1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwingFunctionType1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwingFunctionType1.ets" - }, - "end": { - "line": 25, - "column": 1, - "program": "throwingFunctionType1.ets" - } - } -} diff --git a/ets2panda/test/compiler/ets/throwingFunctionType1.ets b/ets2panda/test/compiler/ets/throwingFunctionType1.ets deleted file mode 100644 index f10d14a016acf116aee4576a7dc5078a9a30ad8e..0000000000000000000000000000000000000000 --- a/ets2panda/test/compiler/ets/throwingFunctionType1.ets +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2023-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -type func_type = () => void throws; - -function main(): void { - let a: func_type = (): void => {}; - - try { - a(); - } catch (e) {} -} diff --git a/ets2panda/test/parser/ets/constructorThrowsRethrows-expected.txt b/ets2panda/test/parser/ets/constructorThrowsRethrows-expected.txt deleted file mode 100644 index fc27d4a34ee79ffcc919a3230282cfcf77e44870..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/constructorThrowsRethrows-expected.txt +++ /dev/null @@ -1,753 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "TestClass", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 7, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 16, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "constructor", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 17, - "column": 24, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 26, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 17, - "column": 14, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 26, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 14, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 26, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 3, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 26, - "program": "constructorThrowsRethrows.ets" - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 17, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 6, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 6, - "program": "constructorThrowsRethrows.ets" - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "TestClassToo", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 7, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 19, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "constructor", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "param", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "c", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 21, - "column": 26, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 29, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 23, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 29, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 23, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 29, - "program": "constructorThrowsRethrows.ets" - } - } - }, - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "b", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 21, - "column": 34, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 37, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 31, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 37, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 31, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 37, - "program": "constructorThrowsRethrows.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 21, - "column": 42, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 46, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 21, - "column": 22, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 46, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 15, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 46, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 15, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 46, - "program": "constructorThrowsRethrows.ets" - } - } - } - ], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 21, - "column": 64, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 66, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 21, - "column": 14, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 66, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 14, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 66, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 3, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 66, - "program": "constructorThrowsRethrows.ets" - } - } - } - ], - "loc": { - "start": { - "line": 20, - "column": 20, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 23, - "column": 1, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 1, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 23, - "column": 1, - "program": "constructorThrowsRethrows.ets" - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "constructorThrowsRethrows.ets" - }, - "end": { - "line": 23, - "column": 1, - "program": "constructorThrowsRethrows.ets" - } - } -} diff --git a/ets2panda/test/parser/ets/constructorThrowsRethrows.ets b/ets2panda/test/parser/ets/constructorThrowsRethrows.ets deleted file mode 100644 index b65c49c82c69c8ff89b8d0eeb1040c86ae97c1e2..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/constructorThrowsRethrows.ets +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -class TestClass { - constructor() throws {} -} - -class TestClassToo { - constructor(param: (c: int, b: int) => char throws) rethrows {} -} diff --git a/ets2panda/test/parser/ets/functionThrowsRethrows-expected.txt b/ets2panda/test/parser/ets/functionThrowsRethrows-expected.txt deleted file mode 100644 index b96db2bcbbe64ba9afa0e8a81a1824ef677ebc99..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/functionThrowsRethrows-expected.txt +++ /dev/null @@ -1,809 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "testFunction", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 22, - "program": "functionThrowsRethrows.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "testFunction", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 22, - "program": "functionThrowsRethrows.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 26, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 30, - "program": "functionThrowsRethrows.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ThrowStatement", - "argument": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Exception", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 15, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 24, - "program": "functionThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 15, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 25, - "program": "functionThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 15, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 25, - "program": "functionThrowsRethrows.ets" - } - } - }, - "arguments": [], - "loc": { - "start": { - "line": 17, - "column": 11, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 27, - "program": "functionThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 5, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 27, - "program": "functionThrowsRethrows.ets" - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 38, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "functionThrowsRethrows.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "functionThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "functionThrowsRethrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 2, - "program": "functionThrowsRethrows.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "testFunctionToo", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 25, - "program": "functionThrowsRethrows.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "testFunctionToo", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 25, - "program": "functionThrowsRethrows.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "param", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "c", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 37, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 40, - "program": "functionThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 34, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 40, - "program": "functionThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 34, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 40, - "program": "functionThrowsRethrows.ets" - } - } - }, - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "b", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 45, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 48, - "program": "functionThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 42, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 48, - "program": "functionThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 42, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 48, - "program": "functionThrowsRethrows.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 53, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 57, - "program": "functionThrowsRethrows.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 20, - "column": 33, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 57, - "program": "functionThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 26, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 57, - "program": "functionThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 26, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 57, - "program": "functionThrowsRethrows.ets" - } - } - }, - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "p", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 69, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 72, - "program": "functionThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 66, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 72, - "program": "functionThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 66, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 72, - "program": "functionThrowsRethrows.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 75, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 79, - "program": "functionThrowsRethrows.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 20, - "column": 89, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 91, - "program": "functionThrowsRethrows.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 91, - "program": "functionThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 91, - "program": "functionThrowsRethrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 1, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 20, - "column": 91, - "program": "functionThrowsRethrows.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 1, - "program": "functionThrowsRethrows.ets" - } - } -} diff --git a/ets2panda/test/parser/ets/functionThrowsRethrows.ets b/ets2panda/test/parser/ets/functionThrowsRethrows.ets deleted file mode 100644 index 72068bbf3ee842db1e426a0f19024ddd62e5e37f..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/functionThrowsRethrows.ets +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function testFunction(): void throws { - throw new Exception(); -} - -function testFunctionToo(param: (c: int, b: int) => char throws, p: int): void rethrows {} diff --git a/ets2panda/test/parser/ets/functionTypeThrows-expected.txt b/ets2panda/test/parser/ets/functionTypeThrows-expected.txt deleted file mode 100644 index 958f5cc5a8398a221cc3397111f7e063968cbc8d..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/functionTypeThrows-expected.txt +++ /dev/null @@ -1,446 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - } - } - }, - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 16, - "column": 6, - "program": "functionTypeThrows.ets" - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "c", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 12, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 16, - "column": 15, - "program": "functionTypeThrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 9, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 16, - "column": 15, - "program": "functionTypeThrows.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 9, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 16, - "column": 15, - "program": "functionTypeThrows.ets" - } - } - }, - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "b", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 20, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 16, - "column": 23, - "program": "functionTypeThrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 17, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 16, - "column": 23, - "program": "functionTypeThrows.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 17, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 16, - "column": 23, - "program": "functionTypeThrows.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 28, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 16, - "column": 32, - "program": "functionTypeThrows.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 16, - "column": 8, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 16, - "column": 32, - "program": "functionTypeThrows.ets" - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 16, - "column": 6, - "program": "functionTypeThrows.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "functionTypeThrows.ets" - }, - "end": { - "line": 17, - "column": 1, - "program": "functionTypeThrows.ets" - } - } -} diff --git a/ets2panda/test/parser/ets/functionTypeThrows.ets b/ets2panda/test/parser/ets/functionTypeThrows.ets deleted file mode 100644 index ea71c959319701129d766995452b47bd601438b9..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/functionTypeThrows.ets +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -let a: (c: int, b: int) => char throws; diff --git a/ets2panda/test/parser/ets/lambdaThrowsRethrows-expected.txt b/ets2panda/test/parser/ets/lambdaThrowsRethrows-expected.txt deleted file mode 100644 index bd0a01e4a11a1d0def2f2e002fecb556bd5de882..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/lambdaThrowsRethrows-expected.txt +++ /dev/null @@ -1,974 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "lambda", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 11, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "right": { - "type": "ArrowFunctionExpression", - "function": { - "type": "ScriptFunction", - "id": null, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 37, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 41, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 16, - "column": 52, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 54, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 16, - "column": 33, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 54, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 33, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 54, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 54, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 54, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "lambda2", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 5, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 12, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "right": { - "type": "ArrowFunctionExpression", - "function": { - "type": "ScriptFunction", - "id": null, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "param", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "c", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 84, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 87, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 81, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 87, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 81, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 87, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "b", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 92, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 95, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 89, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 95, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 89, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 95, - "program": "lambdaThrowsRethrows.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 100, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 104, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 18, - "column": 80, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 104, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 73, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 104, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 73, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 104, - "program": "lambdaThrowsRethrows.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 114, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 118, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 18, - "column": 131, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 133, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 18, - "column": 72, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 133, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 72, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 133, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 5, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 133, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 5, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 133, - "program": "lambdaThrowsRethrows.ets" - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 133, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 133, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 133, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 133, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "lambda", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 11, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 19, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 23, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 16, - "column": 13, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 23, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 54, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "lambda2", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 5, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 12, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "param", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "c", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 26, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 29, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 23, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 29, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 23, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 29, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "b", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 34, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 37, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 31, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 37, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 31, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 37, - "program": "lambdaThrowsRethrows.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 42, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 46, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 18, - "column": 22, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 46, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 15, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 46, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 15, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 46, - "program": "lambdaThrowsRethrows.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 58, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 62, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 18, - "column": 14, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 62, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 5, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 18, - "column": 133, - "program": "lambdaThrowsRethrows.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 1, - "program": "lambdaThrowsRethrows.ets" - } - } -} diff --git a/ets2panda/test/parser/ets/lambdaThrowsRethrows.ets b/ets2panda/test/parser/ets/lambdaThrowsRethrows.ets deleted file mode 100644 index b64b5c33091ac5249fb46c8d2af9c94f547e477c..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/lambdaThrowsRethrows.ets +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -let lambda: () => void throws = (): void throws => {} - -let lambda2: (param: (c: int, b: int) => char throws) => void throws = (param: (c: int, b: int) => char throws): void rethrows => {} diff --git a/ets2panda/test/parser/ets/methodThrowsRethrows-expected.txt b/ets2panda/test/parser/ets/methodThrowsRethrows-expected.txt deleted file mode 100644 index a61e13a38ff1a0042ae29a9c5f8c9ff6d0c5e384..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/methodThrowsRethrows-expected.txt +++ /dev/null @@ -1,838 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "TestClass", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 7, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 16, - "program": "methodThrowsRethrows.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "testMethodThrows", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 3, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 19, - "program": "methodThrowsRethrows.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "testMethodThrows", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 3, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 19, - "program": "methodThrowsRethrows.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 17, - "column": 23, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 27, - "program": "methodThrowsRethrows.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 17, - "column": 35, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 37, - "program": "methodThrowsRethrows.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 17, - "column": 19, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 37, - "program": "methodThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 19, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 37, - "program": "methodThrowsRethrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 3, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 17, - "column": 37, - "program": "methodThrowsRethrows.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "testMethodRethrows", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 3, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 21, - "program": "methodThrowsRethrows.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "testMethodRethrows", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 3, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 21, - "program": "methodThrowsRethrows.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "param", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "c", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 19, - "column": 33, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 36, - "program": "methodThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 30, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 36, - "program": "methodThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 30, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 36, - "program": "methodThrowsRethrows.ets" - } - } - }, - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "b", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 19, - "column": 41, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 44, - "program": "methodThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 38, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 44, - "program": "methodThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 38, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 44, - "program": "methodThrowsRethrows.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 19, - "column": 49, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 53, - "program": "methodThrowsRethrows.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 19, - "column": 29, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 53, - "program": "methodThrowsRethrows.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 22, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 53, - "program": "methodThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 22, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 53, - "program": "methodThrowsRethrows.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 19, - "column": 63, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 67, - "program": "methodThrowsRethrows.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 19, - "column": 77, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 79, - "program": "methodThrowsRethrows.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 19, - "column": 21, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 79, - "program": "methodThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 21, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 79, - "program": "methodThrowsRethrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 3, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 19, - "column": 79, - "program": "methodThrowsRethrows.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 18, - "program": "methodThrowsRethrows.ets" - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 18, - "program": "methodThrowsRethrows.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 16, - "column": 18, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 18, - "program": "methodThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 18, - "program": "methodThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 16, - "column": 18, - "program": "methodThrowsRethrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 17, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 1, - "program": "methodThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 1, - "program": "methodThrowsRethrows.ets" - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "methodThrowsRethrows.ets" - }, - "end": { - "line": 21, - "column": 1, - "program": "methodThrowsRethrows.ets" - } - } -} diff --git a/ets2panda/test/parser/ets/methodThrowsRethrows.ets b/ets2panda/test/parser/ets/methodThrowsRethrows.ets deleted file mode 100644 index 8467cf16b78aa7baf2ed41c2de8b6eefce7e91bb..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/methodThrowsRethrows.ets +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -class TestClass { - testMethodThrows(): void throws {} - - testMethodRethrows(param: (c: int, b: int) => char throws): void rethrows {} -} diff --git a/ets2panda/test/parser/ets/method_override_throw_1-expected.txt b/ets2panda/test/parser/ets/method_override_throw_1-expected.txt deleted file mode 100644 index c0514cc782fdf182b69391c4c295bf564634d32e..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/method_override_throw_1-expected.txt +++ /dev/null @@ -1,2575 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "TSInterfaceDeclaration", - "body": { - "type": "TSInterfaceBody", - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo1", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 17, - "column": 9, - "program": "method_override_throw_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo1", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 17, - "column": 9, - "program": "method_override_throw_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 17, - "column": 13, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 17, - "column": 17, - "program": "method_override_throw_1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 17, - "column": 9, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 17, - "column": 17, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 9, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 17, - "column": 17, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 17, - "column": 25, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo2", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 18, - "column": 9, - "program": "method_override_throw_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo2", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 18, - "column": 9, - "program": "method_override_throw_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "param", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 23, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 18, - "column": 27, - "program": "method_override_throw_1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 18, - "column": 17, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 18, - "column": 27, - "program": "method_override_throw_1.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 18, - "column": 27, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 18, - "column": 27, - "program": "method_override_throw_1.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 37, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 18, - "column": 41, - "program": "method_override_throw_1.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 18, - "column": 9, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 18, - "column": 41, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 9, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 18, - "column": 41, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 18, - "column": 51, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo3", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 19, - "column": 9, - "program": "method_override_throw_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo3", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 19, - "column": 9, - "program": "method_override_throw_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 19, - "column": 13, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 19, - "column": 17, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 9, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 19, - "column": 17, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 9, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 19, - "column": 17, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 19, - "column": 18, - "program": "method_override_throw_1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 13, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 20, - "column": 2, - "program": "method_override_throw_1.ets" - } - } - }, - "id": { - "type": "Identifier", - "name": "A", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 11, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 16, - "column": 12, - "program": "method_override_throw_1.ets" - } - } - }, - "extends": [], - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 22, - "column": 6, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "AClass", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 7, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 22, - "column": 13, - "program": "method_override_throw_1.ets" - } - } - }, - "superClass": null, - "implements": [ - { - "type": "TSClassImplements", - "expression": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "A", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 25, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 22, - "column": 26, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 25, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 22, - "column": 28, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 25, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 22, - "column": 28, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 25, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 22, - "column": 28, - "program": "method_override_throw_1.ets" - } - } - } - ], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo1", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 14, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 23, - "column": 18, - "program": "method_override_throw_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo1", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 14, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 23, - "column": 18, - "program": "method_override_throw_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 23, - "column": 22, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 23, - "column": 26, - "program": "method_override_throw_1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 23, - "column": 34, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 23, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 23, - "column": 18, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 23, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 18, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 23, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 23, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo2", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 14, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 24, - "column": 18, - "program": "method_override_throw_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo2", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 14, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 24, - "column": 18, - "program": "method_override_throw_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "param", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 24, - "column": 32, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 24, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 24, - "column": 26, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 24, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 19, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 24, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 19, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 24, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 24, - "column": 46, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 24, - "column": 50, - "program": "method_override_throw_1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 24, - "column": 60, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 24, - "column": 62, - "program": "method_override_throw_1.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 24, - "column": 18, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 24, - "column": 62, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 18, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 24, - "column": 62, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 24, - "column": 62, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo3", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 14, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 25, - "column": 18, - "program": "method_override_throw_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo3", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 14, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 25, - "column": 18, - "program": "method_override_throw_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 25, - "column": 22, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 25, - "column": 26, - "program": "method_override_throw_1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 25, - "column": 27, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 25, - "column": 29, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 18, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 25, - "column": 29, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 18, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 25, - "column": 29, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 25, - "column": 29, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 28, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 22, - "column": 28, - "program": "method_override_throw_1.ets" - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 28, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 22, - "column": 28, - "program": "method_override_throw_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 22, - "column": 28, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 22, - "column": 28, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 28, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 22, - "column": 28, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 28, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 22, - "column": 28, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - } - ], - "loc": { - "start": { - "line": 22, - "column": 27, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 28, - "column": 6, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 1, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 28, - "column": 6, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "BClass", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 7, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 28, - "column": 13, - "program": "method_override_throw_1.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo1", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 29, - "column": 9, - "program": "method_override_throw_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo1", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 29, - "column": 9, - "program": "method_override_throw_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 29, - "column": 13, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 29, - "column": 17, - "program": "method_override_throw_1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 29, - "column": 25, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 29, - "column": 27, - "program": "method_override_throw_1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 29, - "column": 9, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 29, - "column": 27, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 9, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 29, - "column": 27, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 29, - "column": 27, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo2", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 30, - "column": 9, - "program": "method_override_throw_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo2", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 30, - "column": 9, - "program": "method_override_throw_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "param", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 30, - "column": 23, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 30, - "column": 27, - "program": "method_override_throw_1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 30, - "column": 17, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 30, - "column": 27, - "program": "method_override_throw_1.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 10, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 30, - "column": 27, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 10, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 30, - "column": 27, - "program": "method_override_throw_1.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 30, - "column": 37, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 30, - "column": 41, - "program": "method_override_throw_1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 30, - "column": 51, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 30, - "column": 53, - "program": "method_override_throw_1.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 30, - "column": 9, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 30, - "column": 53, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 9, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 30, - "column": 53, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 30, - "column": 53, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo3", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 31, - "column": 9, - "program": "method_override_throw_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo3", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 31, - "column": 9, - "program": "method_override_throw_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 31, - "column": 13, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 31, - "column": 17, - "program": "method_override_throw_1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 31, - "column": 18, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 31, - "column": 20, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 9, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 31, - "column": 20, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 9, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 31, - "column": 20, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 31, - "column": 20, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 15, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 28, - "column": 15, - "program": "method_override_throw_1.ets" - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 15, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 28, - "column": 15, - "program": "method_override_throw_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 28, - "column": 15, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 28, - "column": 15, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 15, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 28, - "column": 15, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 15, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 28, - "column": 15, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - } - ], - "loc": { - "start": { - "line": 28, - "column": 14, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 34, - "column": 6, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 1, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 34, - "column": 6, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "CClass", - "decorators": [], - "loc": { - "start": { - "line": 34, - "column": 13, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 34, - "column": 19, - "program": "method_override_throw_1.ets" - } - } - }, - "superClass": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "BClass", - "decorators": [], - "loc": { - "start": { - "line": 34, - "column": 28, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 34, - "column": 34, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 34, - "column": 28, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 34, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 34, - "column": 28, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 34, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo1", - "decorators": [], - "loc": { - "start": { - "line": 35, - "column": 14, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 35, - "column": 18, - "program": "method_override_throw_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo1", - "decorators": [], - "loc": { - "start": { - "line": 35, - "column": 14, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 35, - "column": 18, - "program": "method_override_throw_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 35, - "column": 22, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 35, - "column": 26, - "program": "method_override_throw_1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 35, - "column": 34, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 35, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 35, - "column": 18, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 35, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 35, - "column": 18, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 35, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 35, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 35, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo2", - "decorators": [], - "loc": { - "start": { - "line": 36, - "column": 14, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 36, - "column": 18, - "program": "method_override_throw_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo2", - "decorators": [], - "loc": { - "start": { - "line": 36, - "column": 14, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 36, - "column": 18, - "program": "method_override_throw_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "param", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 36, - "column": 32, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 36, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 36, - "column": 26, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 36, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 36, - "column": 19, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 36, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 36, - "column": 19, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 36, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 36, - "column": 46, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 36, - "column": 50, - "program": "method_override_throw_1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 36, - "column": 60, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 36, - "column": 62, - "program": "method_override_throw_1.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 36, - "column": 18, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 36, - "column": 62, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 36, - "column": 18, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 36, - "column": 62, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 36, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 36, - "column": 62, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo3", - "decorators": [], - "loc": { - "start": { - "line": 37, - "column": 14, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 37, - "column": 18, - "program": "method_override_throw_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo3", - "decorators": [], - "loc": { - "start": { - "line": 37, - "column": 14, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 37, - "column": 18, - "program": "method_override_throw_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 37, - "column": 22, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 37, - "column": 26, - "program": "method_override_throw_1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 37, - "column": 27, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 37, - "column": 29, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 37, - "column": 18, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 37, - "column": 29, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 37, - "column": 18, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 37, - "column": 29, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 37, - "column": 5, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 37, - "column": 29, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 34, - "column": 36, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 34, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 34, - "column": 36, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 34, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 34, - "column": 36, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 34, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 34, - "column": 36, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 34, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 34, - "column": 36, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 34, - "column": 36, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - } - ], - "loc": { - "start": { - "line": 34, - "column": 35, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 39, - "column": 1, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 34, - "column": 7, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 39, - "column": 1, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "method_override_throw_1.ets" - }, - "end": { - "line": 39, - "column": 1, - "program": "method_override_throw_1.ets" - } - } -} diff --git a/ets2panda/test/parser/ets/method_override_throw_1.ets b/ets2panda/test/parser/ets/method_override_throw_1.ets deleted file mode 100644 index 049740e94fcc3fc4a5684ee167733c9dfff1bf5a..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/method_override_throw_1.ets +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -interface A { - foo1(): void throws; - foo2(param: () => void throws): void rethrows; - foo3(): void; -} - -class AClass implements A { - override foo1(): void throws {} - override foo2(param: () => void throws): void rethrows {} - override foo3(): void {} -} - -class BClass { - foo1(): void throws {} - foo2(param: () => void throws): void rethrows {} - foo3(): void {} -} - -final class CClass extends BClass { - override foo1(): void throws {} - override foo2(param: () => void throws): void rethrows {} - override foo3(): void {} -} diff --git a/ets2panda/test/parser/ets/rethrow-func-1-expected.txt b/ets2panda/test/parser/ets/rethrow-func-1-expected.txt deleted file mode 100644 index 225519beb759921acf0c316eb2c906d18d00cd80..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/rethrow-func-1-expected.txt +++ /dev/null @@ -1,1278 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "TSTypeAliasDeclaration", - "id": { - "type": "Identifier", - "name": "func_type", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 6, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 16, - "column": 15, - "program": "rethrow-func-1.ets" - } - } - }, - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 24, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 16, - "column": 28, - "program": "rethrow-func-1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 16, - "column": 18, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 16, - "column": 28, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 16, - "column": 36, - "program": "rethrow-func-1.ets" - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrow-func-1.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrow-func-1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrow-func-1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "RethrowingFunc", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 18, - "column": 24, - "program": "rethrow-func-1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "RethrowingFunc", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 18, - "column": 24, - "program": "rethrow-func-1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "f121f", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "func_type", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 32, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 18, - "column": 41, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 32, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 18, - "column": 42, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 32, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 18, - "column": 42, - "program": "rethrow-func-1.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 25, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 18, - "column": 42, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 25, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 18, - "column": 42, - "program": "rethrow-func-1.ets" - } - } - } - ], - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "console", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 5, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 19, - "column": 12, - "program": "rethrow-func-1.ets" - } - } - }, - "property": { - "type": "Identifier", - "name": "println", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 13, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 19, - "column": 20, - "program": "rethrow-func-1.ets" - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 19, - "column": 5, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 19, - "column": 20, - "program": "rethrow-func-1.ets" - } - } - }, - "arguments": [ - { - "type": "StringLiteral", - "value": "Hello in RethrowingFunc", - "loc": { - "start": { - "line": 19, - "column": 21, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 19, - "column": 46, - "program": "rethrow-func-1.ets" - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 19, - "column": 5, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 19, - "column": 47, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 5, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 19, - "column": 47, - "program": "rethrow-func-1.ets" - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "f121f", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 5, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 20, - "column": 10, - "program": "rethrow-func-1.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 20, - "column": 5, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 20, - "column": 12, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 5, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 20, - "column": 12, - "program": "rethrow-func-1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 18, - "column": 52, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 21, - "column": 2, - "program": "rethrow-func-1.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 21, - "column": 2, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 21, - "column": 2, - "program": "rethrow-func-1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 1, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 21, - "column": 2, - "program": "rethrow-func-1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 10, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 23, - "column": 14, - "program": "rethrow-func-1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 10, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 23, - "column": 14, - "program": "rethrow-func-1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 23, - "column": 18, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 23, - "column": 22, - "program": "rethrow-func-1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "my_var", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "func_type", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 17, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 24, - "column": 26, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 17, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 24, - "column": 28, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 17, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 24, - "column": 28, - "program": "rethrow-func-1.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 9, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 24, - "column": 15, - "program": "rethrow-func-1.ets" - } - } - }, - "init": { - "type": "ArrowFunctionExpression", - "function": { - "type": "ScriptFunction", - "id": null, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 24, - "column": 33, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 24, - "column": 37, - "program": "rethrow-func-1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "console", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 9, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 25, - "column": 16, - "program": "rethrow-func-1.ets" - } - } - }, - "property": { - "type": "Identifier", - "name": "println", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 17, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 25, - "column": 24, - "program": "rethrow-func-1.ets" - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 25, - "column": 9, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 25, - "column": 24, - "program": "rethrow-func-1.ets" - } - } - }, - "arguments": [ - { - "type": "StringLiteral", - "value": "Hello in my_var", - "loc": { - "start": { - "line": 25, - "column": 25, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 25, - "column": 42, - "program": "rethrow-func-1.ets" - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 25, - "column": 9, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 25, - "column": 43, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 9, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 25, - "column": 43, - "program": "rethrow-func-1.ets" - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 13, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 26, - "column": 14, - "program": "rethrow-func-1.ets" - } - } - }, - "init": { - "type": "NumberLiteral", - "value": 2147483647, - "loc": { - "start": { - "line": 26, - "column": 17, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 26, - "column": 22, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 13, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 26, - "column": 22, - "program": "rethrow-func-1.ets" - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 26, - "column": 9, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 26, - "column": 22, - "program": "rethrow-func-1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 24, - "column": 41, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 27, - "column": 6, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 29, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 27, - "column": 6, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 29, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 27, - "column": 6, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 9, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 27, - "column": 6, - "program": "rethrow-func-1.ets" - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 24, - "column": 5, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 27, - "column": 6, - "program": "rethrow-func-1.ets" - } - } - }, - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "RethrowingFunc", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 9, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 29, - "column": 23, - "program": "rethrow-func-1.ets" - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "my_var", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 24, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 29, - "column": 30, - "program": "rethrow-func-1.ets" - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 29, - "column": 9, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 29, - "column": 31, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 9, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 29, - "column": 32, - "program": "rethrow-func-1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 28, - "column": 9, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 30, - "column": 6, - "program": "rethrow-func-1.ets" - } - } - }, - "handler": [ - { - "type": "CatchClause", - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "console", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 9, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 31, - "column": 16, - "program": "rethrow-func-1.ets" - } - } - }, - "property": { - "type": "Identifier", - "name": "println", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 17, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 31, - "column": 24, - "program": "rethrow-func-1.ets" - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 31, - "column": 9, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 31, - "column": 24, - "program": "rethrow-func-1.ets" - } - } - }, - "arguments": [ - { - "type": "StringLiteral", - "value": "Hello in exception", - "loc": { - "start": { - "line": 31, - "column": 25, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 31, - "column": 45, - "program": "rethrow-func-1.ets" - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 31, - "column": 9, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 31, - "column": 46, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 9, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 31, - "column": 46, - "program": "rethrow-func-1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 30, - "column": 17, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 32, - "column": 6, - "program": "rethrow-func-1.ets" - } - } - }, - "param": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 14, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 30, - "column": 15, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 7, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 32, - "column": 6, - "program": "rethrow-func-1.ets" - } - } - } - ], - "finalizer": null, - "loc": { - "start": { - "line": 28, - "column": 5, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 32, - "column": 6, - "program": "rethrow-func-1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 23, - "column": 23, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 33, - "column": 2, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 10, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 33, - "column": 2, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 10, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 33, - "column": 2, - "program": "rethrow-func-1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 1, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 33, - "column": 2, - "program": "rethrow-func-1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrow-func-1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "rethrow-func-1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "rethrow-func-1.ets" - }, - "end": { - "line": 34, - "column": 1, - "program": "rethrow-func-1.ets" - } - } -} -SyntaxError: Division by zero is not allowed. [rethrow-func-1.ets:26:17] diff --git a/ets2panda/test/parser/ets/rethrow-func-1.ets b/ets2panda/test/parser/ets/rethrow-func-1.ets deleted file mode 100644 index 99f7c27a2f1cd22281f8db9c538fdad2bd65ed2a..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/rethrow-func-1.ets +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -type func_type = () => void throws; - -function RethrowingFunc(f121f: func_type) rethrows { - console.println("Hello in RethrowingFunc") - f121f() -} - -function main(): void { - let my_var: func_type = (): void => { - console.println("Hello in my_var") - let a = 1 / 0 - } - try { - RethrowingFunc(my_var); - } catch (a) { - console.println("Hello in exception") - } -} diff --git a/ets2panda/test/parser/ets/throwsRethrowsAsVariables-expected.txt b/ets2panda/test/parser/ets/throwsRethrowsAsVariables-expected.txt deleted file mode 100644 index 1279b59d4fab4807f5a61aa4b92fd760464c080d..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/throwsRethrowsAsVariables-expected.txt +++ /dev/null @@ -1,829 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "throws", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 16, - "column": 11, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "right": { - "type": "NumberLiteral", - "value": 1, - "loc": { - "start": { - "line": 16, - "column": 14, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 16, - "column": 15, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 16, - "column": 15, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 16, - "column": 15, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "rethrows", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 5, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 17, - "column": 13, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "right": { - "type": "NumberLiteral", - "value": 2, - "loc": { - "start": { - "line": 17, - "column": 16, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 17, - "column": 17, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 5, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 17, - "column": 17, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 5, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 17, - "column": 17, - "program": "throwsRethrowsAsVariables.ets" - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 17, - "column": 17, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 17, - "column": 17, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 17, - "column": 17, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 17, - "column": 17, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "throws", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 16, - "column": 11, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "value": { - "type": "NumberLiteral", - "value": 1, - "loc": { - "start": { - "line": 16, - "column": 14, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 16, - "column": 15, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 5, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 16, - "column": 15, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "rethrows", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 5, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 17, - "column": 13, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "value": { - "type": "NumberLiteral", - "value": 2, - "loc": { - "start": { - "line": 17, - "column": 16, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 17, - "column": 17, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 5, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 17, - "column": 17, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "testFunction", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 10, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 19, - "column": 22, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "testFunction", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 10, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 19, - "column": 22, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 19, - "column": 26, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 19, - "column": 30, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 19, - "column": 38, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 19, - "column": 40, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 19, - "column": 10, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 19, - "column": 40, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 10, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 19, - "column": 40, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 19, - "column": 40, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "testFunction2", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 20, - "column": 23, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "testFunction2", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 20, - "column": 23, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "f", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 33, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 20, - "column": 37, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 20, - "column": 27, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 20, - "column": 37, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 24, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 20, - "column": 37, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 24, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 20, - "column": 37, - "program": "throwsRethrowsAsVariables.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 47, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 20, - "column": 51, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 20, - "column": 61, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 20, - "column": 63, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 20, - "column": 63, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 20, - "column": 63, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 20, - "column": 63, - "program": "throwsRethrowsAsVariables.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - }, - "end": { - "line": 21, - "column": 1, - "program": "throwsRethrowsAsVariables.ets" - } - } -} diff --git a/ets2panda/test/parser/ets/throwsRethrowsAsVariables.ets b/ets2panda/test/parser/ets/throwsRethrowsAsVariables.ets deleted file mode 100644 index 2133e98a1e6c7a2db2d0c4b96134fe8cd3a9bd54..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/throwsRethrowsAsVariables.ets +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -let throws = 1; -let rethrows = 2; - -function testFunction(): void throws {} -function testFunction2(f: () => void throws): void rethrows {} diff --git a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_with_throw-expected.txt b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_with_throw-expected.txt deleted file mode 100644 index 5b56462570e3cd549a1605974fc040844f27f24e..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_with_throw-expected.txt +++ /dev/null @@ -1,817 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 16, - "column": 13, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 16, - "column": 13, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "c", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 21, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 16, - "column": 25, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 16, - "column": 17, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 16, - "column": 25, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 14, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 16, - "column": 25, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 14, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 16, - "column": 25, - "program": "trailing_lambda_with_throw.ets" - } - } - } - ], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 16, - "column": 34, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 17, - "column": 2, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 17, - "column": 2, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 17, - "column": 2, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 17, - "column": 2, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo2", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 10, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 19, - "column": 14, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo2", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 10, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 19, - "column": 14, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "c", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 19, - "column": 22, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 19, - "column": 26, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 19, - "column": 26, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 15, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 19, - "column": 26, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 15, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 19, - "column": 26, - "program": "trailing_lambda_with_throw.ets" - } - } - } - ], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 19, - "column": 28, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 20, - "column": 2, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 10, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 20, - "column": 2, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 10, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 20, - "column": 2, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 20, - "column": 2, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 22, - "column": 14, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 22, - "column": 14, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 5, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 23, - "column": 8, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 23, - "column": 5, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 25, - "column": 6, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 5, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 25, - "column": 6, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 5, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 27, - "column": 8, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 27, - "column": 5, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 27, - "column": 13, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 5, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 27, - "column": 13, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "foo2", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 5, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 29, - "column": 9, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 29, - "column": 5, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 31, - "column": 6, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 5, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 31, - "column": 6, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "foo2", - "decorators": [], - "loc": { - "start": { - "line": 33, - "column": 5, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 33, - "column": 9, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 33, - "column": 5, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 33, - "column": 14, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 33, - "column": 5, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 33, - "column": 14, - "program": "trailing_lambda_with_throw.ets" - } - } - } - ], - "loc": { - "start": { - "line": 22, - "column": 17, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 34, - "column": 2, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 34, - "column": 2, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 34, - "column": 2, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 34, - "column": 2, - "program": "trailing_lambda_with_throw.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - }, - "end": { - "line": 35, - "column": 1, - "program": "trailing_lambda_with_throw.ets" - } - } -} diff --git a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_with_throw.ets b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_with_throw.ets deleted file mode 100644 index e47cfcff81eccc717ce9ee1bc6b7ed5366d67bbc..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_with_throw.ets +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function foo(c: ()=>void throws) { -} - -function foo2(c: ()=>void) { -} - -function main() { - foo() { - throw new Error(); - } - - foo() {} - - foo2() { - throw new Error(); - } - - foo2() {} -} diff --git a/ets2panda/test/parser/ets/variable_throw_function_1-expected.txt b/ets2panda/test/parser/ets/variable_throw_function_1-expected.txt deleted file mode 100644 index d03f14a068332a123d3894446d4458eb2e260755..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/variable_throw_function_1-expected.txt +++ /dev/null @@ -1,1087 +0,0 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "variable_throw_function_1.ets" - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "_$init$_", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": null - }, - "end": { - "line": 1, - "column": 1, - "program": null - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "variable_throw_function_1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "variable_throw_function_1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "variable_throw_function_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "variable_throw_function_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 16, - "column": 13, - "program": "variable_throw_function_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 16, - "column": 13, - "program": "variable_throw_function_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 18, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 16, - "column": 22, - "program": "variable_throw_function_1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 16, - "column": 23, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 16, - "column": 25, - "program": "variable_throw_function_1.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 16, - "column": 25, - "program": "variable_throw_function_1.ets" - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 16, - "column": 25, - "program": "variable_throw_function_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 1, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 16, - "column": 25, - "program": "variable_throw_function_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "bar", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 18, - "column": 13, - "program": "variable_throw_function_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "bar", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 18, - "column": 13, - "program": "variable_throw_function_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 18, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 18, - "column": 22, - "program": "variable_throw_function_1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 18, - "column": 30, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 18, - "column": 32, - "program": "variable_throw_function_1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 18, - "column": 32, - "program": "variable_throw_function_1.ets" - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 18, - "column": 32, - "program": "variable_throw_function_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 1, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 18, - "column": 32, - "program": "variable_throw_function_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "baz", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 20, - "column": 13, - "program": "variable_throw_function_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "baz", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 20, - "column": 13, - "program": "variable_throw_function_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "e", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 23, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 20, - "column": 27, - "program": "variable_throw_function_1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 20, - "column": 17, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 20, - "column": 27, - "program": "variable_throw_function_1.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 14, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 20, - "column": 27, - "program": "variable_throw_function_1.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 14, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 20, - "column": 27, - "program": "variable_throw_function_1.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 38, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 20, - "column": 42, - "program": "variable_throw_function_1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 20, - "column": 52, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 20, - "column": 54, - "program": "variable_throw_function_1.ets" - } - } - }, - "throwMarker": "rethrows", - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 20, - "column": 54, - "program": "variable_throw_function_1.ets" - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 20, - "column": 54, - "program": "variable_throw_function_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 1, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 20, - "column": 54, - "program": "variable_throw_function_1.ets" - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 22, - "column": 14, - "program": "variable_throw_function_1.ets" - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 22, - "column": 14, - "program": "variable_throw_function_1.ets" - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 22, - "column": 18, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 22, - "column": 22, - "program": "variable_throw_function_1.ets" - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "throwing1", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 23, - "column": 26, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 23, - "column": 30, - "program": "variable_throw_function_1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 23, - "column": 20, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 23, - "column": 30, - "program": "variable_throw_function_1.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 9, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 23, - "column": 18, - "program": "variable_throw_function_1.ets" - } - } - }, - "init": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 40, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 23, - "column": 43, - "program": "variable_throw_function_1.ets" - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 9, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 23, - "column": 43, - "program": "variable_throw_function_1.ets" - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 23, - "column": 5, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 23, - "column": 44, - "program": "variable_throw_function_1.ets" - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "throwing2", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 25, - "column": 26, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 25, - "column": 30, - "program": "variable_throw_function_1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 25, - "column": 20, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 25, - "column": 30, - "program": "variable_throw_function_1.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 9, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 25, - "column": 18, - "program": "variable_throw_function_1.ets" - } - } - }, - "init": { - "type": "Identifier", - "name": "bar", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 40, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 25, - "column": 43, - "program": "variable_throw_function_1.ets" - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 9, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 25, - "column": 43, - "program": "variable_throw_function_1.ets" - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 25, - "column": 5, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 25, - "column": 44, - "program": "variable_throw_function_1.ets" - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "throwing3", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [ - { - "type": "ETSParameterExpression", - "name": { - "type": "Identifier", - "name": "e", - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 27, - "column": 30, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 27, - "column": 34, - "program": "variable_throw_function_1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 27, - "column": 24, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 27, - "column": 34, - "program": "variable_throw_function_1.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 21, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 27, - "column": 34, - "program": "variable_throw_function_1.ets" - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 21, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 27, - "column": 34, - "program": "variable_throw_function_1.ets" - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 27, - "column": 46, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 27, - "column": 50, - "program": "variable_throw_function_1.ets" - } - } - }, - "throwMarker": "throws", - "loc": { - "start": { - "line": 27, - "column": 20, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 27, - "column": 50, - "program": "variable_throw_function_1.ets" - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 9, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 27, - "column": 18, - "program": "variable_throw_function_1.ets" - } - } - }, - "init": { - "type": "Identifier", - "name": "baz", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 60, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 27, - "column": 63, - "program": "variable_throw_function_1.ets" - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 9, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 27, - "column": 63, - "program": "variable_throw_function_1.ets" - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 27, - "column": 5, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 27, - "column": 64, - "program": "variable_throw_function_1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 22, - "column": 23, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 28, - "column": 2, - "program": "variable_throw_function_1.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 28, - "column": 2, - "program": "variable_throw_function_1.ets" - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 10, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 28, - "column": 2, - "program": "variable_throw_function_1.ets" - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 1, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 28, - "column": 2, - "program": "variable_throw_function_1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "variable_throw_function_1.ets" - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 1, - "column": 1, - "program": "variable_throw_function_1.ets" - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1, - "program": "variable_throw_function_1.ets" - }, - "end": { - "line": 29, - "column": 1, - "program": "variable_throw_function_1.ets" - } - } -} diff --git a/ets2panda/test/parser/ets/variable_throw_function_1.ets b/ets2panda/test/parser/ets/variable_throw_function_1.ets deleted file mode 100644 index 498557b66044ee6db36b4a4c6d8f65ab5bee8b65..0000000000000000000000000000000000000000 --- a/ets2panda/test/parser/ets/variable_throw_function_1.ets +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function foo() : void {} - -function bar() : void throws {} - -function baz(e: () => void throws) : void rethrows {} - -function main(): void { - let throwing1: () => void throws = foo; - - let throwing2: () => void throws = bar; - - let throwing3: (e: () => void throws) => void throws = baz; -} diff --git a/ets2panda/test/runtime/ets/throwingLambdaFunctions.ets b/ets2panda/test/runtime/ets/throwingLambdaFunctions.ets deleted file mode 100644 index cf1530bf6c2a53e430255a5000acd796411f67f7..0000000000000000000000000000000000000000 --- a/ets2panda/test/runtime/ets/throwingLambdaFunctions.ets +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function funcWithThrowsParam(f: () => void throws) { - try { - f() - arktest.assertTrue(false) - } catch (e) { - arktest.assertTrue(true) - } -} - -function funcThrows(): void throws { - throw new Exception() -} - -function funcRethrows(f: () => void throws) rethrows { - f() - arktest.assertTrue(false) -} - -function funcDoubleThrows(ff: (f: () => void throws) => void throws) { - try { - ff(funcThrows) - arktest.assertTrue(false) - } catch (e) { - arktest.assertTrue(true) - } -} - -function main() { - funcWithThrowsParam(funcThrows) - - try { - funcRethrows(funcThrows) - arktest.assertTrue(false) - } catch (e) { - arktest.assertTrue(true) - } - - funcDoubleThrows(funcRethrows) -} diff --git a/ets2panda/test/unit/lsp/keyword_completion_data_test.cpp b/ets2panda/test/unit/lsp/keyword_completion_data_test.cpp index 98aeb6114f1b38c4e10f6304934a0b3e16d52087..5a2abc7429974de42d601164a8a72181c2ab2bd8 100644 --- a/ets2panda/test/unit/lsp/keyword_completion_data_test.cpp +++ b/ets2panda/test/unit/lsp/keyword_completion_data_test.cpp @@ -96,7 +96,7 @@ TEST_F(LspKeywordCompletionTests, GetKeywordCompletionsStartWithRe) std::string input = "re"; ark::es2panda::lsp::Request result = ark::es2panda::lsp::KeywordCompletionData(input); - std::vector expected = {"readonly", "rethrows", "return", "require"}; + std::vector expected = {"readonly", "return", "require"}; std::vector actual; for (const auto &entry : result.keywordCompletions) { @@ -110,7 +110,7 @@ TEST_F(LspKeywordCompletionTests, GetKeywordCompletionsStartWithRet) std::string input = "ret"; ark::es2panda::lsp::Request result = ark::es2panda::lsp::KeywordCompletionData(input); - std::vector expected = {"rethrows", "return"}; + std::vector expected = {"return"}; std::vector actual; for (const auto &entry : result.keywordCompletions) { @@ -153,7 +153,7 @@ TEST_F(LspKeywordCompletionTests, GetKeywordCompletionsSensitiveStartWithT) { std::string input = "T"; ark::es2panda::lsp::Request result = ark::es2panda::lsp::KeywordCompletionData(input); - std::vector expected = {"target", "this", "throw", "throws", "true", "try", "type", "typeof"}; + std::vector expected = {"target", "this", "throw", "true", "try", "type", "typeof"}; std::vector actual; for (const auto &entry : result.keywordCompletions) {