From bf7cc08929e6796c16902789ca7f3d7c8193d259 Mon Sep 17 00:00:00 2001 From: Anna Antipina Date: Mon, 12 Feb 2024 21:18:13 +0300 Subject: [PATCH 01/12] Title: Fix overriding of the functions with non-identical signatures Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/I91MGU Description: Softened the rules for overloading functions. Parameters are overridden with contravariance, result(return) type with covariance Test: ${ARK_SOURCE_DIR}/tests/tests-u-runner/runner.sh ${ARK_SOURCE_DIR} --ets-runtime --build-dir="${ARK_BUILD_DIR}" --heap-verifier="fail_on_verification:pre:into:before_g1_concurrent:post" --timeout=30 --force-generate --test-file Override-4.ets Signed-off-by: Anna Antipina --- ets2panda/checker/ETSAnalyzer.cpp | 2 +- ets2panda/checker/ETSchecker.h | 4 +- ets2panda/checker/ets/function.cpp | 46 +++--- ets2panda/checker/ets/helpers.cpp | 4 +- .../checker/types/ets/etsFunctionType.cpp | 2 +- ets2panda/checker/types/signature.cpp | 131 ++++++++++-------- ets2panda/checker/types/signature.h | 6 +- ets2panda/checker/types/ts/objectType.cpp | 4 +- ets2panda/checker/types/typeRelation.cpp | 4 +- ets2panda/checker/types/typeRelation.h | 8 +- ets2panda/compiler/core/ETSemitter.cpp | 4 +- ets2panda/test/runtime/ets/Override-4.ets | 39 ++++++ 12 files changed, 158 insertions(+), 96 deletions(-) create mode 100644 ets2panda/test/runtime/ets/Override-4.ets diff --git a/ets2panda/checker/ETSAnalyzer.cpp b/ets2panda/checker/ETSAnalyzer.cpp index 7917598b0e..1f6e615b3e 100644 --- a/ets2panda/checker/ETSAnalyzer.cpp +++ b/ets2panda/checker/ETSAnalyzer.cpp @@ -139,7 +139,7 @@ static void CheckExtensionIsShadowedInCurrentClassOrInterface(checker::ETSChecke const auto *const funcType = variable->TsType()->AsETSFunctionType(); for (auto *funcSignature : funcType->CallSignatures()) { signature->SetReturnType(funcSignature->ReturnType()); - if (!checker->Relation()->IsIdenticalTo(signature, funcSignature)) { + if (!checker->Relation()->IsCompatibleTo(signature, funcSignature)) { continue; } diff --git a/ets2panda/checker/ETSchecker.h b/ets2panda/checker/ETSchecker.h index 0d6920dbe5..d4200f884b 100644 --- a/ets2panda/checker/ETSchecker.h +++ b/ets2panda/checker/ETSchecker.h @@ -349,8 +349,8 @@ public: void ThrowOverrideError(Signature *signature, Signature *overriddenSignature, const OverrideErrorCode &errorCode); void CheckOverride(Signature *signature); bool CheckOverride(Signature *signature, ETSObjectType *site); - std::tuple CheckOverride(Signature *signature, Signature *other); - bool IsMethodOverridesOther(Signature *target, Signature *source); + OverrideErrorCode CheckOverride(Signature *signature, Signature *other); + bool IsMethodOverridesOther(Signature *base, Signature *derived); bool IsOverridableIn(Signature *signature); [[nodiscard]] bool AreOverrideEquivalent(Signature *s1, Signature *s2); [[nodiscard]] bool IsReturnTypeSubstitutable(Signature *s1, Signature *s2); diff --git a/ets2panda/checker/ets/function.cpp b/ets2panda/checker/ets/function.cpp index 34473739d3..b154503c4c 100644 --- a/ets2panda/checker/ets/function.cpp +++ b/ets2panda/checker/ets/function.cpp @@ -992,7 +992,7 @@ Signature *ETSChecker::CheckEveryAbstractSignatureIsOverridden(ETSFunctionType * bool isOverridden = false; for (auto sourceSig : source->CallSignatures()) { - Relation()->IsIdenticalTo(*targetSig, sourceSig); + Relation()->IsCompatibleTo(*targetSig, sourceSig); if (Relation()->IsTrue() && (*targetSig)->Function()->Id()->Name() == sourceSig->Function()->Id()->Name()) { target->CallSignatures().erase(targetSig); isOverridden = true; @@ -1023,31 +1023,32 @@ bool ETSChecker::IsOverridableIn(Signature *signature) return signature->HasSignatureFlag(SignatureFlags::PROTECTED); } -bool ETSChecker::IsMethodOverridesOther(Signature *target, Signature *source) +bool ETSChecker::IsMethodOverridesOther(Signature *base, Signature *derived) { - if (source->Function()->IsConstructor()) { + if (derived->Function()->IsConstructor()) { return false; } - if (target == source) { + if (base == derived) { return true; } - if (source->HasSignatureFlag(SignatureFlags::STATIC) != target->HasSignatureFlag(SignatureFlags::STATIC)) { + if (derived->HasSignatureFlag(SignatureFlags::STATIC) != base->HasSignatureFlag(SignatureFlags::STATIC)) { return false; } - if (IsOverridableIn(target)) { - SavedTypeRelationFlagsContext savedFlagsCtx(Relation(), TypeRelationFlag::NO_RETURN_TYPE_CHECK); - Relation()->IsIdenticalTo(target, source); + if (IsOverridableIn(base)) { + SavedTypeRelationFlagsContext savedFlagsCtx(Relation(), TypeRelationFlag::NO_RETURN_TYPE_CHECK | + TypeRelationFlag::OVERRIDING_CONTEXT); + Relation()->IsCompatibleTo(base, derived); if (Relation()->IsTrue()) { - CheckThrowMarkers(source, target); + CheckThrowMarkers(derived, base); - if (source->HasSignatureFlag(SignatureFlags::STATIC)) { + if (derived->HasSignatureFlag(SignatureFlags::STATIC)) { return false; } - source->Function()->SetOverride(); + derived->Function()->SetOverride(); return true; } } @@ -1070,26 +1071,26 @@ void ETSChecker::CheckThrowMarkers(Signature *source, Signature *target) } } -std::tuple ETSChecker::CheckOverride(Signature *signature, Signature *other) +OverrideErrorCode ETSChecker::CheckOverride(Signature *signature, Signature *other) { if (other->HasSignatureFlag(SignatureFlags::STATIC)) { ASSERT(signature->HasSignatureFlag(SignatureFlags::STATIC)); - return {true, OverrideErrorCode::NO_ERROR}; + return OverrideErrorCode::NO_ERROR; } if (other->IsFinal()) { - return {false, OverrideErrorCode::OVERRIDDEN_FINAL}; + return OverrideErrorCode::OVERRIDDEN_FINAL; } if (!IsReturnTypeSubstitutable(signature, other)) { - return {false, OverrideErrorCode::INCOMPATIBLE_RETURN}; + return OverrideErrorCode::INCOMPATIBLE_RETURN; } if (signature->ProtectionFlag() > other->ProtectionFlag()) { - return {false, OverrideErrorCode::OVERRIDDEN_WEAKER}; + return OverrideErrorCode::OVERRIDDEN_WEAKER; } - return {true, OverrideErrorCode::NO_ERROR}; + return OverrideErrorCode::NO_ERROR; } Signature *ETSChecker::AdjustForTypeParameters(Signature *source, Signature *target) @@ -1149,6 +1150,7 @@ bool ETSChecker::CheckOverride(Signature *signature, ETSObjectType *site) return isOverridingAnySignature; } + bool suitableSignatureFound = false; for (auto *it : target->TsType()->AsETSFunctionType()->CallSignatures()) { auto *itSubst = AdjustForTypeParameters(signature, it); @@ -1169,9 +1171,10 @@ bool ETSChecker::CheckOverride(Signature *signature, ETSObjectType *site) continue; } - auto [success, errorCode] = CheckOverride(signature, itSubst); - - if (!success) { + auto errorCode = CheckOverride(signature, itSubst); + if (errorCode == OverrideErrorCode::NO_ERROR) { + suitableSignatureFound = true; + } else if (!suitableSignatureFound) { ThrowOverrideError(signature, it, errorCode); } @@ -2749,7 +2752,8 @@ bool ETSChecker::AreOverrideEquivalent(Signature *const s1, Signature *const s2) // types are also the same (after the formal parameter types of N are adapted to the type parameters of M). // Signatures s1 and s2 are override-equivalent only if s1 and s2 are the same. - return s1->Function()->Id()->Name() == s2->Function()->Id()->Name() && Relation()->IsIdenticalTo(s1, s2); + SavedTypeRelationFlagsContext savedFlagsCtx(Relation(), TypeRelationFlag::OVERRIDING_CONTEXT); + return s1->Function()->Id()->Name() == s2->Function()->Id()->Name() && Relation()->IsCompatibleTo(s1, s2); } bool ETSChecker::IsReturnTypeSubstitutable(Signature *const s1, Signature *const s2) diff --git a/ets2panda/checker/ets/helpers.cpp b/ets2panda/checker/ets/helpers.cpp index 93d0759e2a..430569dcc9 100644 --- a/ets2panda/checker/ets/helpers.cpp +++ b/ets2panda/checker/ets/helpers.cpp @@ -1559,7 +1559,7 @@ ETSFunctionType *ETSChecker::FindFunctionInVectorGivenByName(util::StringView na bool ETSChecker::IsFunctionContainsSignature(ETSFunctionType *funcType, Signature *signature) { for (auto *it : funcType->CallSignatures()) { - Relation()->IsIdenticalTo(it, signature); + Relation()->IsCompatibleTo(it, signature); if (Relation()->IsTrue()) { return true; } @@ -1572,7 +1572,7 @@ void ETSChecker::CheckFunctionContainsClashingSignature(const ETSFunctionType *f { for (auto *it : funcType->CallSignatures()) { SavedTypeRelationFlagsContext strfCtx(Relation(), TypeRelationFlag::NONE); - Relation()->IsIdenticalTo(it, signature); + Relation()->IsCompatibleTo(it, signature); if (Relation()->IsTrue() && it->Function()->Id()->Name() == signature->Function()->Id()->Name()) { std::stringstream ss; it->ToString(ss, nullptr, true); diff --git a/ets2panda/checker/types/ets/etsFunctionType.cpp b/ets2panda/checker/types/ets/etsFunctionType.cpp index 72dbc3492a..2727488971 100644 --- a/ets2panda/checker/types/ets/etsFunctionType.cpp +++ b/ets2panda/checker/types/ets/etsFunctionType.cpp @@ -49,7 +49,7 @@ void ETSFunctionType::Identical(TypeRelation *relation, Type *other) return; } - callSignatures_[0]->Identical(relation, other->AsETSFunctionType()->CallSignatures()[0]); + callSignatures_[0]->Compatible(relation, other->AsETSFunctionType()->CallSignatures()[0]); } bool ETSFunctionType::AssignmentSource(TypeRelation *relation, Type *target) diff --git a/ets2panda/checker/types/signature.cpp b/ets2panda/checker/types/signature.cpp index 2546195761..02447428bf 100644 --- a/ets2panda/checker/types/signature.cpp +++ b/ets2panda/checker/types/signature.cpp @@ -198,13 +198,30 @@ std::size_t GetToCheckParamCount(Signature *signature, bool isEts) } } // namespace -bool Signature::IdenticalParameter(TypeRelation *relation, Type *type1, Type *type2) +bool Signature::CheckParameter(TypeRelation *relation, Type *type1, Type *type2) { relation->IsIdenticalTo(type1, type2); + if (relation->IsOverridingCheck() && !relation->IsTrue()) { + relation->IsSupertypeOf(type1, type2); + } + return relation->IsTrue(); +} + +bool Signature::CheckReturnType(TypeRelation *relation, Type *type1, Type *type2) +{ + if (relation->NoReturnTypeCheck()) { + return relation->Result(true); + } + if (relation->IsOverridingCheck()) { + relation->IsSupertypeOf(type2, type1); + } else { + relation->IsIdenticalTo(type1, type2); + } + return relation->IsTrue(); } -void Signature::Identical(TypeRelation *relation, Signature *other) +void Signature::Compatible(TypeRelation *relation, Signature *other) { bool isEts = relation->GetChecker()->IsETSChecker(); auto const thisToCheckParametersNumber = GetToCheckParamCount(this, isEts); @@ -219,70 +236,64 @@ void Signature::Identical(TypeRelation *relation, Signature *other) } } - if (relation->NoReturnTypeCheck()) { - relation->Result(true); - } else { - relation->IsIdenticalTo(this->ReturnType(), other->ReturnType()); + if (!CheckReturnType(relation, this->ReturnType(), other->ReturnType())) { + return; } - if (relation->IsTrue()) { - /* In ETS, the functions "foo(a: int)" and "foo(a: int, b: int = 1)" should be considered as having an - equivalent signature. Hence, we only need to check if the mandatory parameters of the signature with - more mandatory parameters can match the parameters of the other signature (including the optional - parameter or rest parameters) here. - - XXX_to_check_parameters_number is calculated beforehand by counting mandatory parameters. - Signature::params() stores all parameters (mandatory and optional), excluding the rest parameter. - Signature::restVar() stores the rest parameters of the function. - - For example: - foo(a: int): params().size: 1, to_check_param_number: 1, restVar: nullptr - foo(a: int, b: int = 0): params().size: 2, to_check_param_number: 1, restVar: nullptr - foo(a: int, ...b: int[]): params().size: 1, to_check_param_number: 1, restVar: ...b: int[] - - Note that optional parameters always come after mandatory parameters, and signatures containing both - optional and rest parameters are not allowed. - - "to_check_parameters_number" is the number of parameters that need to be checked to ensure identical. - "parameters_number" is the number of parameters that can be checked in Signature::params(). - */ - auto const toCheckParametersNumber = std::max(thisToCheckParametersNumber, otherToCheckParametersNumber); - auto const parametersNumber = - std::min({this->Params().size(), other->Params().size(), toCheckParametersNumber}); - - std::size_t i = 0U; - for (; i < parametersNumber; ++i) { - if (!IdenticalParameter(relation, this->Params()[i]->TsType(), other->Params()[i]->TsType())) { - return; - } - } + /* In ETS, the functions "foo(a: int)" and "foo(a: int, b: int = 1)" should be considered as having an + equivalent signature. Hence, we only need to check if the mandatory parameters of the signature with + more mandatory parameters can match the parameters of the other signature (including the optional + parameter or rest parameters) here. - /* "i" could be one of the following three cases: - 1. == to_check_parameters_number, we have finished the checking and can directly return. - 2. == other->Params().size(), must be < this_to_check_parameters_number in this case since - xxx->Params().size() always >= xxx_to_check_parameters_number. We need to check the remaining - mandatory parameters of "this" against ths RestVar of "other". - 3. == this->Params().size(), must be < other_to_check_parameters_number as described in 2, and - we need to check the remaining mandatory parameters of "other" against the RestVar of "this". - */ - if (i == toCheckParametersNumber) { + XXXToCheckParametersNumber is calculated beforehand by counting mandatory parameters. + Signature::params() stores all parameters (mandatory and optional), excluding the rest parameter. + Signature::restVar() stores the rest parameters of the function. + + For example: + foo(a: int): params().size: 1, ToCheckParametersNumber: 1, restVar: nullptr + foo(a: int, b: int = 0): params().size: 2, ToCheckParametersNumber: 1, restVar: nullptr + foo(a: int, ...b: int[]): params().size: 1, ToCheckParametersNumber: 1, restVar: ...b: int[] + + Note that optional parameters always come after mandatory parameters, and signatures containing both + optional and rest parameters are not allowed. + + "ToCheckParametersNumber" is the number of parameters that need to be checked to ensure identical. + "parametersNumber" is the number of parameters that can be checked in Signature::params(). + */ + auto const toCheckParametersNumber = std::max(thisToCheckParametersNumber, otherToCheckParametersNumber); + auto const parametersNumber = std::min({this->Params().size(), other->Params().size(), toCheckParametersNumber}); + + std::size_t i = 0U; + for (; i < parametersNumber; ++i) { + if (!CheckParameter(relation, this->Params()[i]->TsType(), other->Params()[i]->TsType())) { return; } - bool isOtherMandatoryParamsMatched = i < thisToCheckParametersNumber; - ArenaVector const ¶meters = - isOtherMandatoryParamsMatched ? this->Params() : other->Params(); - varbinder::LocalVariable const *restParameter = - isOtherMandatoryParamsMatched ? other->RestVar() : this->RestVar(); - if (restParameter == nullptr) { - relation->Result(false); + } + + /* "i" could be one of the following three cases: + 1. == toCheckParametersNumber, we have finished the checking and can directly return. + 2. == other->Params().size(), must be < thisToCheckParametersNumber in this case since + xxx->Params().size() always >= xxxtoCheckParametersNumber. We need to check the remaining + mandatory parameters of "this" against ths RestVar of "other". + 3. == this->Params().size(), must be < otherToCheckParametersNumber as described in 2, and + we need to check the remaining mandatory parameters of "other" against the RestVar of "this". + */ + if (i == toCheckParametersNumber) { + return; + } + bool isOtherMandatoryParamsMatched = i < thisToCheckParametersNumber; + ArenaVector const ¶meters = + isOtherMandatoryParamsMatched ? this->Params() : other->Params(); + varbinder::LocalVariable const *restParameter = isOtherMandatoryParamsMatched ? other->RestVar() : this->RestVar(); + if (restParameter == nullptr) { + relation->Result(false); + return; + } + auto *const restParameterType = restParameter->TsType()->AsETSArrayType()->ElementType(); + for (; i < toCheckParametersNumber; ++i) { + if (!CheckParameter(relation, parameters[i]->TsType(), restParameterType)) { return; } - auto *const restParameterType = restParameter->TsType()->AsETSArrayType()->ElementType(); - for (; i < toCheckParametersNumber; ++i) { - if (!IdenticalParameter(relation, parameters[i]->TsType(), restParameterType)) { - return; - } - } } } @@ -308,7 +319,7 @@ bool Signature::CheckFunctionalInterfaces(TypeRelation *relation, Type *source, ->AsETSFunctionType() ->CallSignatures()[0]; - relation->IsIdenticalTo(sourceInvokeFunc, targetInvokeFunc); + relation->IsCompatibleTo(sourceInvokeFunc, targetInvokeFunc); return true; } diff --git a/ets2panda/checker/types/signature.h b/ets2panda/checker/types/signature.h index 6f1576a7c1..63127d3e98 100644 --- a/ets2panda/checker/types/signature.h +++ b/ets2panda/checker/types/signature.h @@ -250,13 +250,15 @@ public: void ToString(std::stringstream &ss, const varbinder::Variable *variable, bool printAsMethod = false, bool precise = false) const; std::string ToString() const; - void Identical(TypeRelation *relation, Signature *other); + void Compatible(TypeRelation *relation, Signature *other); bool CheckFunctionalInterfaces(TypeRelation *relation, Type *source, Type *target); void AssignmentTarget(TypeRelation *relation, Signature *source); Signature *BoxPrimitives(ETSChecker *checker); private: - bool IdenticalParameter(TypeRelation *relation, Type *type1, Type *type2); + bool CheckParameter(TypeRelation *relation, Type *type1, Type *type2); + bool CheckReturnType(TypeRelation *relation, Type *type1, Type *type2); + checker::SignatureInfo *signatureInfo_; Type *returnType_; ir::ScriptFunction *func_ {}; diff --git a/ets2panda/checker/types/ts/objectType.cpp b/ets2panda/checker/types/ts/objectType.cpp index f3cf29a4e7..a50001c4c1 100644 --- a/ets2panda/checker/types/ts/objectType.cpp +++ b/ets2panda/checker/types/ts/objectType.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 - 2024 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 @@ -36,7 +36,7 @@ bool ObjectType::SignatureRelatedToSomeSignature(TypeRelation *relation, Signatu ArenaVector *targetSignatures) { for (auto it = targetSignatures->begin(); it != targetSignatures->end();) { - if (relation->IsIdenticalTo(sourceSignature, *it)) { + if (relation->IsCompatibleTo(sourceSignature, *it)) { targetSignatures->erase(it); return true; } diff --git a/ets2panda/checker/types/typeRelation.cpp b/ets2panda/checker/types/typeRelation.cpp index 2938dd202b..95b2f59266 100644 --- a/ets2panda/checker/types/typeRelation.cpp +++ b/ets2panda/checker/types/typeRelation.cpp @@ -68,7 +68,7 @@ bool TypeRelation::IsIdenticalTo(Type *source, Type *target) return result_ == RelationResult::TRUE; } -bool TypeRelation::IsIdenticalTo(Signature *source, Signature *target) +bool TypeRelation::IsCompatibleTo(Signature *source, Signature *target) { if (source == target) { Result(true); @@ -76,7 +76,7 @@ bool TypeRelation::IsIdenticalTo(Signature *source, Signature *target) } result_ = RelationResult::FALSE; - target->Identical(this, source); + target->Compatible(this, source); return result_ == RelationResult::TRUE; } diff --git a/ets2panda/checker/types/typeRelation.h b/ets2panda/checker/types/typeRelation.h index 54c7ae5d32..729dc1f138 100644 --- a/ets2panda/checker/types/typeRelation.h +++ b/ets2panda/checker/types/typeRelation.h @@ -62,6 +62,7 @@ enum class TypeRelationFlag : uint32_t { CHECK_PROXY = 1U << 21U, NO_CHECK_TRAILING_LAMBDA = 1U << 23U, NO_THROW_GENERIC_TYPEALIAS = 1U << 24U, + OVERRIDING_CONTEXT = 1U << 25U, ASSIGNMENT_CONTEXT = WIDENING | BOXING | UNBOXING, CASTING_CONTEXT = NARROWING | WIDENING | BOXING | UNBOXING | UNCHECKED_CAST, @@ -212,6 +213,11 @@ public: return (flags_ & TypeRelationFlag::NO_THROW_GENERIC_TYPEALIAS) != 0; } + [[nodiscard]] bool IsOverridingCheck() const noexcept + { + return (flags_ & TypeRelationFlag::OVERRIDING_CONTEXT) != 0; + } + const Checker *GetChecker() const { return checker_; @@ -265,8 +271,8 @@ public: } bool IsIdenticalTo(Type *source, Type *target); - bool IsIdenticalTo(Signature *source, Signature *target); bool IsIdenticalTo(IndexInfo *source, IndexInfo *target); + bool IsCompatibleTo(Signature *source, Signature *target); bool IsAssignableTo(Type *source, Type *target); bool IsComparableTo(Type *source, Type *target); bool IsCastableTo(Type *const source, Type *const target); diff --git a/ets2panda/compiler/core/ETSemitter.cpp b/ets2panda/compiler/core/ETSemitter.cpp index 6244f01927..9550537d7d 100644 --- a/ets2panda/compiler/core/ETSemitter.cpp +++ b/ets2panda/compiler/core/ETSemitter.cpp @@ -638,11 +638,11 @@ ir::MethodDefinition *ETSEmitter::FindAsyncImpl(ir::ScriptFunction *asyncFunc) auto *checker = static_cast(Context()->Checker()); checker::TypeRelation *typeRel = checker->Relation(); checker::SavedTypeRelationFlagsContext savedFlagsCtx(typeRel, checker::TypeRelationFlag::NO_RETURN_TYPE_CHECK); - method->Function()->Signature()->Identical(typeRel, asyncFunc->Signature()); + method->Function()->Signature()->Compatible(typeRel, asyncFunc->Signature()); auto overloadIt = method->Overloads().begin(); while (overloadIt != method->Overloads().end() && !typeRel->IsTrue()) { method = *overloadIt; - method->Function()->Signature()->Identical(typeRel, asyncFunc->Signature()); + method->Function()->Signature()->Compatible(typeRel, asyncFunc->Signature()); ++overloadIt; } return typeRel->IsTrue() ? method : nullptr; diff --git a/ets2panda/test/runtime/ets/Override-4.ets b/ets2panda/test/runtime/ets/Override-4.ets new file mode 100644 index 0000000000..026d253e76 --- /dev/null +++ b/ets2panda/test/runtime/ets/Override-4.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 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 X {} +class Y extends X {} + +abstract class A { + foo(x: Y): string { return "A.foo(Y)" } + abstract foo(x: Double): String + foo2(x: Y): Object { return "A.foo(Y)" } +} + +class B extends A { + foo(x: X): string { return "B.foo(X)" } + foo(x: Floating): String { return "B.foo(Floating)" } +} + +class C extends A { + foo(x: Double): String { return "C.foo(Double)" } + override foo2(x: Y): String { return "C.foo2(Y)" } +} + +function main() { + assert(new B().foo(new Y()) == "A.foo(Y)"); + assert(new B().foo(new Double()) == "B.foo(Floating)"); + assert(new C().foo2(new Y()) == "C.foo2(Y)") +} \ No newline at end of file -- Gitee From dd834adb5ee1baa7bf1037df1c31e41ca47005fd Mon Sep 17 00:00:00 2001 From: aleksisch Date: Wed, 20 Dec 2023 17:40:31 +0300 Subject: [PATCH 02/12] extract top level statements from parser Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/I8V5Z5 Description: Top level statements handling should be done outside of the parser. Also import path-s related code should be extracted from the parser Signed-off-by: aleksisch --- ets2panda/BUILD.gn | 6 + ets2panda/CMakeLists.txt | 6 + ets2panda/checker/ETSAnalyzer.cpp | 13 +- ets2panda/checker/ETSchecker.h | 4 +- ets2panda/checker/TSAnalyzer.cpp | 5 + ets2panda/compiler/core/ASTVerifier.cpp | 6 + ets2panda/compiler/core/ETSCompiler.cpp | 5 + ets2panda/compiler/core/JSCompiler.cpp | 5 + ets2panda/compiler/lowering/checkerPhase.cpp | 1 + .../ets/topLevelStmts/globalClassHandler.cpp | 229 +++++ .../ets/topLevelStmts/globalClassHandler.h | 77 ++ .../topLevelStmts/globalDeclTransformer.cpp | 125 +++ .../ets/topLevelStmts/globalDeclTransformer.h | 81 ++ .../ets/topLevelStmts/importExportDecls.cpp | 93 ++ .../ets/topLevelStmts/importExportDecls.h | 75 ++ .../ets/topLevelStmts/topLevelStmts.cpp | 40 + .../ets/topLevelStmts/topLevelStmts.h | 47 + ets2panda/compiler/lowering/phase.cpp | 5 +- .../lowering/scopesInit/scopesInitPhase.cpp | 15 +- .../lowering/scopesInit/scopesInitPhase.h | 6 + ets2panda/ir/astNodeMapping.h | 1 + ets2panda/ir/base/classElement.cpp | 8 + ets2panda/ir/base/classElement.h | 7 +- ets2panda/ir/base/scriptFunction.h | 3 - ets2panda/ir/ets/etsReExportDeclaration.cpp | 51 + ets2panda/ir/ets/etsReExportDeclaration.h | 40 +- ets2panda/ir/visitor/IterateAstVisitor.h | 76 +- ets2panda/lexer/lexer.h | 20 + ets2panda/parser/ETSparser.cpp | 883 ++++++------------ ets2panda/parser/ETSparser.h | 85 +- ets2panda/parser/TypedParser.cpp | 2 +- ets2panda/parser/TypedParser.h | 7 - ets2panda/parser/context/parserContext.h | 2 - ets2panda/parser/expressionParser.cpp | 1 + ets2panda/parser/parserImpl.cpp | 7 +- ets2panda/parser/parserImpl.h | 32 +- ets2panda/parser/program/program.cpp | 14 +- ets2panda/parser/program/program.h | 2 - ets2panda/parser/statementParser.cpp | 4 +- .../compiler/ets/FunctionType1-expected.txt | 2 +- .../compiler/ets/FunctionType2-expected.txt | 2 +- .../compiler/ets/FunctionType3-expected.txt | 2 +- .../compiler/ets/FunctionType4-expected.txt | 8 +- .../compiler/ets/FunctionType5-expected.txt | 4 +- ...ing_with_chaining_non_nullish-expected.txt | 12 +- ...ndexing_with_chaining_nullish-expected.txt | 12 +- ..._without_chaining_non_nullish-expected.txt | 12 +- ...xing_without_chaining_nullish-expected.txt | 12 +- .../ets/etsObjectToString4-expected.txt | 4 +- .../ets/identifierReference2-expected.txt | 4 +- .../ets/identifierReference3-expected.txt | 6 +- .../ets/identifierReference4-expected.txt | 6 +- .../ets/inferTypeOfArray-expected.txt | 14 +- .../inferTypeOfArrayNegative1-expected.txt | 2 +- .../inferTypeOfArrayNegative2-expected.txt | 4 +- .../inferTypeOfArrayNegative3-expected.txt | 2 +- .../compiler/ets/lambdaFunction1-expected.txt | 6 +- .../lambda_cast_infer_type_void-expected.txt | 4 +- .../lambda_cast_type_has_pramas-expected.txt | 4 +- ...lambda_infer_type_retrun_enum-expected.txt | 4 +- ...ambda_infer_type_return_array-expected.txt | 4 +- ...type_return_lambda_expression-expected.txt | 6 +- ...bda_infer_type_return_literal-expected.txt | 4 +- ...ambda_infer_type_return_union-expected.txt | 4 +- .../lambda_infer_type_scope-expected.txt | 8 +- .../ets/launch_expression-expected.txt | 16 +- .../ets/objectLiteralAbstract-expected.txt | 6 +- .../ets/objectLiteralBadKey-expected.txt | 8 +- .../objectLiteralInaccessibleKey-expected.txt | 8 +- .../ets/objectLiteralInterface-expected.txt | 6 +- .../objectLiteralNoContextType-expected.txt | 4 +- ...ralNoParameterlessConstructor-expected.txt | 6 +- .../ets/objectLiteralNoSuchKey-expected.txt | 8 +- ...ctLiteralPrimitiveContextType-expected.txt | 6 +- ...jectLiteralPrivateConstructor-expected.txt | 6 +- .../ets/objectLiteralReadonlyKey-expected.txt | 8 +- .../objectLiteralWrongValueType-expected.txt | 8 +- .../ets/throwingFunctionCheck1-expected.txt | 4 +- .../test/compiler/ets/typeAlias-expected.txt | 4 +- .../parser/ets/Dollar_dollar_1-expected.txt | 2 +- .../parser/ets/Dollar_dollar_3-expected.txt | 4 +- .../parser/ets/Dollar_dollar_4-expected.txt | 2 +- .../test/parser/ets/FunctionType-expected.txt | 4 +- .../parser/ets/ambiguous_call_1-expected.txt | 12 +- .../parser/ets/ambiguous_call_2-expected.txt | 16 +- .../parser/ets/ambiguous_call_3-expected.txt | 12 +- ets2panda/test/parser/ets/array-expected.txt | 12 +- .../ets/arrayHoldingNullValue-expected.txt | 18 +- ets2panda/test/parser/ets/assign-expected.txt | 4 +- .../ets/async_function_bad-expected.txt | 2 +- .../parser/ets/async_with_lambda-expected.txt | 2 +- .../parser/ets/await_keyword-expected.txt | 10 +- .../test/parser/ets/binary_op-expected.txt | 172 ++-- .../test/parser/ets/boolean-expected.txt | 6 +- ets2panda/test/parser/ets/break-expected.txt | 6 +- .../parser/ets/cast_expressions5-expected.txt | 6 +- .../parser/ets/class_instance-expected.txt | 20 +- .../test/parser/ets/const_enum-expected.txt | 2 +- .../test/parser/ets/continue-expected.txt | 6 +- .../test/parser/ets/decl_infer-expected.txt | 20 +- .../test/parser/ets/exports-expected.txt | 4 +- ets2panda/test/parser/ets/for_of-expected.txt | 6 +- .../test/parser/ets/for_of_02-expected.txt | 6 +- .../ets/functionTypeThrows-expected.txt | 2 +- ...unction_implicit_return_type3-expected.txt | 4 +- .../ets/genericDefaultParam_1-expected.txt | 6 +- ...erics_type_param_constraint_3-expected.txt | 4 +- .../test/parser/ets/identifier-expected.txt | 18 +- .../import_tests/diamond/test2-expected.txt | 4 +- .../import_tests/diamond/test3-expected.txt | 4 +- .../import_tests/diamond/test4-expected.txt | 4 +- .../import_alias/export-expected.txt | 8 +- .../ets/import_tests/import_all-expected.txt | 12 +- .../import_all_alias_1-expected.txt | 8 +- .../import_all_alias_2-expected.txt | 4 +- .../import_all_type_alias-expected.txt | 2 +- .../import_extension_1-expected.txt | 4 +- .../import_extension_2-expected.txt | 4 +- .../import_tests/import_name_1-expected.txt | 6 +- .../import_tests/import_name_2-expected.txt | 4 +- .../import_name_alias_1-expected.txt | 8 +- .../import_name_alias_2-expected.txt | 4 +- .../import_relative_path-expected.txt | 8 +- .../import_several_1-expected.txt | 8 +- .../import_several_2-expected.txt | 4 +- .../import_several_3-expected.txt | 8 +- .../import_several_4-expected.txt | 8 +- .../import_several_5-expected.txt | 8 +- .../import_several_6-expected.txt | 8 +- .../import_several_7-expected.txt | 8 +- .../module1/src/re_export_file-expected.txt | 85 ++ .../module2/src/re_export_file-expected.txt | 85 ++ .../too_many_default_exports_2-expected.txt | 2 +- .../relative_import/alias2-expected.txt | 4 +- .../parser/ets/index_expressions-expected.txt | 16 +- .../ets/lambda_import_alias_1-2-expected.txt | 2 +- .../launch_with_call_expression-expected.txt | 2 +- ets2panda/test/parser/ets/null-expected.txt | 10 +- .../test/parser/ets/null_invalid-expected.txt | 6 +- .../test/parser/ets/null_valid-expected.txt | 6 +- ets2panda/test/parser/ets/object-expected.txt | 2 +- .../ets/optional-chaining-array-expected.txt | 16 +- ...nal_chaining_invalid_property-expected.txt | 10 +- ...onal_chaining_nested_property-expected.txt | 10 +- ...onal_chaining_object_property-expected.txt | 16 +- .../ets/optional_union_paramter-expected.txt | 4 +- .../parentheses_expression_value-expected.txt | 16 +- .../parser/ets/predefined_types-expected.txt | 14 +- .../re_export/folder/re_export_6-expected.txt | 70 ++ .../re_export/folder/re_export_7-expected.txt | 70 ++ .../re_export/folderIndex/index-expected.txt | 85 ++ .../ets/re_export/re_export-expected.txt | 70 ++ .../ets/re_export/re_export_2-expected.txt | 85 ++ .../ets/re_export/re_export_3-expected.txt | 85 ++ .../ets/re_export/re_export_4-expected.txt | 170 ++++ .../ets/re_export/re_export_5-expected.txt | 140 +++ .../parser/ets/rest_parameter_01-expected.txt | 8 +- .../parser/ets/rest_parameter_02-expected.txt | 8 +- .../parser/ets/rest_parameter_03-expected.txt | 2 +- ets2panda/test/parser/ets/return-expected.txt | 6 +- .../selective_export_bad-expected.txt | 2 +- .../test/parser/ets/simple_types-expected.txt | 56 +- ets2panda/test/parser/ets/string-expected.txt | 12 +- .../test/parser/ets/ternary-expected.txt | 12 +- .../test/parser/ets/test_jsvalue-expected.txt | 2 +- .../ets/test_jsvalue_get_double-expected.txt | 8 +- .../test_jsvalue_get_property_1-expected.txt | 8 +- .../test_jsvalue_get_property_2-expected.txt | 8 +- .../parser/ets/test_type_alias9-expected.txt | 12 +- .../throwsRethrowsAsVariables-expected.txt | 8 +- ...bda_mismatch_lambda_signature-expected.txt | 2 +- .../test/parser/ets/tuple_type_1-expected.txt | 36 +- .../test/parser/ets/unary_op-expected.txt | 36 +- .../parser/ets/user_defined_22-expected.txt | 6 +- .../parser/ets/user_defined_3-expected.txt | 16 +- .../test/unit/public/es2panda_public_test.cpp | 7 +- .../test/unit/public/plugin_test.expected.txt | 5 - ets2panda/util/arktsconfig.cpp | 6 +- ets2panda/util/arktsconfig.h | 4 +- ets2panda/util/errorHandler.cpp | 34 + ets2panda/util/errorHandler.h | 39 + ets2panda/util/helpers.cpp | 14 +- ets2panda/util/helpers.h | 45 +- ets2panda/util/pathHandler.cpp | 30 +- ets2panda/util/pathHandler.h | 52 +- ets2panda/varbinder/ETSBinder.cpp | 2 +- ets2panda/varbinder/ETSBinder.h | 10 - ets2panda/varbinder/varbinder.h | 7 +- 188 files changed, 3050 insertions(+), 1397 deletions(-) create mode 100644 ets2panda/compiler/lowering/ets/topLevelStmts/globalClassHandler.cpp create mode 100644 ets2panda/compiler/lowering/ets/topLevelStmts/globalClassHandler.h create mode 100644 ets2panda/compiler/lowering/ets/topLevelStmts/globalDeclTransformer.cpp create mode 100644 ets2panda/compiler/lowering/ets/topLevelStmts/globalDeclTransformer.h create mode 100644 ets2panda/compiler/lowering/ets/topLevelStmts/importExportDecls.cpp create mode 100644 ets2panda/compiler/lowering/ets/topLevelStmts/importExportDecls.h create mode 100644 ets2panda/compiler/lowering/ets/topLevelStmts/topLevelStmts.cpp create mode 100644 ets2panda/compiler/lowering/ets/topLevelStmts/topLevelStmts.h create mode 100644 ets2panda/ir/ets/etsReExportDeclaration.cpp create mode 100644 ets2panda/util/errorHandler.cpp create mode 100644 ets2panda/util/errorHandler.h diff --git a/ets2panda/BUILD.gn b/ets2panda/BUILD.gn index f80821e40e..74bd09ea1d 100644 --- a/ets2panda/BUILD.gn +++ b/ets2panda/BUILD.gn @@ -171,6 +171,10 @@ libes2panda_sources = [ "compiler/lowering/ets/promiseVoid.cpp", "compiler/lowering/ets/recordLowering.cpp", "compiler/lowering/ets/structLowering.cpp", + "compiler/lowering/ets/topLevelStmts/globalClassHandler.cpp", + "compiler/lowering/ets/topLevelStmts/globalDeclTransformer.cpp", + "compiler/lowering/ets/topLevelStmts/importExportDecls.cpp", + "compiler/lowering/ets/topLevelStmts/topLevelStmts.cpp", "compiler/lowering/ets/tupleLowering.cpp", "compiler/lowering/ets/unionLowering.cpp", "compiler/lowering/phase.cpp", @@ -211,6 +215,7 @@ libes2panda_sources = [ "ir/ets/etsPackageDeclaration.cpp", "ir/ets/etsParameterExpression.cpp", "ir/ets/etsPrimitiveType.cpp", + "ir/ets/etsReExportDeclaration.cpp", "ir/ets/etsScript.cpp", "ir/ets/etsStructDeclaration.cpp", "ir/ets/etsTuple.cpp", @@ -366,6 +371,7 @@ libes2panda_sources = [ "util/arktsconfig.cpp", "util/bitset.cpp", "util/declgenEts2Ts.cpp", + "util/errorHandler.cpp", "util/helpers.cpp", "util/path.cpp", "util/pathHandler.cpp", diff --git a/ets2panda/CMakeLists.txt b/ets2panda/CMakeLists.txt index 386212ba63..94c8943315 100644 --- a/ets2panda/CMakeLists.txt +++ b/ets2panda/CMakeLists.txt @@ -150,6 +150,10 @@ set(ES2PANDA_LIB_SRC compiler/lowering/phase.cpp compiler/lowering/plugin_phase.cpp compiler/lowering/util.cpp + compiler/lowering/ets/topLevelStmts/importExportDecls.cpp + compiler/lowering/ets/topLevelStmts/globalClassHandler.cpp + compiler/lowering/ets/topLevelStmts/globalDeclTransformer.cpp + compiler/lowering/ets/topLevelStmts/topLevelStmts.cpp compiler/lowering/ets/lambdaLowering.cpp compiler/lowering/ets/generateDeclarations.cpp compiler/lowering/ets/objectIndexAccess.cpp @@ -239,6 +243,7 @@ set(ES2PANDA_LIB_SRC ir/statements/breakStatement.cpp ir/statements/classDeclaration.cpp ir/ets/etsStructDeclaration.cpp + ir/ets/etsReExportDeclaration.cpp ir/statements/continueStatement.cpp ir/statements/debuggerStatement.cpp ir/statements/doWhileStatement.cpp @@ -444,6 +449,7 @@ set(ES2PANDA_LIB_SRC util/arktsconfig.cpp util/bitset.cpp util/declgenEts2Ts.cpp + util/errorHandler.cpp util/helpers.cpp util/path.cpp util/pathHandler.cpp diff --git a/ets2panda/checker/ETSAnalyzer.cpp b/ets2panda/checker/ETSAnalyzer.cpp index 1f6e615b3e..6920c69210 100644 --- a/ets2panda/checker/ETSAnalyzer.cpp +++ b/ets2panda/checker/ETSAnalyzer.cpp @@ -1233,6 +1233,11 @@ checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ClassExpression *expr) co UNREACHABLE(); } +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ETSReExportDeclaration *expr) const +{ + UNREACHABLE(); +} + checker::Type *ETSAnalyzer::Check(ir::ConditionalExpression *expr) const { ETSChecker *checker = GetETSChecker(); @@ -2302,13 +2307,7 @@ void ProcessReturnStatements(ETSChecker *checker, ir::ScriptFunction *containing } const auto name = containingFunc->Scope()->InternalName().Mutf8(); - if (name.find(compiler::Signatures::ETS_MAIN_WITH_MANGLE_BEGIN) != std::string::npos) { - if (funcReturnType == checker->GlobalBuiltinVoidType()) { - funcReturnType = checker->GlobalVoidType(); - } else if (!funcReturnType->IsETSVoidType() && !funcReturnType->IsIntType()) { - checker->ThrowTypeError("Bad return type, main enable only void or int type.", st->Start()); - } - } + CheckArgumentVoidType(funcReturnType, checker, name, st); if (stArgument->IsObjectExpression()) { stArgument->AsObjectExpression()->SetPreferredType(funcReturnType); diff --git a/ets2panda/checker/ETSchecker.h b/ets2panda/checker/ETSchecker.h index d4200f884b..48cd3cd27c 100644 --- a/ets2panda/checker/ETSchecker.h +++ b/ets2panda/checker/ETSchecker.h @@ -599,9 +599,7 @@ public: template T *AllocNode(Args &&...args) { - auto *ret = Allocator()->New(std::forward(args)...); - ret->Iterate([ret](auto *child) { child->SetParent(ret); }); - return ret; + return util::NodeAllocator::ForceSetParent(Allocator(), std::forward(args)...); } ETSObjectType *GetCachedFunctionlInterface(ir::ETSFunctionType *type); diff --git a/ets2panda/checker/TSAnalyzer.cpp b/ets2panda/checker/TSAnalyzer.cpp index f591d42c95..195832d358 100644 --- a/ets2panda/checker/TSAnalyzer.cpp +++ b/ets2panda/checker/TSAnalyzer.cpp @@ -1726,6 +1726,11 @@ checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSConditionalType *node) c UNREACHABLE(); } +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::ETSReExportDeclaration *node) const +{ + UNREACHABLE(); +} + checker::Type *TSAnalyzer::Check(ir::TSConstructorType *node) const { TSChecker *checker = GetTSChecker(); diff --git a/ets2panda/compiler/core/ASTVerifier.cpp b/ets2panda/compiler/core/ASTVerifier.cpp index 5af36a6f47..b364674a60 100644 --- a/ets2panda/compiler/core/ASTVerifier.cpp +++ b/ets2panda/compiler/core/ASTVerifier.cpp @@ -503,6 +503,9 @@ private: if (ast->IsETSImportDeclaration()) { return true; } + if (ast->IsETSReExportDeclaration()) { + return true; + } if (ast->IsImportExpression()) { return true; } @@ -532,6 +535,9 @@ private: if (ast->IsExportNamedDeclaration()) { return true; } + if (ast->IsETSReExportDeclaration()) { + return true; + } return false; } diff --git a/ets2panda/compiler/core/ETSCompiler.cpp b/ets2panda/compiler/core/ETSCompiler.cpp index e7c26b723e..75cd902a53 100644 --- a/ets2panda/compiler/core/ETSCompiler.cpp +++ b/ets2panda/compiler/core/ETSCompiler.cpp @@ -971,6 +971,11 @@ void ETSCompiler::Compile([[maybe_unused]] const ir::ClassExpression *expr) cons UNREACHABLE(); } +void ETSCompiler::Compile([[maybe_unused]] const ir::ETSReExportDeclaration *stmt) const +{ + UNREACHABLE(); +} + void ETSCompiler::Compile(const ir::ConditionalExpression *expr) const { ETSGen *etsg = GetETSGen(); diff --git a/ets2panda/compiler/core/JSCompiler.cpp b/ets2panda/compiler/core/JSCompiler.cpp index ef66629921..09881817dc 100644 --- a/ets2panda/compiler/core/JSCompiler.cpp +++ b/ets2panda/compiler/core/JSCompiler.cpp @@ -495,6 +495,11 @@ void JSCompiler::Compile([[maybe_unused]] const ir::ETSImportDeclaration *node) UNREACHABLE(); } +void JSCompiler::Compile([[maybe_unused]] const ir::ETSReExportDeclaration *node) const +{ + UNREACHABLE(); +} + void JSCompiler::Compile([[maybe_unused]] const ir::ETSLaunchExpression *expr) const { UNREACHABLE(); diff --git a/ets2panda/compiler/lowering/checkerPhase.cpp b/ets2panda/compiler/lowering/checkerPhase.cpp index a86b662083..487d9fe7bd 100644 --- a/ets2panda/compiler/lowering/checkerPhase.cpp +++ b/ets2panda/compiler/lowering/checkerPhase.cpp @@ -16,6 +16,7 @@ #include "checkerPhase.h" #include "checker/checker.h" #include "compiler/core/ASTVerifier.h" +#include "varbinder/ETSBinder.h" #include "compiler/core/compilerContext.h" namespace ark::es2panda::compiler { diff --git a/ets2panda/compiler/lowering/ets/topLevelStmts/globalClassHandler.cpp b/ets2panda/compiler/lowering/ets/topLevelStmts/globalClassHandler.cpp new file mode 100644 index 0000000000..66c8ff2453 --- /dev/null +++ b/ets2panda/compiler/lowering/ets/topLevelStmts/globalClassHandler.cpp @@ -0,0 +1,229 @@ +/* + * Copyright (c) 2023 - 2024 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. + */ + +#include "compiler/lowering/ets/topLevelStmts/globalClassHandler.h" + +#include "ir/statements/classDeclaration.h" +#include "ir/base/classDefinition.h" +#include "ir/base/classProperty.h" +#include "ir/base/classStaticBlock.h" +#include "ir/base/scriptFunction.h" +#include "ir/base/methodDefinition.h" +#include "ir/expressions/identifier.h" +#include "ir/expressions/classExpression.h" +#include "ir/expressions/functionExpression.h" +#include "ir/expressions/callExpression.h" +#include "ir/statements/expressionStatement.h" +#include "ir/statements/blockStatement.h" +#include "compiler/lowering/ets/topLevelStmts/globalDeclTransformer.h" +#include "util/helpers.h" + +namespace ark::es2panda::compiler { + +using util::NodeAllocator; + +void GlobalClassHandler::InitGlobalClass(const ArenaVector &programs) +{ + if (programs.empty()) { + return; + } + auto globalDecl = CreateGlobalClass(); + auto globalClass = globalDecl->Definition(); + + auto addCCtor = [this](ir::AstNode *node) { + if (node->IsClassDefinition()) { + auto classDef = node->AsClassDefinition(); + bool allowEmpty = false; + auto staticBlock = CreateCCtor(classDef->Body(), classDef->Start(), allowEmpty); + if (staticBlock != nullptr) { + classDef->Body().emplace_back(staticBlock); + staticBlock->SetParent(classDef); + } + } + }; + + ArenaVector statements(allocator_->Adapter()); + for (auto program : programs) { + program->Ast()->IterateRecursively(addCCtor); + auto stmts = MakeGlobalStatements(program->Ast(), globalClass, !program->GetPackageName().Empty()); + statements.emplace_back(GlobalStmts {program, std::move(stmts)}); + program->SetGlobalClass(globalClass); + } + InitCallToCCTOR(programs.front(), statements); +} + +ir::MethodDefinition *GlobalClassHandler::CreateAndFillInitMethod(const ArenaVector &initStatements) +{ + auto initMethod = CreateInitMethod(); + + for (const auto &stmts : initStatements) { + for (auto stmt : stmts.statements) { + initMethod->Function()->Body()->AsBlockStatement()->Statements().emplace_back(stmt); + stmt->SetParent(initMethod->Function()->Body()); + } + } + return initMethod; +} + +ir::MethodDefinition *GlobalClassHandler::CreateInitMethod() +{ + const auto functionFlags = ir::ScriptFunctionFlags::NONE; + const auto functionModifiers = ir::ModifierFlags::STATIC | ir::ModifierFlags::PUBLIC; + auto *initIdent = NodeAllocator::Alloc(allocator_, INIT_NAME, allocator_); + + ArenaVector params(allocator_->Adapter()); + + ArenaVector statements(allocator_->Adapter()); + auto *initBody = NodeAllocator::Alloc(allocator_, allocator_, std::move(statements)); + + auto *initFunc = + NodeAllocator::Alloc(allocator_, ir::FunctionSignature(nullptr, std::move(params), nullptr), + initBody, functionFlags, false, Language(Language::Id::ETS)); + + initFunc->SetIdent(initIdent); + initFunc->AddModifier(functionModifiers); + + auto *funcExpr = NodeAllocator::Alloc(allocator_, initFunc); + auto methodDef = NodeAllocator::Alloc(allocator_, ir::MethodDefinitionKind::METHOD, + initIdent->Clone(allocator_, nullptr)->AsExpression(), + funcExpr, functionModifiers, allocator_, false); + return methodDef; +} + +void GlobalClassHandler::AddInitCall(ir::ClassDefinition *globalClass, ir::MethodDefinition *initMethod) +{ + ASSERT(initMethod != nullptr); + + auto &globalBody = globalClass->Body(); + auto maybeStaticBlock = std::find_if(globalBody.begin(), globalBody.end(), + [](ir::AstNode *cctor) { return cctor->IsClassStaticBlock(); }); + ASSERT(maybeStaticBlock != globalBody.end()); + + auto *staticBlock = (*maybeStaticBlock)->AsClassStaticBlock(); + auto *callee = RefIdent(initMethod->Id()->Name()); + + auto *const callExpr = NodeAllocator::Alloc( + allocator_, callee, ArenaVector(allocator_->Adapter()), nullptr, false, false); + + auto *blockBody = staticBlock->Function()->Body()->AsBlockStatement(); + auto exprStmt = NodeAllocator::Alloc(allocator_, callExpr); + exprStmt->SetParent(blockBody); + blockBody->Statements().emplace_back(exprStmt); +} + +ir::Identifier *GlobalClassHandler::RefIdent(const util::StringView &name) +{ + auto *const callee = NodeAllocator::Alloc(allocator_, name, allocator_); + callee->SetReference(); + return callee; +} + +ir::ClassStaticBlock *GlobalClassHandler::CreateCCtor(const ArenaVector &properties, + const lexer::SourcePosition &loc, bool allowEmptyCctor) +{ + bool hasStaticField = false; + for (const auto *prop : properties) { + if (prop->IsClassStaticBlock()) { + return nullptr; + } + + if (!prop->IsClassProperty()) { + continue; + } + + const auto *field = prop->AsClassProperty(); + + if (field->IsStatic()) { + hasStaticField = true; + } + } + + if (!hasStaticField && !allowEmptyCctor) { + return nullptr; + } + + ArenaVector params(allocator_->Adapter()); + + auto *id = NodeAllocator::Alloc(allocator_, compiler::Signatures::CCTOR, allocator_); + + ArenaVector statements(allocator_->Adapter()); + + auto *body = NodeAllocator::Alloc(allocator_, allocator_, std::move(statements)); + auto *func = NodeAllocator::Alloc( + allocator_, ir::FunctionSignature(nullptr, std::move(params), nullptr), body, + ir::ScriptFunction::ScriptFunctionData {ir::ScriptFunctionFlags::STATIC_BLOCK | ir::ScriptFunctionFlags::HIDDEN, + ir::ModifierFlags::STATIC, false, Language(Language::Id::ETS)}); + func->SetIdent(id); + + auto *funcExpr = NodeAllocator::Alloc(allocator_, func); + auto *staticBlock = NodeAllocator::Alloc(allocator_, funcExpr, allocator_); + staticBlock->AddModifier(ir::ModifierFlags::STATIC); + staticBlock->SetRange({loc, loc}); + return staticBlock; +} + +ArenaVector GlobalClassHandler::MakeGlobalStatements(ir::BlockStatement *globalStmts, + ir::ClassDefinition *classDef, bool isPackage) +{ + auto globalDecl = GlobalDeclTransformer(allocator_); + auto statements = globalDecl.TransformStatements(globalStmts->Statements(), isPackage); + classDef->AddProperties(util::Helpers::ConvertVector(statements.classProperties)); + globalDecl.FilterDeclarations(globalStmts->Statements()); + return std::move(statements.initStatements); +} + +void GlobalClassHandler::InitGlobalClass(ir::ClassDefinition *classDef, parser::ScriptKind scriptKind) +{ + auto &globalProperties = classDef->Body(); + auto staticBlock = CreateCCtor(globalProperties, classDef->Start(), scriptKind != parser::ScriptKind::STDLIB); + if (staticBlock != nullptr) { + staticBlock->SetParent(classDef); + globalProperties.emplace_back(staticBlock); + } + classDef->SetGlobalInitialized(); +} + +ir::ClassDeclaration *GlobalClassHandler::CreateGlobalClass() +{ + auto *ident = NodeAllocator::Alloc(allocator_, compiler::Signatures::ETS_GLOBAL, allocator_); + + auto *classDef = + NodeAllocator::Alloc(allocator_, allocator_, ident, ir::ClassDefinitionModifiers::GLOBAL, + ir::ModifierFlags::ABSTRACT, Language(Language::Id::ETS)); + auto *classDecl = NodeAllocator::Alloc(allocator_, classDef, allocator_); + return classDecl; +} + +void GlobalClassHandler::InitCallToCCTOR(parser::Program *program, const ArenaVector &initStatements) +{ + auto globalClass = program->GlobalClass(); + auto globalDecl = globalClass->Parent()->AsClassDeclaration(); + program->Ast()->Statements().emplace_back(globalDecl); + globalDecl->SetParent(program->Ast()); + InitGlobalClass(globalClass, program->Kind()); + auto &globalBody = globalClass->Body(); + if (program->GetPackageName().Empty() && program->Kind() != parser::ScriptKind::STDLIB) { + ir::MethodDefinition *initMethod = CreateAndFillInitMethod(initStatements); + if (initMethod != nullptr) { + initMethod->SetParent(program->GlobalClass()); + globalBody.insert(globalBody.begin(), initMethod); + if (!initMethod->Function()->Body()->AsBlockStatement()->Statements().empty()) { + AddInitCall(program->GlobalClass(), initMethod); + } + } + } +} + +} // namespace ark::es2panda::compiler \ No newline at end of file diff --git a/ets2panda/compiler/lowering/ets/topLevelStmts/globalClassHandler.h b/ets2panda/compiler/lowering/ets/topLevelStmts/globalClassHandler.h new file mode 100644 index 0000000000..8433d0822e --- /dev/null +++ b/ets2panda/compiler/lowering/ets/topLevelStmts/globalClassHandler.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2023 - 2024 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. + */ + +#ifndef PANDA_GLOBALCLASSHANDLER_H +#define PANDA_GLOBALCLASSHANDLER_H + +#include "parser/program/program.h" +#include "public/public.h" +#include "ir/astNode.h" + +namespace ark::es2panda::compiler { + +class GlobalClassHandler { + struct GlobalStmts { + parser::Program *program; + ArenaVector statements; + }; + +public: + explicit GlobalClassHandler(ArenaAllocator *allocator) : allocator_(allocator) {}; + + /** + * Each "Module" has it's own global class, which contains all top level statements across "module" + * Result - creation of global class and _$init$_ method + * @param programs - vector of files in module + */ + void InitGlobalClass(const ArenaVector &programs); + +private: + /** + * Move top level statements to _$init$_ and + * @param program program of module + * @param init_statements statements which should be executed + */ + void InitCallToCCTOR(parser::Program *program, const ArenaVector &initStatements); + +private: + void InitGlobalClass(ir::ClassDefinition *classDef, parser::ScriptKind scriptKind); + ir::ClassDeclaration *CreateGlobalClass(); + ir::ClassStaticBlock *CreateCCtor(const ArenaVector &properties, const lexer::SourcePosition &loc, + bool allowEmptyCctor); + + /** + * + * @param global_stmts leave only declarations here + * @param class_def add new properties such as methods and fields + * @param is_package + * @return Statements, which should be executed before the start + */ + ArenaVector MakeGlobalStatements(ir::BlockStatement *globalStmts, ir::ClassDefinition *classDef, + bool isPackage); + + ir::MethodDefinition *CreateAndFillInitMethod(const ArenaVector &initStatements); + ir::MethodDefinition *CreateInitMethod(); + void AddInitCall(ir::ClassDefinition *globalClass, ir::MethodDefinition *initMethod); + + ir::Identifier *RefIdent(const util::StringView &name); + +private: + constexpr static std::string_view INIT_NAME = compiler::Signatures::INIT_METHOD; + ArenaAllocator *const allocator_; +}; +} // namespace ark::es2panda::compiler + +#endif // PANDA_GLOBALCLASSHANDLER_H diff --git a/ets2panda/compiler/lowering/ets/topLevelStmts/globalDeclTransformer.cpp b/ets2panda/compiler/lowering/ets/topLevelStmts/globalDeclTransformer.cpp new file mode 100644 index 0000000000..6f463c7f71 --- /dev/null +++ b/ets2panda/compiler/lowering/ets/topLevelStmts/globalDeclTransformer.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2023 - 2024 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. + */ + +#include "compiler/lowering/ets/topLevelStmts/globalDeclTransformer.h" + +namespace ark::es2panda::compiler { + +void GlobalDeclTransformer::FilterDeclarations(ArenaVector &stmts) +{ + const auto isDeclCb = [&types = typeDecl_](const ir::AstNode *node) { + return types.count(node->Type()) == 0U || + (node->IsExportNamedDeclaration() && !node->AsExportNamedDeclaration()->Specifiers().empty()); + }; + stmts.erase(std::remove_if(stmts.begin(), stmts.end(), isDeclCb), stmts.end()); +} + +GlobalDeclTransformer::ResultT GlobalDeclTransformer::TransformStatements(const ArenaVector &stmts, + bool isPackage) +{ + isPackage_ = isPackage; + result_.classProperties.clear(); + result_.initStatements.clear(); + for (auto stmt : stmts) { + stmt->Accept(this); + } + return std::move(result_); +} + +void GlobalDeclTransformer::VisitFunctionDeclaration(ir::FunctionDeclaration *funcDecl) +{ + auto *funcExpr = util::NodeAllocator::ForceSetParent(allocator_, funcDecl->Function()); + funcDecl->Function()->SetStart(funcDecl->Function()->Id()->End()); + funcExpr->SetRange(funcDecl->Function()->Range()); + ir::MethodDefinitionKind methodKind; + if (funcDecl->Function()->IsExtensionMethod()) { + methodKind = ir::MethodDefinitionKind::EXTENSION_METHOD; + } else { + methodKind = ir::MethodDefinitionKind::METHOD; + } + auto *method = util::NodeAllocator::ForceSetParent( + allocator_, methodKind, funcDecl->Function()->Id()->Clone(allocator_, nullptr), funcExpr, + funcDecl->Function()->Modifiers(), allocator_, false); + method->SetRange(funcDecl->Range()); + result_.classProperties.emplace_back(method); +} + +void GlobalDeclTransformer::VisitVariableDeclaration(ir::VariableDeclaration *varDecl) +{ + for (auto declarator : varDecl->Declarators()) { + auto id = declarator->Id()->AsIdentifier(); + auto typeAnn = id->TypeAnnotation(); + id->SetTsTypeAnnotation(nullptr); + auto *field = util::NodeAllocator::ForceSetParent(allocator_, id->Clone(allocator_, nullptr), + declarator->Init(), typeAnn, + varDecl->Modifiers(), allocator_, false); + field->SetRange(declarator->Range()); + result_.classProperties.emplace_back(field); + if (auto stmt = InitTopLevelProperty(field); stmt != nullptr) { + result_.initStatements.emplace_back(stmt); + } + } +} + +ir::Identifier *GlobalDeclTransformer::RefIdent(const util::StringView &name) +{ + auto *const callee = util::NodeAllocator::Alloc(allocator_, name, allocator_); + callee->SetReference(); + return callee; +} + +ir::ExpressionStatement *GlobalDeclTransformer::InitTopLevelProperty(ir::ClassProperty *classProperty) +{ + ir::ExpressionStatement *initStmt = nullptr; + const auto initializer = classProperty->Value(); + if (!isPackage_ && !classProperty->IsConst() && initializer != nullptr && + !initializer->IsArrowFunctionExpression()) { + auto *ident = RefIdent(classProperty->Id()->Name()); + ident->SetRange(classProperty->Id()->Range()); + + initializer->SetParent(nullptr); + auto *assignmentExpression = util::NodeAllocator::Alloc( + allocator_, ident, initializer->Clone(allocator_, nullptr)->AsExpression(), + lexer::TokenType::PUNCTUATOR_SUBSTITUTION); + assignmentExpression->SetRange({ident->Start(), initializer->End()}); + + auto expressionStatement = + util::NodeAllocator::Alloc(allocator_, assignmentExpression); + expressionStatement->SetRange(classProperty->Range()); + + classProperty->SetRange({ident->Start(), initializer->End()}); + + if (classProperty->TypeAnnotation() != nullptr && !classProperty->TypeAnnotation()->IsETSFunctionType()) { + classProperty->SetValue(nullptr); + } else { + initializer->SetParent(classProperty); + } + initStmt = expressionStatement; + } else { + classProperty->SetStart(classProperty->Id()->Start()); + } + return initStmt; +} + +void GlobalDeclTransformer::HandleNode(ir::AstNode *node) +{ + ASSERT(node->IsStatement()); + if (typeDecl_.count(node->Type()) == 0U) { + ASSERT(!propertiesDecl_.count(node->Type())); + result_.initStatements.emplace_back(node->AsStatement()); + } +} + +} // namespace ark::es2panda::compiler \ No newline at end of file diff --git a/ets2panda/compiler/lowering/ets/topLevelStmts/globalDeclTransformer.h b/ets2panda/compiler/lowering/ets/topLevelStmts/globalDeclTransformer.h new file mode 100644 index 0000000000..0bc667f3ab --- /dev/null +++ b/ets2panda/compiler/lowering/ets/topLevelStmts/globalDeclTransformer.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2023 - 2024 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. + */ + +#ifndef PANDA_GLOBALDECLTRANSFORMER_H +#define PANDA_GLOBALDECLTRANSFORMER_H + +#include "util/helpers.h" +#include "compiler/lowering/phase.h" +#include "ir/visitor/IterateAstVisitor.h" + +namespace ark::es2panda::compiler { + +class GlobalDeclTransformer : public ir::visitor::CustomAstVisitor { + const std::unordered_set typeDecl_ = { + ir::AstNodeType::CLASS_DECLARATION, ir::AstNodeType::STRUCT_DECLARATION, + ir::AstNodeType::TS_ENUM_DECLARATION, ir::AstNodeType::TS_INTERFACE_DECLARATION, + ir::AstNodeType::ETS_PACKAGE_DECLARATION, ir::AstNodeType::ETS_IMPORT_DECLARATION, + ir::AstNodeType::TS_TYPE_ALIAS_DECLARATION, ir::AstNodeType::EXPORT_ALL_DECLARATION, + ir::AstNodeType::EXPORT_NAMED_DECLARATION, ir::AstNodeType::REEXPORT_STATEMENT, + }; + + const std::unordered_set propertiesDecl_ = { + ir::AstNodeType::FUNCTION_DECLARATION, + ir::AstNodeType::VARIABLE_DECLARATION, + }; + +public: + struct ResultT { + explicit ResultT(ArenaAllocator *alloc) : classProperties(alloc->Adapter()), initStatements(alloc->Adapter()) {} + + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) + ArenaVector classProperties; + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) + ArenaVector initStatements; + }; + + explicit GlobalDeclTransformer(ArenaAllocator *allocator) : allocator_(allocator), result_(allocator) {} + + /** + * Removes top level statements, global variable declarations, global function declarations + * @param stmts + */ + void FilterDeclarations(ArenaVector &stmts); + + /** + * Creates ClassProperty for global variables and MethodFunction for global functions. + * Copy top level statements to vector. + * @param stmts top level statements + * @param is_package if current file is package. In package $init$ doesn't contain global variable initializers + * @return pair (class properties, init statements) + */ + ResultT TransformStatements(const ArenaVector &stmts, bool isPackage); + + void VisitFunctionDeclaration(ir::FunctionDeclaration *funcDecl) override; + void VisitVariableDeclaration(ir::VariableDeclaration *varDecl) override; + void HandleNode(ir::AstNode *node) override; + + ir::Identifier *RefIdent(const util::StringView &name); + + ir::ExpressionStatement *InitTopLevelProperty(ir::ClassProperty *classProperty); + +private: + ArenaAllocator *allocator_; + ResultT result_; + bool isPackage_ = false; +}; + +} // namespace ark::es2panda::compiler +#endif // PANDA_GLOBALDECLTRANSFORMER_H diff --git a/ets2panda/compiler/lowering/ets/topLevelStmts/importExportDecls.cpp b/ets2panda/compiler/lowering/ets/topLevelStmts/importExportDecls.cpp new file mode 100644 index 0000000000..3a75d17ee5 --- /dev/null +++ b/ets2panda/compiler/lowering/ets/topLevelStmts/importExportDecls.cpp @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2023 - 2024 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. + */ + +#include "compiler/lowering/ets/topLevelStmts/importExportDecls.h" +#include "ir/ets/etsReExportDeclaration.h" + +namespace ark::es2panda::compiler { + +void ImportExportDecls::ParseDefaultSources() +{ + auto imports = + parser_->ParseDefaultSources(DEFAULT_IMPORT_SOURCE_FILE, defaultImportSource_, util::PathHandler::StdLib()); + varbinder_->FillSourceList(parser_->GetPathes()); + varbinder_->SetDefaultImports(std::move(imports)); +} + +void ImportExportDecls::HandleGlobalStmts(const ArenaVector &programs) +{ + VerifySingleExportDefault(programs); + for (const auto &program : programs) { + auto errorHandler = util::ErrorHandler(program); + fieldMap_.clear(); + exportNameMap_.clear(); + for (auto stmt : program->Ast()->Statements()) { + stmt->Accept(this); + } + for (auto &[exportName, startLoc] : exportNameMap_) { + if (fieldMap_.count(exportName) == 0) { + auto errorStr = "Cannot find name '" + std::string(exportName.Utf8()) + "' to export."; + errorHandler.ThrowSyntaxError(errorStr, startLoc); + } + auto field = fieldMap_[exportName]; + field->AddModifier(ir::ModifierFlags::EXPORT); + } + } +} + +void ImportExportDecls::VisitFunctionDeclaration(ir::FunctionDeclaration *funcDecl) +{ + auto id = funcDecl->Function()->Id(); + fieldMap_.emplace(id->Name(), funcDecl->Function()); +} + +void ImportExportDecls::VisitVariableDeclaration(ir::VariableDeclaration *varDecl) +{ + for (const auto &decl : varDecl->Declarators()) { + auto id = decl->Id()->AsIdentifier(); + fieldMap_.emplace(id->Name(), varDecl); + } +} + +void ImportExportDecls::VisitExportNamedDeclaration(ir::ExportNamedDeclaration *exportDecl) +{ + for (auto spec : exportDecl->Specifiers()) { + auto local = spec->Local(); + exportNameMap_.emplace(local->Name(), local->Start()); + } +} + +void ImportExportDecls::VerifySingleExportDefault(const ArenaVector &programs) +{ + bool metDefaultExport = false; + auto verifyDefault = [&metDefaultExport](ir::Statement *stmt, parser::Program *program) { + if ((stmt->Modifiers() & ir::ModifierFlags::DEFAULT_EXPORT) == 0) { + return; + } + if (metDefaultExport) { + util::ErrorHandler::ThrowSyntaxError(program, "Only one default export is allowed in a module", + stmt->Start()); + } + metDefaultExport = true; + }; + for (const auto &program : programs) { + for (auto stmt : program->Ast()->Statements()) { + verifyDefault(stmt, program); + } + metDefaultExport = false; + } +} + +} // namespace ark::es2panda::compiler diff --git a/ets2panda/compiler/lowering/ets/topLevelStmts/importExportDecls.h b/ets2panda/compiler/lowering/ets/topLevelStmts/importExportDecls.h new file mode 100644 index 0000000000..1bcead43e3 --- /dev/null +++ b/ets2panda/compiler/lowering/ets/topLevelStmts/importExportDecls.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2023 - 2024 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. + */ + +#ifndef PANDA_IMPORTEXPORTDECLS_H +#define PANDA_IMPORTEXPORTDECLS_H + +#include "util/errorHandler.h" +#include +#include "varbinder/ETSBinder.h" +#include "compiler/lowering/phase.h" +#include "ir/visitor/IterateAstVisitor.h" +#include "globalClassHandler.h" + +namespace ark::es2panda::compiler { + +class ImportExportDecls : ir::visitor::EmptyAstVisitor { + static constexpr std::string_view DEFAULT_IMPORT_SOURCE_FILE = ".ets"; + + static std::string CreateDefaultImportSource(const std::vector &paths) + { + std::string importStdlibFile; + for (const auto &path : paths) { + importStdlibFile += "import * from \"" + path + "\";"; + } + return importStdlibFile; + } + + const std::string defaultImportSource_ = CreateDefaultImportSource(util::PathHandler::StdLib()); + +public: + ImportExportDecls() = default; + ImportExportDecls(varbinder::ETSBinder *varbinder, parser::ETSParser *parser) + : varbinder_(varbinder), parser_(parser) + { + } + + /** + * Add stdlib names to default imports + */ + void ParseDefaultSources(); + + /** + * Verifies import errors, and add Exported flag to top level variables and methods + * @param global_stmts program global statements + */ + void HandleGlobalStmts(const ArenaVector &programs); + + void VerifySingleExportDefault(const ArenaVector &programs); + +private: + void VisitFunctionDeclaration(ir::FunctionDeclaration *funcDecl) override; + void VisitVariableDeclaration(ir::VariableDeclaration *varDecl) override; + void VisitExportNamedDeclaration(ir::ExportNamedDeclaration *exportDecl) override; + +private: + varbinder::ETSBinder *varbinder_ {nullptr}; + std::map fieldMap_; + std::map exportNameMap_; + parser::ETSParser *parser_ {nullptr}; +}; +} // namespace ark::es2panda::compiler + +#endif // PANDA_IMPORTEXPORTDECLS_H diff --git a/ets2panda/compiler/lowering/ets/topLevelStmts/topLevelStmts.cpp b/ets2panda/compiler/lowering/ets/topLevelStmts/topLevelStmts.cpp new file mode 100644 index 0000000000..fe6a3b76b7 --- /dev/null +++ b/ets2panda/compiler/lowering/ets/topLevelStmts/topLevelStmts.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023 - 2024 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. + */ + +#include "compiler/lowering/ets/topLevelStmts/topLevelStmts.h" + +#include "compiler/lowering/ets/topLevelStmts/globalClassHandler.h" + +namespace ark::es2panda::compiler { + +bool TopLevelStatements::Perform(public_lib::Context *ctx, parser::Program *program) +{ + GlobalClassHandler globalClass(program->Allocator()); + auto imports = ImportExportDecls(program->VarBinder()->AsETSBinder(), ctx->parser->AsETSParser()); + imports.ParseDefaultSources(); + auto extSrcs = program->ExternalSources(); + for (auto &[_, ext_programs] : extSrcs) { + (void)_; + imports.HandleGlobalStmts(ext_programs); + globalClass.InitGlobalClass(ext_programs); + } + ArenaVector mainModule(program->Allocator()->Adapter()); + mainModule.emplace_back(program); + imports.HandleGlobalStmts(mainModule); + globalClass.InitGlobalClass(mainModule); + return true; +} + +} // namespace ark::es2panda::compiler \ No newline at end of file diff --git a/ets2panda/compiler/lowering/ets/topLevelStmts/topLevelStmts.h b/ets2panda/compiler/lowering/ets/topLevelStmts/topLevelStmts.h new file mode 100644 index 0000000000..0162d5492c --- /dev/null +++ b/ets2panda/compiler/lowering/ets/topLevelStmts/topLevelStmts.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2023 - 2024 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. + */ + +#ifndef ES2PANDA_COMPILER_LOWERING_INITMETHOD_H +#define ES2PANDA_COMPILER_LOWERING_INITMETHOD_H + +#include "compiler/lowering/phase.h" +#include "util/helpers.h" +#include "parser/program/program.h" +#include "compiler/lowering/ets/topLevelStmts/globalDeclTransformer.h" +#include "compiler/lowering/ets/topLevelStmts/importExportDecls.h" + +namespace ark::es2panda::compiler { + +/** + * Purpose of this lowering to: + * Create _$init$_ method + * Add all top level statements to _$init$_ + * Add call of _$init$_ to ETSGLOBAL CCTOR + * Handle imports/exports (re_exports, add stdlib, check existance of named exports) + * + * Expected to be called before ScopesInitPhase + */ +class TopLevelStatements : public Phase { +public: + std::string_view Name() const override + { + return "TopLevelStatements"; + } + + bool Perform(public_lib::Context *ctx, parser::Program *program) override; +}; + +} // namespace ark::es2panda::compiler +#endif \ No newline at end of file diff --git a/ets2panda/compiler/lowering/phase.cpp b/ets2panda/compiler/lowering/phase.cpp index e42c608c4d..2055acf5c9 100644 --- a/ets2panda/compiler/lowering/phase.cpp +++ b/ets2panda/compiler/lowering/phase.cpp @@ -20,6 +20,7 @@ #include "compiler/lowering/ets/defaultParameterLowering.h" #include "compiler/lowering/ets/expandBrackets.h" #include "compiler/lowering/ets/recordLowering.h" +#include "compiler/lowering/ets/topLevelStmts/topLevelStmts.h" #include "compiler/lowering/ets/generateDeclarations.h" #include "compiler/lowering/ets/lambdaLowering.h" #include "compiler/lowering/ets/interfacePropertyDeclarations.h" @@ -65,6 +66,7 @@ static PromiseVoidInferencePhase g_promiseVoidInferencePhase; static RecordLowering g_recordLowering; static StructLowering g_structLowering; static DefaultParameterLowering g_defaultParameterLowering; +static TopLevelStatements g_topLevelStatements; static PluginPhase g_pluginsAfterParse {"plugins-after-parse", ES2PANDA_STATE_PARSED, &util::Plugin::AfterParse}; static PluginPhase g_pluginsAfterCheck {"plugins-after-check", ES2PANDA_STATE_CHECKED, &util::Plugin::AfterCheck}; static PluginPhase g_pluginsAfterLowerings {"plugins-after-lowering", ES2PANDA_STATE_LOWERED, @@ -79,9 +81,10 @@ static InitScopesPhaseJs g_initScopesPhaseJs; std::vector GetETSPhaseList() { return { + &g_pluginsAfterParse, + &g_topLevelStatements, &g_defaultParameterLowering, &g_bigintLowering, - &g_pluginsAfterParse, &g_initScopesPhaseEts, &g_optionalLowering, &g_promiseVoidInferencePhase, diff --git a/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.cpp b/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.cpp index e5211d6666..d140930812 100644 --- a/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.cpp +++ b/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.cpp @@ -13,12 +13,14 @@ * limitations under the License. */ +#include "util/errorHandler.h" #include "scopesInitPhase.h" namespace ark::es2panda::compiler { bool ScopesInitPhase::Perform(PhaseContext *ctx, parser::Program *program) { Prepare(ctx, program); + program->VarBinder()->InitTopScope(); HandleBlockStmt(program->Ast(), GetScope()); Finalize(); return true; @@ -320,10 +322,7 @@ void ScopesInitPhase::IterateNoTParams(ir::ClassDefinition *classDef) void ScopesInitPhase::ThrowSyntaxError(std::string_view errorMessage, const lexer::SourcePosition &pos) const { - lexer::LineIndex index(program_->SourceCode()); - lexer::SourceLocation loc = index.GetLocation(pos); - - throw Error {ErrorType::SYNTAX, program_->SourceFilePath().Utf8(), errorMessage, loc.line, loc.col}; + util::ErrorHandler::ThrowSyntaxError(Program(), errorMessage, pos); } void ScopesInitPhase::CreateFuncDecl(ir::ScriptFunction *func) @@ -793,6 +792,14 @@ void InitScopesPhaseETS::DeclareClassMethod(ir::MethodDefinition *method) } } +void InitScopesPhaseETS::VisitETSReExportDeclaration(ir::ETSReExportDeclaration *reExport) +{ + if (reExport->GetETSImportDeclarations()->Language().IsDynamic()) { + VarBinder()->AsETSBinder()->AddDynamicImport(reExport->GetETSImportDeclarations()); + } + VarBinder()->AsETSBinder()->AddReExportImport(reExport); +} + void InitScopesPhaseETS::VisitETSParameterExpression(ir::ETSParameterExpression *paramExpr) { auto *const var = std::get<1>(VarBinder()->AddParamDecl(paramExpr)); diff --git a/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.h b/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.h index ee243ac6bb..b7705dbc18 100644 --- a/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.h +++ b/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.h @@ -131,6 +131,11 @@ protected: return program_; } + const parser::Program *Program() const + { + return program_; + } + PhaseContext *Context() { return ctx_; @@ -331,6 +336,7 @@ private: void VisitImportNamespaceSpecifier(ir::ImportNamespaceSpecifier *importSpec) override; void VisitImportSpecifier([[maybe_unused]] ir::ImportSpecifier *importSpec) override {}; void VisitImportDefaultSpecifier([[maybe_unused]] ir::ImportDefaultSpecifier *importSpec) override {}; + void VisitETSReExportDeclaration(ir::ETSReExportDeclaration *reExport) override; void VisitETSParameterExpression(ir::ETSParameterExpression *paramExpr) override; void VisitETSImportDeclaration(ir::ETSImportDeclaration *importDecl) override; void VisitTSEnumMember(ir::TSEnumMember *enumMember) override; diff --git a/ets2panda/ir/astNodeMapping.h b/ets2panda/ir/astNodeMapping.h index 7daa895067..3ef6bafe77 100644 --- a/ets2panda/ir/astNodeMapping.h +++ b/ets2panda/ir/astNodeMapping.h @@ -72,6 +72,7 @@ _(PREFIX_ASSERTION_EXPRESSION, PrefixAssertionExpression) \ _(PROPERTY, Property) \ _(REGEXP_LITERAL, RegExpLiteral) \ + _(REEXPORT_STATEMENT, ETSReExportDeclaration) \ _(RETURN_STATEMENT, ReturnStatement) \ _(SCRIPT_FUNCTION, ScriptFunction) \ _(SEQUENCE_EXPRESSION, SequenceExpression) \ diff --git a/ets2panda/ir/base/classElement.cpp b/ets2panda/ir/base/classElement.cpp index 621f74a1aa..075c2e77ce 100644 --- a/ets2panda/ir/base/classElement.cpp +++ b/ets2panda/ir/base/classElement.cpp @@ -20,6 +20,14 @@ namespace ark::es2panda::ir { +void ClassElement::SetValue(Expression *value) noexcept +{ + if (value != nullptr) { + value->SetParent(this); + } + value_ = value; +} + Identifier *ClassElement::Id() noexcept { return key_ != nullptr && key_->IsIdentifier() ? key_->AsIdentifier() : nullptr; diff --git a/ets2panda/ir/base/classElement.h b/ets2panda/ir/base/classElement.h index 185caabad1..8ef3b02dd7 100644 --- a/ets2panda/ir/base/classElement.h +++ b/ets2panda/ir/base/classElement.h @@ -58,16 +58,13 @@ public: return value_; } + void SetValue(Expression *value) noexcept; + [[nodiscard]] const Expression *Value() const noexcept { return value_; } - void SetValue(Expression *value) - { - value_ = value; - } - [[nodiscard]] bool IsPrivateElement() const noexcept; [[nodiscard]] const ArenaVector &Decorators() const noexcept diff --git a/ets2panda/ir/base/scriptFunction.h b/ets2panda/ir/base/scriptFunction.h index 248189cd57..6101c12aeb 100644 --- a/ets2panda/ir/base/scriptFunction.h +++ b/ets2panda/ir/base/scriptFunction.h @@ -289,9 +289,6 @@ public: v->Accept(this); } -private: - friend ark::es2panda::compiler::ScopesInitPhase; - private: Identifier *id_ {}; FunctionSignature irSignature_; diff --git a/ets2panda/ir/ets/etsReExportDeclaration.cpp b/ets2panda/ir/ets/etsReExportDeclaration.cpp new file mode 100644 index 0000000000..ba34dce3b5 --- /dev/null +++ b/ets2panda/ir/ets/etsReExportDeclaration.cpp @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2023 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. + */ + +#include "ir/ets/etsReExportDeclaration.h" +#include "ir/astDump.h" + +namespace ark::es2panda::ir { + +ETSReExportDeclaration::ETSReExportDeclaration(ETSImportDeclaration *etsImportDeclarations, + const std::vector &userPaths, util::StringView programPath, + ArenaAllocator *allocator) + : Statement(AstNodeType::REEXPORT_STATEMENT), + etsImportDeclarations_(etsImportDeclarations), + userPaths_(allocator->Adapter()), + programPath_(programPath) +{ + for (const auto &path : userPaths) { + userPaths_.emplace_back(util::UString(path, allocator).View()); + } +} + +void ETSReExportDeclaration::TransformChildren(const NodeTransformer &cb) +{ + if (etsImportDeclarations_ != nullptr) { + etsImportDeclarations_ = cb(etsImportDeclarations_)->AsETSImportDeclaration(); + } +} + +void ETSReExportDeclaration::Iterate(const NodeTraverser &cb) const +{ + etsImportDeclarations_->Iterate(cb); +} + +void ETSReExportDeclaration::Dump(ir::AstDumper *dumper) const +{ + dumper->Add({{"type", "ETSReExportDeclaration"}, {"ets_import_declarations", etsImportDeclarations_}}); +} + +} // namespace ark::es2panda::ir diff --git a/ets2panda/ir/ets/etsReExportDeclaration.h b/ets2panda/ir/ets/etsReExportDeclaration.h index 4165d6ca81..b35c84392c 100644 --- a/ets2panda/ir/ets/etsReExportDeclaration.h +++ b/ets2panda/ir/ets/etsReExportDeclaration.h @@ -23,17 +23,11 @@ namespace ark::es2panda::ir { -class ETSReExportDeclaration { +class ETSReExportDeclaration : public Statement { public: - explicit ETSReExportDeclaration(ETSImportDeclaration *const etsImportDeclarations, - std::vector const &userPaths, util::StringView programPath, - ArenaAllocator *allocator) - : etsImportDeclarations_(etsImportDeclarations), userPaths_(allocator->Adapter()), programPath_(programPath) - { - for (const auto &path : userPaths) { - userPaths_.emplace_back(util::UString(path, allocator).View()); - } - } + explicit ETSReExportDeclaration(ETSImportDeclaration *etsImportDeclarations, + const std::vector &userPaths, util::StringView programPath, + ArenaAllocator *allocator); ETSImportDeclaration *GetETSImportDeclarations() const { @@ -55,6 +49,32 @@ public: return programPath_; } + void TransformChildren(const NodeTransformer &cb) override; + + void Iterate(const NodeTraverser &cb) const override; + + void Dump(ir::AstDumper *dumper) const override; + void Dump([[maybe_unused]] ir::SrcDumper *dumper) const override {}; + + void Compile(compiler::PandaGen * /*pg*/) const override {} + + void Compile(compiler::ETSGen * /*gen*/) const override {} + + checker::Type *Check(checker::TSChecker * /*checker*/) override + { + return nullptr; + } + + checker::Type *Check(checker::ETSChecker * /*checker*/) override + { + return nullptr; + } + + void Accept(ASTVisitorT *v) override + { + v->Accept(this); + } + private: // NOTE(rsipka): this should use a singular name ETSImportDeclaration *etsImportDeclarations_; diff --git a/ets2panda/ir/visitor/IterateAstVisitor.h b/ets2panda/ir/visitor/IterateAstVisitor.h index 6d154b8a34..d10c855c00 100644 --- a/ets2panda/ir/visitor/IterateAstVisitor.h +++ b/ets2panda/ir/visitor/IterateAstVisitor.h @@ -22,20 +22,57 @@ #include "ir/ets/etsUnionType.h" #include "ir/ets/etsTuple.h" #include "ir/ets/etsNullishTypes.h" +#include "ir/statements/functionDeclaration.h" +#include "ir/expressions/functionExpression.h" +#include "ir/base/scriptFunction.h" +#include "ir/base/methodDefinition.h" +#include "ir/base/classProperty.h" +#include "ir/expressions/identifier.h" +#include "ir/ets/etsReExportDeclaration.h" +#include "ir/statements/variableDeclaration.h" +#include "ir/statements/variableDeclarator.h" namespace ark::es2panda::ir::visitor { +namespace detail { +class DefaultBehaviourAstVisitor : public ASTAbstractVisitor { +public: + DefaultBehaviourAstVisitor() = default; + virtual ~DefaultBehaviourAstVisitor() = 0; + NO_COPY_SEMANTIC(DefaultBehaviourAstVisitor); + NO_MOVE_SEMANTIC(DefaultBehaviourAstVisitor); + + virtual void HandleNode(ir::AstNode *node) = 0; + +// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +#define DECLARE_CLASSES(nodeType, className) \ + void Visit##className(className *node) override \ + { \ + HandleNode(static_cast(node)); \ + } + + AST_NODE_MAPPING(DECLARE_CLASSES) + +// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +#define DECLARE_AST_NODE_CHECK_METHOD(nodeType1, nodeType2, baseClass, reinterpretClass) \ + DECLARE_CLASSES(nodeType1, baseClass); + + AST_NODE_REINTERPRET_MAPPING(DECLARE_AST_NODE_CHECK_METHOD) +#undef DECLARE_AST_NODE_CHECK_METHOD + +#undef DECLARE_CLASSES +}; +inline DefaultBehaviourAstVisitor::~DefaultBehaviourAstVisitor() = default; +} // namespace detail + /** * Children should declare VisitNode methods (might be virtual might be not) * for all classes or provide default behaviour using * template VisitNode(T *t) {} */ -class IterateAstVisitor : public ASTAbstractVisitor { +class IterateAstVisitor : public detail::DefaultBehaviourAstVisitor { public: IterateAstVisitor() = default; - virtual ~IterateAstVisitor() = 0; - NO_COPY_SEMANTIC(IterateAstVisitor); - NO_MOVE_SEMANTIC(IterateAstVisitor); void Iterate(ir::AstNode *node) { @@ -44,25 +81,30 @@ public: } } -// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define DECLARE_CLASSES(nodeType, className) \ - void Visit##className(className *node) override \ - { \ - Iterate(static_cast(node)); \ + void HandleNode(ir::AstNode *node) final + { + Iterate(node); } +}; - AST_NODE_MAPPING(DECLARE_CLASSES) +class EmptyAstVisitor : public detail::DefaultBehaviourAstVisitor { +public: + EmptyAstVisitor() = default; -// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define DECLARE_AST_NODE_CHECK_METHOD(nodeType1, nodeType2, baseClass, reinterpretClass) \ - DECLARE_CLASSES(nodeType1, baseClass); + void HandleNode(ir::AstNode * /*node*/) final {} +}; - AST_NODE_REINTERPRET_MAPPING(DECLARE_AST_NODE_CHECK_METHOD) -#undef DECLARE_AST_NODE_CHECK_METHOD +class AbortAstVisitor : public detail::DefaultBehaviourAstVisitor { +public: + AbortAstVisitor() = default; -#undef DECLARE_CLASSES + void HandleNode(ir::AstNode * /*node*/) final + { + UNREACHABLE(); + } }; -inline IterateAstVisitor::~IterateAstVisitor() = default; + +using CustomAstVisitor = detail::DefaultBehaviourAstVisitor; } // namespace ark::es2panda::ir::visitor diff --git a/ets2panda/lexer/lexer.h b/ets2panda/lexer/lexer.h index 72ec9bae72..4dd897f26c 100644 --- a/ets2panda/lexer/lexer.h +++ b/ets2panda/lexer/lexer.h @@ -114,6 +114,26 @@ public: const Token &GetToken() const; size_t Line() const; + bool TryEatTokenType(lexer::TokenType type) + { + auto token = GetToken(); + if (token.Type() == type) { + NextToken(); + return true; + } + return false; + } + + std::optional TryEatTokenKeyword(lexer::TokenType type) + { + auto token = GetToken(); + if (token.KeywordType() == type) { + NextToken(); + return token; + } + return std::nullopt; + } + LexerPosition Save() const; void Rewind(const LexerPosition &pos); void BackwardToken(TokenType type, size_t offset); diff --git a/ets2panda/parser/ETSparser.cpp b/ets2panda/parser/ETSparser.cpp index 949dec1752..2f005ccbe0 100644 --- a/ets2panda/parser/ETSparser.cpp +++ b/ets2panda/parser/ETSparser.cpp @@ -67,6 +67,8 @@ #include "ir/module/importDeclaration.h" #include "ir/module/importDefaultSpecifier.h" #include "ir/module/importSpecifier.h" +#include "ir/module/exportSpecifier.h" +#include "ir/module/exportNamedDeclaration.h" #include "ir/statements/assertStatement.h" #include "ir/statements/blockStatement.h" #include "ir/statements/emptyStatement.h" @@ -145,121 +147,86 @@ void ETSParser::ParseProgram(ScriptKind kind) // NOTE(user): handle multiple sourceFiles } - auto statements = PrepareGlobalClass(); - ParseDefaultSources(); - - ParseETSGlobalScript(startLoc, statements); + ArenaVector statements(Allocator()->Adapter()); + auto decl = ParsePackageDeclaration(); + if (decl != nullptr) { + statements.emplace_back(decl); + } + auto script = ParseETSGlobalScript(startLoc, statements); GetProgram()->VarBinder()->AsETSBinder()->FillSourceList(this->GetPathes()); + GetProgram()->SetAst(script); } -void ETSParser::ParseETSGlobalScript(lexer::SourcePosition startLoc, ArenaVector &statements) +ir::ETSScript *ETSParser::ParseETSGlobalScript(lexer::SourcePosition startLoc, ArenaVector &statements) { - ParseImportDeclarations(statements); + auto imports = ParseImportDeclarations(); + statements.insert(statements.end(), imports.begin(), imports.end()); - ParseSources(false); + auto topLevelStatements = ParseTopLevelDeclaration(); + statements.insert(statements.end(), topLevelStatements.begin(), topLevelStatements.end()); - ParseTopLevelDeclaration(statements); + AddExternalSource(ParseSources(pathHandler_->GetParseList())); auto *etsScript = AllocNode(Allocator(), std::move(statements), GetProgram()); etsScript->SetRange({startLoc, Lexer()->GetToken().End()}); - GetProgram()->SetAst(etsScript); + return etsScript; } -void ETSParser::CreateGlobalClass() +void ETSParser::AddExternalSource(const std::vector &programs) { - auto *ident = AllocNode(compiler::Signatures::ETS_GLOBAL, Allocator()); - - auto *classDef = AllocNode(Allocator(), ident, ir::ClassDefinitionModifiers::GLOBAL, - ir::ModifierFlags::ABSTRACT, Language(Language::Id::ETS)); - GetProgram()->SetGlobalClass(classDef); - - [[maybe_unused]] auto *classDecl = AllocNode(classDef, Allocator()); -} + for (auto *newProg : programs) { + auto &extSources = globalProgram_->ExternalSources(); -ArenaVector ETSParser::PrepareGlobalClass() -{ - ArenaVector statements(Allocator()->Adapter()); - ParsePackageDeclaration(statements); - CreateGlobalClass(); - - return statements; + const util::StringView name = + newProg->Ast()->Statements().empty() ? newProg->FileName() : newProg->GetPackageName(); + if (extSources.count(name) == 0) { + extSources.emplace(name, Allocator()->Adapter()); + } + extSources.at(name).emplace_back(newProg); + } } -ArenaVector ETSParser::PrepareExternalGlobalClass([[maybe_unused]] const SourceFile &sourceFile) +ArenaVector ETSParser::ParseDefaultSources(std::string_view srcFile, + std::string_view importSrc, + const std::vector &paths) { - ArenaVector statements(Allocator()->Adapter()); - ParsePackageDeclaration(statements); - - if (statements.empty()) { - GetProgram()->SetGlobalClass(globalProgram_->GlobalClass()); - } + auto isp = InnerSourceParser(this); + SourceFile source(srcFile, importSrc); + auto lexer = InitLexer(source); - auto &extSources = globalProgram_->ExternalSources(); + Lexer()->NextToken(); - const util::StringView name = statements.empty() ? GetProgram()->FileName() : GetProgram()->GetPackageName(); - ASSERT(!name.Empty()); - auto res = extSources.find(name); - if (res == extSources.end()) { - CreateGlobalClass(); - auto insRes = extSources.emplace(name, Allocator()->Adapter()); - insRes.first->second.push_back(GetProgram()); - } else { - res->second.push_back(GetProgram()); - auto *extProg = res->second.front(); - GetProgram()->SetGlobalClass(extProg->GlobalClass()); - // NOTE(user): check nullptr cases and handle recursive imports - } + GetContext().Status() |= ParserStatus::IN_DEFAULT_IMPORTS; + auto statements = ParseImportDeclarations(); + GetContext().Status() &= ~ParserStatus::IN_DEFAULT_IMPORTS; + pathHandler_->CollectDefaultSources(paths); + AddExternalSource(ParseSources(pathHandler_->GetParseList())); return statements; } -ETSParser::ImportData ETSParser::GetImportData(const std::string &path) +std::vector ETSParser::ParseSources(const ArenaVector &paths) { - auto &dynamicPaths = ArkTSConfig()->DynamicPaths(); - auto key = ark::os::NormalizePath(path); - - auto it = dynamicPaths.find(key); - if (it == dynamicPaths.cend()) { - key = ark::os::RemoveExtension(key); - } + std::vector programs; - while (it == dynamicPaths.cend() && !key.empty()) { - it = dynamicPaths.find(key); - if (it != dynamicPaths.cend()) { - break; - } - key = ark::os::GetParentDir(key); - } - - if (it != dynamicPaths.cend()) { - return {it->second.GetLanguage(), key, it->second.HasDecl()}; + for (const auto &path : paths) { + pathHandler_->MarkAsParsed(path); } - return {ToLanguage(Extension()), path, true}; -} -void ETSParser::ParseSources(bool isExternal) -{ - GetContext().Status() |= isExternal ? ParserStatus::IN_EXTERNAL : ParserStatus::IN_IMPORT; - - for (const auto &path : pathHandler_->GetParseList()) { - // NOTE(rsipka): could be handled nicer, but need to avoid recursive parses - if (pathHandler_->IsParsed(path)) { - continue; - } - const auto data = GetImportData(path); + for (const auto &path : paths) { + std::ifstream inputStream(path.Mutf8()); + const auto data = pathHandler_->GetImportData(path, Extension()); if (!data.hasDecl) { continue; } - std::ifstream inputStream(path); - - if (GetProgram()->SourceFilePath().Is(path)) { + if (GetProgram()->SourceFilePath().Is(path.Mutf8())) { break; } if (inputStream.fail()) { - ThrowSyntaxError({"Failed to open file: ", path}); + ThrowSyntaxError({"Failed to open file: ", path.Mutf8()}); } std::stringstream ss; @@ -267,34 +234,16 @@ void ETSParser::ParseSources(bool isExternal) auto externalSource = ss.str(); auto currentLang = GetContext().SetLanguage(data.lang); + auto extSrc = Allocator()->New(externalSource, Allocator()); pathHandler_->MarkAsParsed(path); - ParseSource({path, externalSource.c_str(), path, false}); + auto newProg = ParseSource({path.Utf8(), extSrc->View().Utf8(), path.Utf8(), false}); + programs.emplace_back(newProg); GetContext().SetLanguage(currentLang); } - - GetContext().Status() &= isExternal ? ~ParserStatus::IN_EXTERNAL : ~ParserStatus::IN_IMPORT; -} - -void ETSParser::ParseDefaultSources() -{ - auto isp = InnerSourceParser(this); - SourceFile source(varbinder::ETSBinder::DEFAULT_IMPORT_SOURCE_FILE, varbinder::ETSBinder::DEFAULT_IMPORT_SOURCE); - auto lexer = InitLexer(source); - ArenaVector statements(Allocator()->Adapter()); - - Lexer()->NextToken(); - - GetContext().Status() |= ParserStatus::IN_DEFAULT_IMPORTS; - - ParseImportDeclarations(statements); - GetContext().Status() &= ~ParserStatus::IN_DEFAULT_IMPORTS; - - pathHandler_->CollectDefaultSources(); - - ParseSources(true); + return programs; } -void ETSParser::ParseSource(const SourceFile &sourceFile) +parser::Program *ETSParser::ParseSource(const SourceFile &sourceFile) { auto *program = Allocator()->New(Allocator(), GetProgram()->VarBinder()); auto esp = ExternalSourceParser(this, program); @@ -303,445 +252,143 @@ void ETSParser::ParseSource(const SourceFile &sourceFile) lexer::SourcePosition startLoc = Lexer()->GetToken().Start(); Lexer()->NextToken(); - auto statements = PrepareExternalGlobalClass(sourceFile); - ParseETSGlobalScript(startLoc, statements); -} - -ir::ScriptFunction *ETSParser::AddInitMethod(ArenaVector &globalProperties) -{ - if (GetProgram()->Kind() == ScriptKind::STDLIB) { - return nullptr; + ArenaVector statements(Allocator()->Adapter()); + auto decl = ParsePackageDeclaration(); + if (decl != nullptr) { + statements.emplace_back(decl); } - - // Lambda to create empty function node with signature: func(): void - // NOTE: replace with normal createFunction call - auto const createFunction = - [this](std::string_view const functionName, ir::ScriptFunctionFlags functionFlags, - ir::ModifierFlags const functionModifiers) -> std::pair { - auto *initIdent = AllocNode(functionName, Allocator()); - ir::ScriptFunction *initFunc; - - { - ArenaVector params(Allocator()->Adapter()); - - ArenaVector statements(Allocator()->Adapter()); - auto *initBody = AllocNode(Allocator(), std::move(statements)); - - initFunc = AllocNode(ir::FunctionSignature(nullptr, std::move(params), nullptr), - initBody, functionFlags, false, GetContext().GetLanguage()); - } - - initFunc->SetIdent(initIdent); - initFunc->AddModifier(functionModifiers); - - auto *funcExpr = AllocNode(initFunc); - - auto *initMethod = AllocNode(ir::MethodDefinitionKind::METHOD, - initIdent->Clone(Allocator(), nullptr)->AsExpression(), - funcExpr, functionModifiers, Allocator(), false); - initFunc->Id()->SetReference(); - - return std::make_pair(initFunc, initMethod); - }; - - // Create public method for module re-initialization. The assignments and statements are sequentially called inside. - auto [init_func, init_method] = createFunction(compiler::Signatures::INIT_METHOD, ir::ScriptFunctionFlags::NONE, - ir::ModifierFlags::STATIC | ir::ModifierFlags::PUBLIC); - globalProperties.emplace_back(init_method); - - return init_func; + auto script = ParseETSGlobalScript(startLoc, statements); + program->SetAst(script); + return program; } -void ETSParser::MarkNodeAsExported(ir::AstNode *node, lexer::SourcePosition startPos, bool defaultExport, - std::size_t numOfElements) +ArenaVector ETSParser::ParseTopLevelStatements() { - ir::ModifierFlags flag = defaultExport ? ir::ModifierFlags::DEFAULT_EXPORT : ir::ModifierFlags::EXPORT; - - if (UNLIKELY(flag == ir::ModifierFlags::DEFAULT_EXPORT)) { - if (numOfElements > 1) { - ThrowSyntaxError("Only one default export is allowed in a module", startPos); + ArenaVector statements(Allocator()->Adapter()); + while (Lexer()->GetToken().Type() != lexer::TokenType::EOS) { + if (Lexer()->TryEatTokenType(lexer::TokenType::PUNCTUATOR_SEMI_COLON)) { + continue; } - } - - node->AddModifier(flag); -} - -ArenaVector ETSParser::ParseTopLevelStatements(ArenaVector &statements) -{ - ArenaVector globalProperties(Allocator()->Adapter()); - fieldMap_.clear(); - exportNameMap_.clear(); - - // Add special '_$init$_' method that will hold all the top-level variable initializations (as assignments) and - // statements. By default it will be called in the global class static constructor but also it can be called - // directly from outside using public '_$init$_' method call in global scope. - // NOTE: now only a single-file modules are supported. Such a technique can be implemented in packages directly. - ir::ScriptFunction *initFunction = nullptr; - if (GetProgram()->GetPackageName().Empty()) { - initFunction = AddInitMethod(globalProperties); - } - - ParseTopLevelNextToken(statements, globalProperties, initFunction); - - // Add export modifier flag to nodes exported in previous statements. - for (auto &iter : exportNameMap_) { - util::StringView exportName = iter.first; - lexer::SourcePosition startLoc = exportNameMap_[exportName]; - if (fieldMap_.count(exportName) == 0) { - ThrowSyntaxError("Cannot find name '" + std::string {exportName.Utf8()} + "' to export.", startLoc); + auto stmt = ParseTopLevelStatement(); + GetContext().Status() &= ~ParserStatus::IN_AMBIENT_CONTEXT; + if (stmt != nullptr) { + statements.emplace_back(stmt); } - auto field = fieldMap_[exportName]; - // selective export does not support default - MarkNodeAsExported(field, startLoc, false); } - return globalProperties; -} - -void ETSParser::ParseTopLevelType(ArenaVector &statements, bool &defaultExport, - std::size_t const currentPos, - std::function const &parserFunction) -{ - ir::Statement *node = nullptr; - node = parserFunction(this); - if (node != nullptr) { - if (currentPos != std::numeric_limits::max()) { - MarkNodeAsExported(node, node->Start(), defaultExport); - defaultExport = false; - } - statements.push_back(node); - } + return statements; } -void ETSParser::ParseTopLevelNextTokenDefault(ArenaVector &statements, - ir::ScriptFunction *initFunction, size_t currentPos, - lexer::TokenType tokenType, bool defaultExport) +ir::Statement *ETSParser::ParseTopLevelDeclStatement(StatementParsingFlags flags) { - if (IsStructKeyword()) { - ParseTopLevelType(statements, defaultExport, currentPos, - [](ETSParser *obj) { return obj->ParseTypeDeclaration(false); }); - return; + auto [memberModifiers, startLoc] = ParseMemberModifiers(); + if ((memberModifiers & (ir::ModifierFlags::EXPORT | ir::ModifierFlags::DEFAULT_EXPORT)) != 0U && + (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_MULTIPLY || + Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_LEFT_BRACE)) { + return ParseExport(startLoc, memberModifiers); } - if (IsTypeKeyword()) { - ParseTopLevelType(statements, defaultExport, currentPos, &ETSParser::ParseTypeAliasDeclaration); - return; - } - - if (initFunction != nullptr) { - if (auto *const statement = ParseTopLevelStatement(); statement != nullptr) { - statement->SetParent(initFunction->Body()); - initFunction->Body()->AsBlockStatement()->Statements().emplace_back(statement); + ir::Statement *result = nullptr; + auto token = Lexer()->GetToken(); + switch (token.Type()) { + case lexer::TokenType::KEYW_FUNCTION: { + result = ParseFunctionDeclaration(false, memberModifiers); + result->SetStart(startLoc); + break; } - return; - } - - ThrowUnexpectedToken(tokenType); -} - -ir::ModifierFlags ETSParser::ResolveMemberModifiers() -{ - auto memberModifiers = ir::ModifierFlags::STATIC | ir::ModifierFlags::PUBLIC; - - if (Lexer()->GetToken().KeywordType() == lexer::TokenType::KEYW_DECLARE) { - CheckDeclare(); - memberModifiers |= ir::ModifierFlags::DECLARE; - } - return memberModifiers; -} - -lexer::SourcePosition ETSParser::ParseTopLevelNextTokenResolution(ArenaVector &statements, - ArenaVector &globalProperties, - ir::ScriptFunction *initFunction, size_t currentPos, - bool defaultExport) -{ - lexer::SourcePosition startLoc = Lexer()->GetToken().Start(); - auto memberModifiers = ResolveMemberModifiers(); - - switch (auto const tokenType = Lexer()->GetToken().Type(); tokenType) { case lexer::TokenType::KEYW_CONST: { memberModifiers |= ir::ModifierFlags::CONST; [[fallthrough]]; } case lexer::TokenType::KEYW_LET: { - Lexer()->NextToken(); - ParseClassFieldDefinition(ExpectIdentifier(), memberModifiers, &globalProperties, initFunction, &startLoc); - break; - } - case lexer::TokenType::KEYW_ASYNC: - case lexer::TokenType::KEYW_NATIVE: { - ParseTokenOfNative(tokenType, memberModifiers); - [[fallthrough]]; - } - case lexer::TokenType::KEYW_FUNCTION: { - ParseTokenOfFunction(memberModifiers, startLoc, globalProperties); + result = ParseStatement(flags); break; } case lexer::TokenType::KEYW_NAMESPACE: - [[fallthrough]]; case lexer::TokenType::KEYW_STATIC: - [[fallthrough]]; case lexer::TokenType::KEYW_ABSTRACT: - [[fallthrough]]; case lexer::TokenType::KEYW_FINAL: - [[fallthrough]]; case lexer::TokenType::KEYW_ENUM: - [[fallthrough]]; case lexer::TokenType::KEYW_INTERFACE: - [[fallthrough]]; case lexer::TokenType::KEYW_CLASS: { - // NOLINTBEGIN(modernize-avoid-bind) - ParseTopLevelType(statements, defaultExport, currentPos, - std::bind(&ETSParser::ParseTypeDeclaration, std::placeholders::_1, false)); - // NOLINTEND(modernize-avoid-bind) + result = ParseTypeDeclaration(false); + break; + } + case lexer::TokenType::LITERAL_IDENT: { + result = ParseIdentKeyword(); break; } default: { - // If struct is a soft keyword, handle it here, otherwise it's an identifier. - ParseTopLevelNextTokenDefault(statements, initFunction, currentPos, tokenType, defaultExport); + break; } } - return startLoc; + if (result != nullptr) { + result->AddModifier(memberModifiers); + } + return result; } -void ETSParser::ParseTopLevelNextToken(ArenaVector &statements, - ArenaVector &globalProperties, ir::ScriptFunction *initFunction) +ir::Statement *ETSParser::ParseTopLevelStatement() { - bool defaultExport = false; - - while (Lexer()->GetToken().Type() != lexer::TokenType::EOS) { - if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_SEMI_COLON) { - Lexer()->NextToken(); - continue; - } - - auto currentPos = std::numeric_limits::max(); - if (Lexer()->GetToken().Type() == lexer::TokenType::KEYW_EXPORT) { - Lexer()->NextToken(); - currentPos = globalProperties.size(); - - if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_MULTIPLY || - Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_LEFT_BRACE) { - ParseExport(Lexer()->GetToken().Start()); - continue; - } - - if (Lexer()->GetToken().KeywordType() == lexer::TokenType::KEYW_DEFAULT) { - defaultExport = true; - Lexer()->NextToken(); - } - } - - lexer::SourcePosition startLoc = - ParseTopLevelNextTokenResolution(statements, globalProperties, initFunction, currentPos, defaultExport); - - GetContext().Status() &= ~ParserStatus::IN_AMBIENT_CONTEXT; + const auto flags = StatementParsingFlags::ALLOW_LEXICAL; + static const std::unordered_set ALLOWED_TOP_LEVEL_STMTS = { + lexer::TokenType::PUNCTUATOR_LEFT_BRACE, + lexer::TokenType::PUNCTUATOR_SEMI_COLON, + lexer::TokenType::KEYW_ASSERT, + lexer::TokenType::KEYW_IF, + lexer::TokenType::KEYW_DO, + lexer::TokenType::KEYW_FOR, + lexer::TokenType::KEYW_TRY, + lexer::TokenType::KEYW_WHILE, + lexer::TokenType::KEYW_BREAK, + lexer::TokenType::KEYW_CONTINUE, + lexer::TokenType::KEYW_THROW, + lexer::TokenType::KEYW_SWITCH, + lexer::TokenType::KEYW_DEBUGGER, + lexer::TokenType::LITERAL_IDENT, + }; - while (currentPos < globalProperties.size()) { - MarkNodeAsExported(globalProperties[currentPos], startLoc, defaultExport, - globalProperties.size() - currentPos); - defaultExport = false; - currentPos++; + auto result = ParseTopLevelDeclStatement(flags); + if (result == nullptr) { + auto const tokenType = Lexer()->GetToken().Type(); + if (ALLOWED_TOP_LEVEL_STMTS.count(tokenType) != 0U) { + result = ParseStatement(flags); + } else { + ThrowUnexpectedToken(tokenType); } } + return result; } -void ETSParser::ParseTokenOfNative(ark::es2panda::lexer::TokenType tokenType, ir::ModifierFlags &memberModifiers) +ArenaVector ETSParser::ParseTopLevelDeclaration() { - bool isAsync = tokenType == lexer::TokenType::KEYW_ASYNC; - - if (isAsync) { - memberModifiers |= ir::ModifierFlags::ASYNC; - } else { - memberModifiers |= ir::ModifierFlags::NATIVE; - } - + auto topStatements = ParseTopLevelStatements(); Lexer()->NextToken(); - - if (Lexer()->GetToken().Type() != lexer::TokenType::KEYW_FUNCTION) { - ThrowSyntaxError({isAsync ? "'async'" : "'native'", " flags must be used for functions at top-level."}); - } + return topStatements; } -void ETSParser::ParseTokenOfFunction(ir::ModifierFlags memberModifiers, lexer::SourcePosition startLoc, - ArenaVector &globalProperties) +static bool IsClassModifier(lexer::TokenType type) { - Lexer()->NextToken(); - // check whether it is an extension function - ir::Identifier *className = nullptr; - if (Lexer()->Lookahead() == lexer::LEX_CHAR_DOT) { - className = ExpectIdentifier(); - Lexer()->NextToken(); - } - - auto *memberName = ExpectIdentifier(); - auto *classMethod = ParseClassMethodDefinition(memberName, memberModifiers, className); - classMethod->SetStart(startLoc); - if (!classMethod->Function()->IsOverload()) { - globalProperties.push_back(classMethod); - } + return type == lexer::TokenType::KEYW_STATIC || type == lexer::TokenType::KEYW_ABSTRACT || + type == lexer::TokenType::KEYW_FINAL; } -// NOLINTNEXTLINE(google-default-arguments) -ir::Statement *ETSParser::ParseTopLevelStatement(StatementParsingFlags flags) +ir::Statement *ETSParser::ParseIdentKeyword() { - switch (auto const tokenType = Lexer()->GetToken().Type(); tokenType) { - case lexer::TokenType::PUNCTUATOR_LEFT_BRACE: { - return ParseBlockStatement(); - } - case lexer::TokenType::PUNCTUATOR_SEMI_COLON: { - return ParseEmptyStatement(); - } - case lexer::TokenType::KEYW_ASSERT: { - return ParseAssertStatement(); - } - case lexer::TokenType::KEYW_IF: { - return ParseIfStatement(); - } - case lexer::TokenType::KEYW_DO: { - return ParseDoWhileStatement(); - } - case lexer::TokenType::KEYW_FOR: { - return ParseForStatement(); - } - case lexer::TokenType::KEYW_TRY: { - return ParseTryStatement(); - } - case lexer::TokenType::KEYW_WHILE: { - return ParseWhileStatement(); - } - case lexer::TokenType::KEYW_BREAK: { - return ParseBreakStatement(); - } - case lexer::TokenType::KEYW_CONTINUE: { - return ParseContinueStatement(); + const auto token = Lexer()->GetToken(); + ASSERT(token.Type() == lexer::TokenType::LITERAL_IDENT); + switch (token.KeywordType()) { + case lexer::TokenType::KEYW_STRUCT: { + return ParseTypeDeclaration(false); } - case lexer::TokenType::KEYW_THROW: { - return ParseThrowStatement(); - } - case lexer::TokenType::KEYW_SWITCH: { - return ParseSwitchStatement(); - } - case lexer::TokenType::KEYW_DEBUGGER: { - return ParseDebuggerStatement(); - } - case lexer::TokenType::LITERAL_IDENT: { - if (Lexer()->Lookahead() == lexer::LEX_CHAR_COLON) { - const auto pos = Lexer()->Save(); - Lexer()->NextToken(); - return ParseLabelledStatement(pos); - } - - return ParseExpressionStatement(flags); - } - // These cases never can occur here! - case lexer::TokenType::KEYW_EXPORT: - [[fallthrough]]; - case lexer::TokenType::KEYW_IMPORT: - [[fallthrough]]; - case lexer::TokenType::KEYW_RETURN: { - ThrowUnexpectedToken(tokenType); + case lexer::TokenType::KEYW_TYPE: { + return ParseTypeAliasDeclaration(); } - // Note: let's leave the default processing case separately, because it can be changed in the future. default: { - ThrowUnexpectedToken(tokenType); - // return ParseExpressionStatement(flags); - } - } -} - -void ETSParser::ParseTopLevelDeclaration(ArenaVector &statements) -{ - lexer::SourcePosition classBodyStartLoc = Lexer()->GetToken().Start(); - auto globalProperties = ParseTopLevelStatements(statements); - - auto *classDef = GetProgram()->GlobalClass(); - - if (classDef->IsGlobalInitialized()) { - classDef->AddProperties(std::move(globalProperties)); - Lexer()->NextToken(); - return; - } - - CreateCCtor(globalProperties, classBodyStartLoc, GetProgram()->Kind() != ScriptKind::STDLIB); - classDef->AddProperties(std::move(globalProperties)); - auto *classDecl = classDef->Parent()->AsClassDeclaration(); - classDef->SetGlobalInitialized(); - classDef->SetRange(classDef->Range()); - - statements.push_back(classDecl); - Lexer()->NextToken(); -} - -// NOLINTNEXTLINE(google-default-arguments) -void ETSParser::CreateCCtor(ArenaVector &properties, const lexer::SourcePosition &loc, - const bool inGlobalClass) -{ - bool hasStaticField = false; - for (const auto *prop : properties) { - if (prop->IsClassStaticBlock()) { - return; - } - - if (!prop->IsClassProperty()) { - continue; - } - - const auto *field = prop->AsClassProperty(); - - if (field->IsStatic()) { - hasStaticField = true; - } - } - - if (!hasStaticField && !inGlobalClass) { - return; - } - - ArenaVector params(Allocator()->Adapter()); - ArenaVector statements(Allocator()->Adapter()); - - // Add the call to special '_$init$_' method containing all the top-level variable initializations (as assignments) - // and statements to the end of static constructor of the global class. - if (inGlobalClass) { - if (auto const it = std::find_if(properties.begin(), properties.end(), - [](ir::AstNode const *const item) { - return item->IsMethodDefinition() && - item->AsMethodDefinition()->Id()->Name() == - compiler::Signatures::INIT_METHOD; - }); - it != properties.end()) { - if (!(*it)->AsMethodDefinition()->Function()->Body()->AsBlockStatement()->Statements().empty()) { - auto *const callee = AllocNode(compiler::Signatures::INIT_METHOD, Allocator()); - callee->SetReference(); - - auto *const callExpr = AllocNode( - callee, ArenaVector(Allocator()->Adapter()), nullptr, false, false); - - statements.emplace_back(AllocNode(callExpr)); - } + break; } } - - auto *id = AllocNode(compiler::Signatures::CCTOR, Allocator()); - auto *body = AllocNode(Allocator(), std::move(statements)); - auto *func = AllocNode( - ir::FunctionSignature(nullptr, std::move(params), nullptr), body, - ir::ScriptFunction::ScriptFunctionData {ir::ScriptFunctionFlags::STATIC_BLOCK | ir::ScriptFunctionFlags::HIDDEN, - ir::ModifierFlags::STATIC, false, GetContext().GetLanguage()}); - func->SetIdent(id); - - auto *funcExpr = AllocNode(func); - auto *staticBlock = AllocNode(funcExpr, Allocator()); - staticBlock->AddModifier(ir::ModifierFlags::STATIC); - staticBlock->SetRange({loc, loc}); - properties.push_back(staticBlock); -} - -static bool IsClassModifier(lexer::TokenType type) -{ - return type == lexer::TokenType::KEYW_STATIC || type == lexer::TokenType::KEYW_ABSTRACT || - type == lexer::TokenType::KEYW_FINAL; + return nullptr; } ir::ModifierFlags ETSParser::ParseClassModifiers() @@ -1005,10 +652,9 @@ ir::ModifierFlags ETSParser::ParseClassMethodModifiers(bool seenStatic) // NOLINTNEXTLINE(google-default-arguments) void ETSParser::ParseClassFieldDefinition(ir::Identifier *fieldName, ir::ModifierFlags modifiers, - ArenaVector *declarations, ir::ScriptFunction *initFunction, - lexer::SourcePosition *letLoc) + ArenaVector *declarations, lexer::SourcePosition *letLoc) { - lexer::SourcePosition startLoc = letLoc != nullptr ? *letLoc : Lexer()->GetToken().Start(); + lexer::SourcePosition startLoc = letLoc != nullptr ? *letLoc : fieldName->Start(); lexer::SourcePosition endLoc = startLoc; ir::TypeNode *typeAnnotation = nullptr; TypeAnnotationParsingOptions options = TypeAnnotationParsingOptions::THROW_ERROR; @@ -1025,21 +671,12 @@ void ETSParser::ParseClassFieldDefinition(ir::Identifier *fieldName, ir::Modifie } else if (typeAnnotation == nullptr) { ThrowSyntaxError("Field type annotation expected"); } - - // Add initialization of top-level (global) variables to a special '_$init$_' function so that it could be - // performed multiple times. - if (initFunction != nullptr && (modifiers & ir::ModifierFlags::CONST) == 0U && initializer != nullptr && - !initializer->IsArrowFunctionExpression()) { - endLoc = InitializeGlobalVariable(fieldName, initializer, initFunction, startLoc, typeAnnotation); - } - bool isDeclare = (modifiers & ir::ModifierFlags::DECLARE) != 0; if (isDeclare && initializer != nullptr) { ThrowSyntaxError("Initializers are not allowed in ambient contexts."); } auto *field = AllocNode(fieldName, initializer, typeAnnotation, modifiers, Allocator(), false); - startLoc = fieldName->Start(); if (initializer != nullptr) { endLoc = initializer->End(); } else { @@ -1047,7 +684,6 @@ void ETSParser::ParseClassFieldDefinition(ir::Identifier *fieldName, ir::Modifie } field->SetRange({startLoc, endLoc}); - fieldMap_.insert({fieldName->Name(), field}); declarations->push_back(field); if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_COMMA) { @@ -1057,38 +693,6 @@ void ETSParser::ParseClassFieldDefinition(ir::Identifier *fieldName, ir::Modifie } } -lexer::SourcePosition ETSParser::InitializeGlobalVariable(ir::Identifier *fieldName, ir::Expression *&initializer, - ir::ScriptFunction *initFunction, - lexer::SourcePosition &startLoc, ir::TypeNode *typeAnnotation) -{ - lexer::SourcePosition endLoc = startLoc; - - if (auto *const funcBody = initFunction->Body(); funcBody != nullptr && funcBody->IsBlockStatement()) { - auto *ident = AllocNode(fieldName->Name(), Allocator()); - ident->SetReference(); - ident->SetRange(fieldName->Range()); - - auto *assignmentExpression = AllocNode( - ident, initializer->Clone(Allocator(), nullptr)->AsExpression(), lexer::TokenType::PUNCTUATOR_SUBSTITUTION); - endLoc = initializer->End(); - assignmentExpression->SetRange({fieldName->Start(), endLoc}); - - auto expressionStatement = AllocNode(assignmentExpression); - if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_SEMI_COLON) { - endLoc = Lexer()->GetToken().End(); - } - expressionStatement->SetParent(funcBody); - expressionStatement->SetRange({startLoc, endLoc}); - funcBody->AsBlockStatement()->Statements().emplace_back(expressionStatement); - expressionStatement->SetParent(funcBody); - - if (typeAnnotation != nullptr && !typeAnnotation->IsETSFunctionType()) { - initializer = nullptr; - } - } - return endLoc; -} - ir::MethodDefinition *ETSParser::ParseClassMethodDefinition(ir::Identifier *methodName, ir::ModifierFlags modifiers, ir::Identifier *className, [[maybe_unused]] ir::Identifier *identNode) @@ -1126,11 +730,7 @@ ir::MethodDefinition *ETSParser::ParseClassMethodDefinition(ir::Identifier *meth auto *method = AllocNode(methodKind, methodName->Clone(Allocator(), nullptr)->AsExpression(), funcExpr, modifiers, Allocator(), false); method->SetRange(funcExpr->Range()); - func->Id()->SetReference(); - - fieldMap_.insert({methodName->Name(), method}); - return method; } @@ -1604,12 +1204,10 @@ ir::TSTypeAliasDeclaration *ETSParser::ParseTypeAliasDeclaration() params->SetParent(typeAliasDecl); } - if (Lexer()->GetToken().Type() != lexer::TokenType::PUNCTUATOR_SUBSTITUTION) { + if (!Lexer()->TryEatTokenType(lexer::TokenType::PUNCTUATOR_SUBSTITUTION)) { ThrowSyntaxError("'=' expected"); } - Lexer()->NextToken(); // eat '=' - TypeAnnotationParsingOptions options = TypeAnnotationParsingOptions::THROW_ERROR; ir::TypeNode *typeAnnotation = ParseTypeAnnotation(&options); typeAliasDecl->SetTsTypeAnnotation(typeAnnotation); @@ -1651,7 +1249,7 @@ ir::TSInterfaceDeclaration *ETSParser::ParseInterfaceBody(ir::Identifier *name, auto *body = AllocNode(std::move(members)); body->SetRange({bodyStart, Lexer()->GetToken().End()}); - const auto isExternal = (GetContext().Status() & ParserStatus::IN_EXTERNAL); + const auto isExternal = IsExternal(); auto *interfaceDecl = AllocNode( Allocator(), name, typeParamDecl, body, std::move(extends), isStatic, isExternal, GetContext().GetLanguage()); @@ -1750,7 +1348,6 @@ ir::ClassDefinition *ETSParser::ParseClassDefinition(ir::ClassDefinitionModifier // Parse ClassBody auto [ctor, properties, bodyRange] = ParseClassBody(modifiers, flags, identNode); - CreateCCtor(properties, bodyRange.start); auto *classDefinition = AllocNode( util::StringView(), identNode, typeParamDecl, superTypeParams, std::move(implements), ctor, superClass, @@ -1814,10 +1411,9 @@ ir::ClassProperty *ETSParser::ParseInterfaceField() Lexer()->NextToken(); ir::TypeNode *typeAnnotation = nullptr; - if (Lexer()->GetToken().Type() != lexer::TokenType::PUNCTUATOR_COLON) { - ThrowSyntaxError("Interface fields must have typeannotation."); + if (!Lexer()->TryEatTokenType(lexer::TokenType::PUNCTUATOR_COLON)) { + ThrowSyntaxError("Interface fields must have type annotation."); } - Lexer()->NextToken(); // eat ':' TypeAnnotationParsingOptions options = TypeAnnotationParsingOptions::THROW_ERROR; typeAnnotation = ParseTypeAnnotation(&options); @@ -1825,7 +1421,7 @@ ir::ClassProperty *ETSParser::ParseInterfaceField() typeAnnotation->SetParent(name); if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_EQUAL) { - ThrowSyntaxError("Initializers are not allowed on interface propertys."); + ThrowSyntaxError("Initializers are not allowed on interface properties."); } ir::ModifierFlags fieldModifiers = ir::ModifierFlags::PUBLIC; @@ -2104,8 +1700,7 @@ ir::AstNode *ETSParser::ParseTypeLiteralOrInterfaceMember() return ParseInterfaceGetterSetterMethod(methodFlags); } - if (Lexer()->GetToken().KeywordType() == lexer::TokenType::KEYW_READONLY) { - Lexer()->NextToken(); // eat 'readonly' keyword + if (Lexer()->TryEatTokenKeyword(lexer::TokenType::KEYW_READONLY)) { auto *field = ParseInterfaceField(); field->SetStart(startLoc); field->AddModifier(ir::ModifierFlags::READONLY); @@ -2684,7 +2279,7 @@ ir::DebuggerStatement *ETSParser::ParseDebuggerStatement() ThrowUnexpectedToken(lexer::TokenType::KEYW_DEBUGGER); } -void ETSParser::ParseExport(lexer::SourcePosition startLoc) +ir::Statement *ETSParser::ParseExport(lexer::SourcePosition startLoc, ir::ModifierFlags modifiers) { ASSERT(Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_MULTIPLY || Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_LEFT_BRACE); @@ -2693,11 +2288,19 @@ void ETSParser::ParseExport(lexer::SourcePosition startLoc) if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_MULTIPLY) { ParseNameSpaceSpecifier(&specifiers, true); } else { - ParseNamedSpecifiers(&specifiers, true); + auto specs = ParseNamedSpecifiers(); - if (Lexer()->GetToken().KeywordType() != lexer::TokenType::KEYW_FROM) { - // selective export directive - return; + if (Lexer()->GetToken().KeywordType() == lexer::TokenType::KEYW_FROM) { + specifiers = util::Helpers::ConvertVector(specs); + } else { + ArenaVector exports(Allocator()->Adapter()); + for (auto spec : specs) { + exports.emplace_back(AllocNode(spec->Local(), spec->Imported())); + } + auto result = AllocNode(Allocator(), static_cast(nullptr), + std::move(exports)); + result->AddModifier(modifiers); + return result; } } @@ -2708,18 +2311,12 @@ void ETSParser::ParseExport(lexer::SourcePosition startLoc) auto *reExportDeclaration = AllocNode(reExportSource, specifiers); reExportDeclaration->SetRange({startLoc, endLoc}); - auto varbinder = GetProgram()->VarBinder()->AsETSBinder(); - if (reExportDeclaration->Language().IsDynamic()) { - varbinder->AddDynamicImport(reExportDeclaration); - } - ConsumeSemicolon(reExportDeclaration); - auto *reExport = Allocator()->New(reExportDeclaration, std::vector(), - GetProgram()->SourceFilePath(), Allocator()); - varbinder->AddReExportImport(reExport); - // parse reexport sources which were added in the previous parsing method - ParseSources(false); + auto reExport = AllocNode(reExportDeclaration, std::vector(), + GetProgram()->SourceFilePath(), Allocator()); + reExport->AddModifier(modifiers); + return reExport; } ir::Statement *ETSParser::ParseFunctionStatement([[maybe_unused]] const StatementParsingFlags flags) @@ -2728,20 +2325,19 @@ ir::Statement *ETSParser::ParseFunctionStatement([[maybe_unused]] const Statemen ThrowSyntaxError("Nested functions are not allowed"); } -void ETSParser::ParsePackageDeclaration(ArenaVector &statements) +ir::ETSPackageDeclaration *ETSParser::ParsePackageDeclaration() { auto startLoc = Lexer()->GetToken().Start(); if (Lexer()->GetToken().Type() != lexer::TokenType::KEYW_PACKAGE) { if (!IsETSModule() && GetProgram()->IsEntryPoint()) { pathHandler_->SetModuleName(GetProgram()->AbsoluteName(), util::StringView(""), false); - return; + return nullptr; } pathHandler_->SetModuleName(GetProgram()->AbsoluteName(), GetProgram()->FileName(), false); // NOTE(rsipka): setPackage should be eliminated from here, and should be reconsider its usage from program GetProgram()->SetPackageName(GetProgram()->FileName()); - - return; + return nullptr; } Lexer()->NextToken(); @@ -2752,14 +2348,14 @@ void ETSParser::ParsePackageDeclaration(ArenaVector &statements packageDeclaration->SetRange({startLoc, Lexer()->GetToken().End()}); ConsumeSemicolon(packageDeclaration); - statements.push_back(packageDeclaration); auto packageName = name->IsIdentifier() ? name->AsIdentifier()->Name() : name->AsTSQualifiedName()->ToString(Allocator()); GetProgram()->SetPackageName(packageName); - pathHandler_->SetModuleName(GetProgram()->AbsoluteName(), packageName, true); + pathHandler_->SetModuleName(GetProgram()->AbsoluteName(), packageName, true); // NOTE: rid of it pathHandler_->SetModuleName(GetProgram()->ResolvedFilePath(), packageName, true); + return packageDeclaration; } ir::ImportSource *ETSParser::ParseSourceFromClause(bool requireFrom) @@ -2778,10 +2374,10 @@ ir::ImportSource *ETSParser::ParseSourceFromClause(bool requireFrom) ASSERT(Lexer()->GetToken().Type() == lexer::TokenType::LITERAL_STRING); auto importPath = Lexer()->GetToken().Ident(); - auto resolvedImportPath = pathHandler_->AddPath(GetProgram()->AbsoluteName(), Lexer()->GetToken().Ident()); + auto resolvedImportPath = pathHandler_->AddPath(GetProgram()->AbsoluteName(), importPath); auto *resolvedSource = AllocNode(resolvedImportPath); - auto importData = GetImportData(resolvedImportPath.Mutf8()); + auto importData = pathHandler_->GetImportData(resolvedImportPath, Extension()); auto *source = AllocNode(importPath); source->SetRange(Lexer()->GetToken().Loc()); @@ -2790,9 +2386,10 @@ ir::ImportSource *ETSParser::ParseSourceFromClause(bool requireFrom) return Allocator()->New(source, resolvedSource, importData.lang, importData.hasDecl); } -void ETSParser::ParseImportDeclarations(ArenaVector &statements) +ArenaVector ETSParser::ParseImportDeclarations() { - ArenaVector imports(Allocator()->Adapter()); + std::vector userPaths; + ArenaVector statements(Allocator()->Adapter()); while (Lexer()->GetToken().Type() == lexer::TokenType::KEYW_IMPORT) { auto startLoc = Lexer()->GetToken().Start(); @@ -2803,7 +2400,8 @@ void ETSParser::ParseImportDeclarations(ArenaVector &statements if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_MULTIPLY) { ParseNameSpaceSpecifier(&specifiers); } else if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_LEFT_BRACE) { - ParseNamedSpecifiers(&specifiers); + auto specs = ParseNamedSpecifiers(); + specifiers = util::Helpers::ConvertVector(specs); } else { ParseImportDefaultSpecifier(&specifiers); } @@ -2817,32 +2415,25 @@ void ETSParser::ParseImportDeclarations(ArenaVector &statements ConsumeSemicolon(importDeclaration); statements.push_back(importDeclaration); - imports.push_back(importDeclaration); } - sort(statements.begin(), statements.end(), [](ir::Statement const *s1, ir::Statement const *s2) -> bool { - return s1->IsETSImportDeclaration() && s2->IsETSImportDeclaration() && - s1->AsETSImportDeclaration()->Specifiers()[0]->IsImportNamespaceSpecifier() && - !s2->AsETSImportDeclaration()->Specifiers()[0]->IsImportNamespaceSpecifier(); + std::sort(statements.begin(), statements.end(), [](const auto *s1, const auto *s2) -> bool { + return s1->Specifiers()[0]->IsImportNamespaceSpecifier() && !s2->Specifiers()[0]->IsImportNamespaceSpecifier(); }); - if ((GetContext().Status() & ParserStatus::IN_DEFAULT_IMPORTS) != 0) { - static_cast(GetProgram()->VarBinder()) - ->SetDefaultImports(std::move(imports)); // get rid of it - } + return statements; } -void ETSParser::ParseNamedSpecifiers(ArenaVector *specifiers, bool isExport) +ArenaVector ETSParser::ParseNamedSpecifiers() { - lexer::SourcePosition startLoc = Lexer()->GetToken().Start(); // NOTE(user): handle qualifiedName in file bindings: qualifiedName '.' '*' - if (Lexer()->GetToken().Type() != lexer::TokenType::PUNCTUATOR_LEFT_BRACE) { + if (!Lexer()->TryEatTokenType(lexer::TokenType::PUNCTUATOR_LEFT_BRACE)) { ThrowExpectedToken(lexer::TokenType::PUNCTUATOR_LEFT_BRACE); } - Lexer()->NextToken(); // eat '{' auto fileName = GetProgram()->SourceFilePath().Mutf8(); - std::vector exportedIdents; + + ArenaVector result(Allocator()->Adapter()); while (Lexer()->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_BRACE) { if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_MULTIPLY) { @@ -2861,8 +2452,7 @@ void ETSParser::ParseNamedSpecifiers(ArenaVector *specifiers, boo Lexer()->NextToken(); // eat import/export name - if (CheckModuleAsModifier() && Lexer()->GetToken().Type() == lexer::TokenType::KEYW_AS) { - Lexer()->NextToken(); // eat `as` literal + if (CheckModuleAsModifier() && Lexer()->TryEatTokenType(lexer::TokenType::KEYW_AS)) { local = ParseNamedImport(Lexer()->GetToken()); Lexer()->NextToken(); // eat local name } else { @@ -2872,13 +2462,9 @@ void ETSParser::ParseNamedSpecifiers(ArenaVector *specifiers, boo auto *specifier = AllocNode(imported, local); specifier->SetRange({imported->Start(), local->End()}); - util::Helpers::CheckImportedName(specifiers, specifier, fileName); + util::Helpers::CheckImportedName(result, specifier, fileName); - if (isExport) { - util::StringView memberName = local->Name(); - exportedIdents.push_back(memberName); - } - specifiers->push_back(specifier); + result.emplace_back(specifier); if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_COMMA) { Lexer()->NextToken(lexer::NextTokenFlags::KEYWORD_TO_IDENT); // eat comma @@ -2887,12 +2473,7 @@ void ETSParser::ParseNamedSpecifiers(ArenaVector *specifiers, boo Lexer()->NextToken(); // eat '}' - if (isExport && Lexer()->GetToken().KeywordType() != lexer::TokenType::KEYW_FROM) { - // update exported idents to export name map when it is not the case of re-export - for (auto memberName : exportedIdents) { - exportNameMap_.insert({memberName, startLoc}); - } - } + return result; } void ETSParser::ParseNameSpaceSpecifier(ArenaVector *specifiers, bool isReExport) @@ -3093,9 +2674,7 @@ ir::Expression *ETSParser::ParseFunctionParameter() const bool isArrow = (GetContext().Status() & ParserStatus::ARROW_FUNCTION) != 0; - if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_COLON) { - Lexer()->NextToken(); // eat ':' - + if (Lexer()->TryEatTokenType(lexer::TokenType::PUNCTUATOR_COLON)) { TypeAnnotationParsingOptions options = TypeAnnotationParsingOptions::THROW_ERROR; ir::TypeNode *typeAnnotation = ParseTypeAnnotation(&options); @@ -4312,7 +3891,6 @@ bool ETSParser::ParsePotentialNonNullExpression(ir::Expression **expression, con const auto nonNullExpr = AllocNode(*expression); nonNullExpr->SetRange({startLoc, Lexer()->GetToken().End()}); - nonNullExpr->SetParent(*expression); *expression = nonNullExpr; @@ -4327,12 +3905,6 @@ bool ETSParser::IsStructKeyword() const Lexer()->GetToken().KeywordType() == lexer::TokenType::KEYW_STRUCT); } -bool ETSParser::IsTypeKeyword() const -{ - return (Lexer()->GetToken().Type() == lexer::TokenType::LITERAL_IDENT && - Lexer()->GetToken().KeywordType() == lexer::TokenType::KEYW_TYPE); -} - void ETSParser::ValidateInstanceOfExpression(ir::Expression *expr) { ValidateGroupedExpression(expr); @@ -4743,6 +4315,93 @@ ir::TypeNode *ETSParser::CreateTypeAnnotation(TypeAnnotationParsingOptions *opti return ParseTypeAnnotation(options); } +ir::FunctionDeclaration *ETSParser::ParseFunctionDeclaration(bool canBeAnonymous, ir::ModifierFlags modifiers) +{ + lexer::SourcePosition startLoc = Lexer()->GetToken().Start(); + + ASSERT(Lexer()->GetToken().Type() == lexer::TokenType::KEYW_FUNCTION); + Lexer()->NextToken(); + auto newStatus = ParserStatus::NEED_RETURN_TYPE | ParserStatus::ALLOW_SUPER; + + if ((modifiers & ir::ModifierFlags::ASYNC) != 0) { + newStatus |= ParserStatus::ASYNC_FUNCTION; + } + if (Lexer()->TryEatTokenType(lexer::TokenType::PUNCTUATOR_MULTIPLY)) { + newStatus |= ParserStatus::GENERATOR_FUNCTION; + } + + ir::Identifier *className = nullptr; + ir::Identifier *identNode = nullptr; + if (Lexer()->Lookahead() == lexer::LEX_CHAR_DOT) { + className = ExpectIdentifier(); + if (className != nullptr) { + newStatus |= ParserStatus::IN_EXTENSION_FUNCTION; + } + Lexer()->NextToken(); + identNode = ExpectIdentifier(); + } else if (Lexer()->GetToken().Type() == lexer::TokenType::LITERAL_IDENT) { + identNode = ExpectIdentifier(); + } else if (!canBeAnonymous) { + ThrowSyntaxError("Unexpected token, expected identifier after 'function' keyword"); + } + newStatus |= ParserStatus::FUNCTION_DECLARATION; + if (identNode != nullptr) { + CheckRestrictedBinding(identNode->Name(), identNode->Start()); + } + ir::ScriptFunction *func = ParseFunction(newStatus, className); + func->SetIdent(identNode); + auto *funcDecl = AllocNode(Allocator(), func); + if (func->IsOverload() && Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_SEMI_COLON) { + Lexer()->NextToken(); + } + funcDecl->SetRange(func->Range()); + func->AddModifier(modifiers); + func->SetStart(startLoc); + + if (className != nullptr) { + func->AddFlag(ir::ScriptFunctionFlags::INSTANCE_EXTENSION_METHOD); + } + + return funcDecl; +} + +std::pair ETSParser::ParseMemberModifiers() +{ + auto memberModifiers = ir::ModifierFlags::STATIC | ir::ModifierFlags::PUBLIC; + + if (Lexer()->TryEatTokenType(lexer::TokenType::KEYW_EXPORT)) { + if (Lexer()->TryEatTokenKeyword(lexer::TokenType::KEYW_DEFAULT)) { + memberModifiers |= ir::ModifierFlags::DEFAULT_EXPORT; + } else { + memberModifiers |= ir::ModifierFlags::EXPORT; + } + } + + lexer::SourcePosition startLoc = Lexer()->GetToken().Start(); + + if (Lexer()->GetToken().KeywordType() == lexer::TokenType::KEYW_DECLARE) { + CheckDeclare(); + memberModifiers |= ir::ModifierFlags::DECLARE; + } + const auto tokenType = Lexer()->GetToken().KeywordType(); + if (tokenType == lexer::TokenType::KEYW_ASYNC || tokenType == lexer::TokenType::KEYW_NATIVE) { + bool isAsync = tokenType == lexer::TokenType::KEYW_ASYNC; + + if (isAsync) { + memberModifiers |= ir::ModifierFlags::ASYNC; + } else { + memberModifiers |= ir::ModifierFlags::NATIVE; + } + Lexer()->NextToken(); + + if (Lexer()->GetToken().Type() != lexer::TokenType::KEYW_FUNCTION) { + ThrowSyntaxError( + {isAsync ? "'async'" : "'native'", " flags must be used for functions only at top-level."}); + } + } + return std::make_pair(memberModifiers, startLoc); +} + //================================================================================================// // ExternalSourceParser class //================================================================================================// diff --git a/ets2panda/parser/ETSparser.h b/ets2panda/parser/ETSparser.h index 17d2788b0b..24ec0b5c05 100644 --- a/ets2panda/parser/ETSparser.h +++ b/ets2panda/parser/ETSparser.h @@ -66,9 +66,6 @@ public: } // Methods to create AST node(s) from the specified string (part of valid ETS-code!) - // NOTE: the correct initial scope should be entered BEFORE calling any of these methods, - // and correct parent and, probably, variable set to the node(s) after obtaining - ir::Expression *CreateExpression(std::string_view sourceCode, ExpressionParseFlags flags = ExpressionParseFlags::NO_OPTS, std::string_view fileName = DEFAULT_SOURCE_FILE); @@ -112,56 +109,37 @@ public: return CreateFormattedStatements(sourceCode, insertingNodes, fileName); } + ArenaVector ParseDefaultSources(std::string_view srcFile, std::string_view importSrc, + const std::vector &paths); + private: - struct ImportData { - Language lang; - std::string module; - bool hasDecl; - }; - - std::map fieldMap_; - std::map exportNameMap_; void ParseProgram(ScriptKind kind) override; [[nodiscard]] std::unique_ptr InitLexer(const SourceFile &sourceFile) override; - void ParsePackageDeclaration(ArenaVector &statements); - ArenaVector ParseTopLevelStatements(ArenaVector &statements); - void ParseTopLevelType(ArenaVector &statements, bool &defaultExport, std::size_t currentPos, - std::function const &parserFunction); - void ParseTopLevelNextToken(ArenaVector &statements, ArenaVector &globalProperties, - ir::ScriptFunction *initFunction); - void ParseTopLevelNextTokenDefault(ArenaVector &statements, ir::ScriptFunction *initFunction, - size_t currentPos, lexer::TokenType tokenType, bool defaultExport); - ir::ModifierFlags ResolveMemberModifiers(); - lexer::SourcePosition ParseTopLevelNextTokenResolution(ArenaVector &statements, - ArenaVector &globalProperties, - ir::ScriptFunction *initFunction, size_t currentPos, - bool defaultExport); - void ParseTokenOfNative(ark::es2panda::lexer::TokenType tokenType, ir::ModifierFlags &memberModifiers); - void ParseTokenOfFunction(ir::ModifierFlags memberModifiers, lexer::SourcePosition startLoc, - ArenaVector &globalProperties); + ir::ETSPackageDeclaration *ParsePackageDeclaration(); + ArenaVector ParseTopLevelStatements(); + #ifdef USE_FTW static int NFTWCallBack(const char *fpath, const struct stat * /*unused*/, int tflag, struct FTW * /*unused*/); #endif - void ParseTopLevelDeclaration(ArenaVector &statements); - ImportData GetImportData(const std::string &path); - void ParseSources(bool isExternal = true); ir::ImportSource *ParseSourceFromClause(bool requireFrom); - void ParseNamedSpecifiers(ArenaVector *specifiers, bool isExport = false); void ParseNamedExportSpecifiers(ArenaVector *specifiers, bool defaultExport); void ParseUserSources(std::vector userParths); - void ParseImportDeclarations(ArenaVector &statements); - void ParseDefaultSources(); - void ParseSource(const SourceFile &sourceFile); - void CreateGlobalClass(); - ArenaVector PrepareGlobalClass(); - ArenaVector PrepareExternalGlobalClass(const SourceFile &sourceFile); - void ParseETSGlobalScript(lexer::SourcePosition startLoc, ArenaVector &statements); + ArenaVector ParseTopLevelDeclaration(); + std::tuple, bool> CollectUserSources(const std::string &path); + std::vector ParseSources(const ArenaVector &paths); + std::tuple> ParseFromClause(bool requireFrom); + ArenaVector ParseNamedSpecifiers(); + ArenaVector ParseImportDeclarations(); + parser::Program *ParseSource(const SourceFile &sourceFile); + void AddExternalSource(const std::vector &programs); + ir::ETSScript *ParseETSGlobalScript(lexer::SourcePosition startLoc, ArenaVector &statements); ir::AstNode *ParseImportDefaultSpecifier(ArenaVector *specifiers) override; ir::MethodDefinition *ParseClassGetterSetterMethod(const ArenaVector &properties, ir::ClassDefinitionModifiers modifiers, ir::ModifierFlags memberModifiers); ir::MethodDefinition *ParseInterfaceGetterSetterMethod(ir::ModifierFlags modifiers); + ir::Statement *ParseIdentKeyword(); ir::Statement *ParseTypeDeclaration(bool allowStatic = false); ir::Statement *ParseTypeDeclarationAbstractFinal(bool allowStatic, ir::ClassDefinitionModifiers modifiers); ir::ModifierFlags ParseClassModifiers(); @@ -187,11 +165,7 @@ private: ir::MethodDefinitionKind methodKind); // NOLINTNEXTLINE(google-default-arguments) void ParseClassFieldDefinition(ir::Identifier *fieldName, ir::ModifierFlags modifiers, - ArenaVector *declarations, ir::ScriptFunction *initFunction = nullptr, - lexer::SourcePosition *letLoc = nullptr); - lexer::SourcePosition InitializeGlobalVariable(ir::Identifier *fieldName, ir::Expression *&initializer, - ir::ScriptFunction *initFunction, lexer::SourcePosition &startLoc, - ir::TypeNode *typeAnnotation); + ArenaVector *declarations, lexer::SourcePosition *letLoc = nullptr); std::tuple ParseTypeReferencePart( TypeAnnotationParsingOptions *options); ir::TypeNode *ParseTypeReference(TypeAnnotationParsingOptions *options); @@ -227,7 +201,7 @@ private: ExpressionParseFlags flags = ExpressionParseFlags::NO_OPTS) override; ir::Statement *ParseTryStatement() override; ir::DebuggerStatement *ParseDebuggerStatement() override; - void ParseExport(lexer::SourcePosition startLoc); + ir::Statement *ParseExport(lexer::SourcePosition startLoc, ir::ModifierFlags modifiers); ir::Statement *ParseImportDeclaration(StatementParsingFlags flags) override; ir::Statement *ParseExportDeclaration(StatementParsingFlags flags) override; ir::AnnotatedExpression *ParseVariableDeclaratorKey(VariableParsingFlags flags) override; @@ -240,6 +214,8 @@ private: bool CheckModuleAsModifier(); ir::Expression *ParseFunctionParameterExpression(ir::AnnotatedExpression *paramIdent, ir::ETSUndefinedType *defaultUndef); + std::pair TypeAnnotationValue(ir::TypeNode *typeAnnotation); + ir::ETSParameterExpression *ParseFunctionParameterTail(ir::AnnotatedExpression *paramIdent, bool defaultUndefined); ir::Expression *ParseFunctionParameter() override; ir::AnnotatedExpression *GetAnnotatedExpressionFromParam(); ir::ETSUnionType *CreateOptionalParameterTypeNode(ir::TypeNode *typeAnnotation, ir::ETSUndefinedType *defaultUndef); @@ -304,6 +280,7 @@ private: ir::ThisExpression *ParseThisExpression() override; ir::TypeNode *ParseThisType(TypeAnnotationParsingOptions *options); ir::Statement *ParseFunctionStatement(StatementParsingFlags flags) override; + ir::FunctionDeclaration *ParseFunctionDeclaration(bool canBeAnonymous, ir::ModifierFlags modifiers); std::tuple ParseClassImplementsElement() override; ir::TypeNode *ParseInterfaceExtendsElement() override; // NOLINTNEXTLINE(google-default-arguments) @@ -318,17 +295,14 @@ private: bool CheckClassElement(ir::AstNode *property, ir::MethodDefinition *&ctor, ArenaVector &properties) override; - // NOLINTNEXTLINE(google-default-arguments) - void CreateCCtor(ArenaVector &properties, const lexer::SourcePosition &loc, - bool inGlobalClass = false) override; void CreateImplicitConstructor(ir::MethodDefinition *&ctor, ArenaVector &properties, ir::ClassDefinitionModifiers modifiers, const lexer::SourcePosition &startLoc) override; bool ParsePotentialGenericFunctionCall(ir::Expression *primaryExpr, ir::Expression **returnExpression, const lexer::SourcePosition &startLoc, bool ignoreCallExpression) override; bool ParsePotentialNonNullExpression(ir::Expression **expression, lexer::SourcePosition startLoc) override; - void MarkNodeAsExported(ir::AstNode *node, lexer::SourcePosition startPos, bool defaultExport, - std::size_t numOfElements = 1); + + std::pair ParseMemberModifiers(); std::shared_ptr ArkTSConfig() const { @@ -341,7 +315,11 @@ private: } bool IsStructKeyword() const; - bool IsTypeKeyword() const; + + bool IsExternal() const override + { + return pathHandler_->IsStdLib(GetProgram()); + } // NOLINTNEXTLINE(google-default-arguments) ir::Expression *ParseExpression(ExpressionParseFlags flags = ExpressionParseFlags::NO_OPTS) override; @@ -350,16 +328,15 @@ private: ir::ModifierFlags ParseTypeVarianceModifier(TypeAnnotationParsingOptions *const options); - ir::ScriptFunction *AddInitMethod(ArenaVector &globalProperties); - ir::Statement *ParseTopLevelStatement(StatementParsingFlags flags = StatementParsingFlags::NONE); + ir::Statement *ParseTopLevelDeclStatement(StatementParsingFlags flags); + ir::Statement *ParseTopLevelStatement(); void ParseTrailingBlock([[maybe_unused]] ir::CallExpression *callExpr) override; void CheckDeclare(); // Methods to create AST node(s) from the specified string (part of valid ETS-code!) - // NOTE: the correct initial scope should be entered BEFORE calling any of these methods, - // and correct parent and, probably, variable set to the node(s) after obtaining + // NOTE: ScopeInitPhase, SetParent should be called on created subtree after calling any of these methods, // NOLINTBEGIN(modernize-avoid-c-arrays) inline static constexpr char const DEFAULT_SOURCE_FILE[] = ".ets"; // NOLINTEND(modernize-avoid-c-arrays) diff --git a/ets2panda/parser/TypedParser.cpp b/ets2panda/parser/TypedParser.cpp index 69e07aa60d..28c41b96c3 100644 --- a/ets2panda/parser/TypedParser.cpp +++ b/ets2panda/parser/TypedParser.cpp @@ -460,7 +460,7 @@ ir::Statement *TypedParser::ParseInterfaceDeclaration(bool isStatic) auto *body = AllocNode(std::move(members)); body->SetRange({bodyStart, Lexer()->GetToken().End()}); - const auto isExternal = (GetContext().Status() & ParserStatus::IN_EXTERNAL); + const auto isExternal = IsExternal(); auto *interfaceDecl = AllocNode( Allocator(), id, typeParamDecl, body, std::move(extends), isStatic, isExternal, GetContext().GetLanguage()); interfaceDecl->SetRange({interfaceStart, Lexer()->GetToken().End()}); diff --git a/ets2panda/parser/TypedParser.h b/ets2panda/parser/TypedParser.h index b2e1067f2e..30871a0f8b 100644 --- a/ets2panda/parser/TypedParser.h +++ b/ets2panda/parser/TypedParser.h @@ -144,13 +144,6 @@ protected: { return false; } - - // NOLINTNEXTLINE(google-default-arguments) - virtual void CreateCCtor([[maybe_unused]] ArenaVector &properties, - [[maybe_unused]] const lexer::SourcePosition &loc, - [[maybe_unused]] bool inGlobalClass = false) - { - } }; } // namespace ark::es2panda::parser diff --git a/ets2panda/parser/context/parserContext.h b/ets2panda/parser/context/parserContext.h index 7567b07a38..aa504ef32a 100644 --- a/ets2panda/parser/context/parserContext.h +++ b/ets2panda/parser/context/parserContext.h @@ -60,8 +60,6 @@ enum class ParserStatus : uint64_t { IN_CLASS_BODY = 1U << 25U, NEED_RETURN_TYPE = 1U << 26U, - IN_EXTERNAL = 1U << 27U, - IN_IMPORT = 1U << 28U, IN_DEFAULT_IMPORTS = 1U << 29U, IN_EXTENSION_FUNCTION = 1U << 30U, FUNCTION_HAS_RETURN_STATEMENT = 1U << 31U, diff --git a/ets2panda/parser/expressionParser.cpp b/ets2panda/parser/expressionParser.cpp index 522caefe83..3915d74e21 100644 --- a/ets2panda/parser/expressionParser.cpp +++ b/ets2panda/parser/expressionParser.cpp @@ -1239,6 +1239,7 @@ void ParserImpl::CreateAmendedBinaryExpression(ir::Expression *const left, ir::E { auto *amended = GetAmendedChildExpression(right); + amended->SetParent(nullptr); // Next line overwrite parent auto *binaryExpr = AllocNode(left, amended, operatorType); binaryExpr->SetRange({left->Start(), amended->End()}); diff --git a/ets2panda/parser/parserImpl.cpp b/ets2panda/parser/parserImpl.cpp index 3434621f8c..3e147ba831 100644 --- a/ets2panda/parser/parserImpl.cpp +++ b/ets2panda/parser/parserImpl.cpp @@ -87,7 +87,6 @@ void ParserImpl::ParseProgram(ScriptKind kind) lexer::SourcePosition startLoc = lexer_->GetToken().Start(); lexer_->NextToken(); program_->SetKind(kind); - program_->VarBinder()->InitTopScope(); auto statements = ParseStatementList(StatementParsingFlags::STMT_GLOBAL_LEXICAL); @@ -950,13 +949,13 @@ ir::SpreadElement *ParserImpl::ParseSpreadElement(ExpressionParseFlags flags) return spreadElementNode; } -void ParserImpl::CheckRestrictedBinding() +void ParserImpl::CheckRestrictedBinding() const { ASSERT(lexer_->GetToken().Type() == lexer::TokenType::LITERAL_IDENT); CheckRestrictedBinding(lexer_->GetToken().KeywordType()); } -void ParserImpl::CheckRestrictedBinding(lexer::TokenType keywordType) +void ParserImpl::CheckRestrictedBinding(lexer::TokenType keywordType) const { if (keywordType == lexer::TokenType::KEYW_ARGUMENTS || keywordType == lexer::TokenType::KEYW_EVAL) { ThrowSyntaxError( @@ -966,7 +965,7 @@ void ParserImpl::CheckRestrictedBinding(lexer::TokenType keywordType) } } -void ParserImpl::CheckRestrictedBinding(const util::StringView &ident, const lexer::SourcePosition &pos) +void ParserImpl::CheckRestrictedBinding(const util::StringView &ident, const lexer::SourcePosition &pos) const { if (ident.Is("eval") || ident.Is("arguments")) { ThrowSyntaxError( diff --git a/ets2panda/parser/parserImpl.h b/ets2panda/parser/parserImpl.h index 2bcd65d7b5..9bcae1e84b 100644 --- a/ets2panda/parser/parserImpl.h +++ b/ets2panda/parser/parserImpl.h @@ -30,6 +30,7 @@ #include "parser/program/program.h" #include "util/enumbitops.h" #include "util/ustring.h" +#include "util/helpers.h" #include #include @@ -199,6 +200,8 @@ public: return reinterpret_cast(this); } + [[noreturn]] void ThrowSyntaxError(std::string_view errorMessage, const lexer::SourcePosition &pos) const; + protected: virtual void ParseProgram(ScriptKind kind); static ExpressionParseFlags CarryExpressionParserFlag(ExpressionParseFlags origin, ExpressionParseFlags carry); @@ -278,25 +281,14 @@ protected: [[noreturn]] void ThrowSyntaxError(std::initializer_list list, const lexer::SourcePosition &pos) const; - [[noreturn]] void ThrowSyntaxError(std::string_view errorMessage, const lexer::SourcePosition &pos) const; - template - T *AllocNodeNoSetParent(Args &&...args) + T *AllocNode(Args &&...args) { - auto *ret = program_->Allocator()->New(std::forward(args)...); + auto *ret = util::NodeAllocator::ForceSetParent( + Allocator(), std::forward(args)...); // Note: replace with AllocNode if (ret == nullptr) { ThrowAllocationError("Unsuccessful allocation during parsing"); } - - return ret; - } - - template - T *AllocNode(Args &&...args) - { - auto *ret = AllocNodeNoSetParent(std::forward(args)...); - ret->Iterate([ret](auto *child) { child->SetParent(ret); }); - return ret; } @@ -307,6 +299,12 @@ protected: bool CheckModuleAsModifier(); + // ETS extension + virtual bool IsExternal() const + { + return false; + } + ir::Identifier *ExpectIdentifier(bool isReference = false, bool isUserDefinedType = false); void ExpectToken(lexer::TokenType tokenType, bool consumeToken = true); @@ -400,9 +398,9 @@ protected: ir::ExportNamedDeclaration *ParseExportNamedSpecifiers(const lexer::SourcePosition &startLoc); ir::Statement *ParseVariableDeclaration(VariableParsingFlags flags = VariableParsingFlags::NO_OPTS); void ValidateDeclaratorId(); - void CheckRestrictedBinding(); - void CheckRestrictedBinding(lexer::TokenType keywordType); - void CheckRestrictedBinding(const util::StringView &ident, const lexer::SourcePosition &pos); + void CheckRestrictedBinding() const; + void CheckRestrictedBinding(lexer::TokenType keywordType) const; + void CheckRestrictedBinding(const util::StringView &ident, const lexer::SourcePosition &pos) const; ir::VariableDeclarator *ParseVariableDeclarator(VariableParsingFlags flags); ir::FunctionDeclaration *ParseFunctionDeclaration(bool canBeAnonymous = false, diff --git a/ets2panda/parser/program/program.cpp b/ets2panda/parser/program/program.cpp index 62b7674c5a..e9bdfa0932 100644 --- a/ets2panda/parser/program/program.cpp +++ b/ets2panda/parser/program/program.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 - 2024 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 @@ -35,18 +35,6 @@ void Program::DumpSilent() const ASSERT(!dumper.Str().empty()); } -util::StringView Program::PackageClassName(util::StringView className) -{ - if (packageName_.Empty()) { - return className; - } - - util::UString name(packageName_, allocator_); - name.Append('.'); - name.Append(className); - return name.View(); -} - varbinder::ClassScope *Program::GlobalClassScope() { return globalClass_->Scope()->AsClassScope(); diff --git a/ets2panda/parser/program/program.h b/ets2panda/parser/program/program.h index c2cc7dbe5e..47165c5ae6 100644 --- a/ets2panda/parser/program/program.h +++ b/ets2panda/parser/program/program.h @@ -206,8 +206,6 @@ public: varbinder::GlobalScope *GlobalScope(); const varbinder::GlobalScope *GlobalScope() const; - util::StringView PackageClassName(util::StringView className); - std::string Dump() const; void DumpSilent() const; diff --git a/ets2panda/parser/statementParser.cpp b/ets2panda/parser/statementParser.cpp index 99e669f255..34c53cd0af 100644 --- a/ets2panda/parser/statementParser.cpp +++ b/ets2panda/parser/statementParser.cpp @@ -268,7 +268,7 @@ ir::ETSStructDeclaration *ParserImpl::ParseStructDeclaration(ir::ClassDefinition { const lexer::SourcePosition startLoc = lexer_->GetToken().Start(); modifiers |= ir::ClassDefinitionModifiers::DECLARATION; - if ((GetContext().Status() & ParserStatus::IN_EXTERNAL) != 0) { + if (IsExternal()) { modifiers |= ir::ClassDefinitionModifiers::FROM_EXTERNAL; } @@ -292,7 +292,7 @@ ir::ClassDeclaration *ParserImpl::ParseClassDeclaration(ir::ClassDefinitionModif { const lexer::SourcePosition startLoc = lexer_->GetToken().Start(); modifiers |= ir::ClassDefinitionModifiers::DECLARATION; - if ((GetContext().Status() & ParserStatus::IN_EXTERNAL) != 0) { + if (IsExternal()) { modifiers |= ir::ClassDefinitionModifiers::FROM_EXTERNAL; } diff --git a/ets2panda/test/compiler/ets/FunctionType1-expected.txt b/ets2panda/test/compiler/ets/FunctionType1-expected.txt index a62c8dd85d..4a33f8aaf0 100644 --- a/ets2panda/test/compiler/ets/FunctionType1-expected.txt +++ b/ets2panda/test/compiler/ets/FunctionType1-expected.txt @@ -599,7 +599,7 @@ }, "end": { "line": 16, - "column": 35 + "column": 9 } } }, diff --git a/ets2panda/test/compiler/ets/FunctionType2-expected.txt b/ets2panda/test/compiler/ets/FunctionType2-expected.txt index 1dcaa7ce18..bc1ed8f6d6 100644 --- a/ets2panda/test/compiler/ets/FunctionType2-expected.txt +++ b/ets2panda/test/compiler/ets/FunctionType2-expected.txt @@ -258,7 +258,7 @@ }, "end": { "line": 16, - "column": 37 + "column": 9 } } }, diff --git a/ets2panda/test/compiler/ets/FunctionType3-expected.txt b/ets2panda/test/compiler/ets/FunctionType3-expected.txt index 0d0d88e229..a88187d5c9 100644 --- a/ets2panda/test/compiler/ets/FunctionType3-expected.txt +++ b/ets2panda/test/compiler/ets/FunctionType3-expected.txt @@ -286,7 +286,7 @@ }, "end": { "line": 16, - "column": 36 + "column": 9 } } }, diff --git a/ets2panda/test/compiler/ets/FunctionType4-expected.txt b/ets2panda/test/compiler/ets/FunctionType4-expected.txt index 8927a88069..13c0c3fbd0 100644 --- a/ets2panda/test/compiler/ets/FunctionType4-expected.txt +++ b/ets2panda/test/compiler/ets/FunctionType4-expected.txt @@ -119,11 +119,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 25 + "column": 24 } } } @@ -505,7 +505,7 @@ "loc": { "start": { "line": 22, - "column": 14 + "column": 13 }, "end": { "line": 24, @@ -516,7 +516,7 @@ "loc": { "start": { "line": 22, - "column": 14 + "column": 13 }, "end": { "line": 24, diff --git a/ets2panda/test/compiler/ets/FunctionType5-expected.txt b/ets2panda/test/compiler/ets/FunctionType5-expected.txt index c6c23c17de..1a02058a93 100644 --- a/ets2panda/test/compiler/ets/FunctionType5-expected.txt +++ b/ets2panda/test/compiler/ets/FunctionType5-expected.txt @@ -119,11 +119,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 14 + "column": 13 } } } diff --git a/ets2panda/test/compiler/ets/array_indexing_with_chaining_non_nullish-expected.txt b/ets2panda/test/compiler/ets/array_indexing_with_chaining_non_nullish-expected.txt index ad85786f3f..f1f7c1a008 100644 --- a/ets2panda/test/compiler/ets/array_indexing_with_chaining_non_nullish-expected.txt +++ b/ets2panda/test/compiler/ets/array_indexing_with_chaining_non_nullish-expected.txt @@ -366,11 +366,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 46 + "column": 45 } } }, @@ -622,11 +622,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 42 + "column": 41 } } } @@ -763,7 +763,7 @@ }, "end": { "line": 18, - "column": 21 + "column": 45 } } }, @@ -868,7 +868,7 @@ }, "end": { "line": 19, - "column": 30 + "column": 41 } } } diff --git a/ets2panda/test/compiler/ets/array_indexing_with_chaining_nullish-expected.txt b/ets2panda/test/compiler/ets/array_indexing_with_chaining_nullish-expected.txt index 8c0f16fc92..22716174bf 100644 --- a/ets2panda/test/compiler/ets/array_indexing_with_chaining_nullish-expected.txt +++ b/ets2panda/test/compiler/ets/array_indexing_with_chaining_nullish-expected.txt @@ -366,11 +366,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 53 + "column": 52 } } }, @@ -622,11 +622,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 42 + "column": 41 } } } @@ -791,7 +791,7 @@ }, "end": { "line": 18, - "column": 26 + "column": 52 } } }, @@ -896,7 +896,7 @@ }, "end": { "line": 19, - "column": 30 + "column": 41 } } } diff --git a/ets2panda/test/compiler/ets/array_indexing_without_chaining_non_nullish-expected.txt b/ets2panda/test/compiler/ets/array_indexing_without_chaining_non_nullish-expected.txt index f66a8a148e..e3d9e2b92f 100644 --- a/ets2panda/test/compiler/ets/array_indexing_without_chaining_non_nullish-expected.txt +++ b/ets2panda/test/compiler/ets/array_indexing_without_chaining_non_nullish-expected.txt @@ -366,11 +366,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 46 + "column": 45 } } }, @@ -452,11 +452,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 28 + "column": 27 } } } @@ -593,7 +593,7 @@ }, "end": { "line": 18, - "column": 21 + "column": 45 } } }, @@ -670,7 +670,7 @@ }, "end": { "line": 19, - "column": 20 + "column": 27 } } } diff --git a/ets2panda/test/compiler/ets/array_indexing_without_chaining_nullish-expected.txt b/ets2panda/test/compiler/ets/array_indexing_without_chaining_nullish-expected.txt index 411717b927..4331d93569 100644 --- a/ets2panda/test/compiler/ets/array_indexing_without_chaining_nullish-expected.txt +++ b/ets2panda/test/compiler/ets/array_indexing_without_chaining_nullish-expected.txt @@ -366,11 +366,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 53 + "column": 52 } } }, @@ -452,11 +452,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 40 + "column": 39 } } } @@ -621,7 +621,7 @@ }, "end": { "line": 18, - "column": 26 + "column": 52 } } }, @@ -726,7 +726,7 @@ }, "end": { "line": 19, - "column": 30 + "column": 39 } } } diff --git a/ets2panda/test/compiler/ets/etsObjectToString4-expected.txt b/ets2panda/test/compiler/ets/etsObjectToString4-expected.txt index 88b19e6307..11ecf78934 100644 --- a/ets2panda/test/compiler/ets/etsObjectToString4-expected.txt +++ b/ets2panda/test/compiler/ets/etsObjectToString4-expected.txt @@ -298,11 +298,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 31 + "column": 30 } } } diff --git a/ets2panda/test/compiler/ets/identifierReference2-expected.txt b/ets2panda/test/compiler/ets/identifierReference2-expected.txt index 100cdc5d9d..7136118c6d 100644 --- a/ets2panda/test/compiler/ets/identifierReference2-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference2-expected.txt @@ -119,11 +119,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 38 + "column": 37 } } } diff --git a/ets2panda/test/compiler/ets/identifierReference3-expected.txt b/ets2panda/test/compiler/ets/identifierReference3-expected.txt index f5c375d18a..a3d2d178bc 100644 --- a/ets2panda/test/compiler/ets/identifierReference3-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference3-expected.txt @@ -447,11 +447,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 16 + "column": 15 } } } @@ -547,7 +547,7 @@ }, "end": { "line": 16, - "column": 11 + "column": 15 } } } diff --git a/ets2panda/test/compiler/ets/identifierReference4-expected.txt b/ets2panda/test/compiler/ets/identifierReference4-expected.txt index beb0f9de57..a1c5b3b57d 100644 --- a/ets2panda/test/compiler/ets/identifierReference4-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference4-expected.txt @@ -701,11 +701,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 17 + "column": 16 } } } @@ -801,7 +801,7 @@ }, "end": { "line": 16, - "column": 11 + "column": 16 } } } diff --git a/ets2panda/test/compiler/ets/inferTypeOfArray-expected.txt b/ets2panda/test/compiler/ets/inferTypeOfArray-expected.txt index ed3c6dd87d..bd192ee2e3 100644 --- a/ets2panda/test/compiler/ets/inferTypeOfArray-expected.txt +++ b/ets2panda/test/compiler/ets/inferTypeOfArray-expected.txt @@ -118,7 +118,7 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, @@ -174,7 +174,7 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, @@ -245,7 +245,7 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, @@ -344,7 +344,7 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, @@ -513,7 +513,7 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, @@ -569,7 +569,7 @@ "loc": { "start": { "line": 21, - "column": 1 + "column": 5 }, "end": { "line": 21, @@ -683,7 +683,7 @@ "loc": { "start": { "line": 22, - "column": 1 + "column": 5 }, "end": { "line": 22, diff --git a/ets2panda/test/compiler/ets/inferTypeOfArrayNegative1-expected.txt b/ets2panda/test/compiler/ets/inferTypeOfArrayNegative1-expected.txt index 8f6bb0ae1d..7d12e35a6e 100644 --- a/ets2panda/test/compiler/ets/inferTypeOfArrayNegative1-expected.txt +++ b/ets2panda/test/compiler/ets/inferTypeOfArrayNegative1-expected.txt @@ -161,7 +161,7 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, diff --git a/ets2panda/test/compiler/ets/inferTypeOfArrayNegative2-expected.txt b/ets2panda/test/compiler/ets/inferTypeOfArrayNegative2-expected.txt index be6fbf6957..35a019dc88 100644 --- a/ets2panda/test/compiler/ets/inferTypeOfArrayNegative2-expected.txt +++ b/ets2panda/test/compiler/ets/inferTypeOfArrayNegative2-expected.txt @@ -118,7 +118,7 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, @@ -432,7 +432,7 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, diff --git a/ets2panda/test/compiler/ets/inferTypeOfArrayNegative3-expected.txt b/ets2panda/test/compiler/ets/inferTypeOfArrayNegative3-expected.txt index 50c685879a..054d89e7f5 100644 --- a/ets2panda/test/compiler/ets/inferTypeOfArrayNegative3-expected.txt +++ b/ets2panda/test/compiler/ets/inferTypeOfArrayNegative3-expected.txt @@ -161,7 +161,7 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, diff --git a/ets2panda/test/compiler/ets/lambdaFunction1-expected.txt b/ets2panda/test/compiler/ets/lambdaFunction1-expected.txt index 132a58cca8..61642d4c3b 100644 --- a/ets2panda/test/compiler/ets/lambdaFunction1-expected.txt +++ b/ets2panda/test/compiler/ets/lambdaFunction1-expected.txt @@ -795,11 +795,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 16 + "column": 15 } } } @@ -895,7 +895,7 @@ }, "end": { "line": 16, - "column": 11 + "column": 15 } } }, diff --git a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_cast_infer_type_void-expected.txt b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_cast_infer_type_void-expected.txt index 66623064bb..0c0b964786 100644 --- a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_cast_infer_type_void-expected.txt +++ b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_cast_infer_type_void-expected.txt @@ -450,7 +450,7 @@ "loc": { "start": { "line": 16, - "column": 15 + "column": 14 }, "end": { "line": 19, @@ -461,7 +461,7 @@ "loc": { "start": { "line": 16, - "column": 15 + "column": 14 }, "end": { "line": 19, diff --git a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_cast_type_has_pramas-expected.txt b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_cast_type_has_pramas-expected.txt index 0d17b84dd6..27ff957b76 100644 --- a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_cast_type_has_pramas-expected.txt +++ b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_cast_type_has_pramas-expected.txt @@ -688,7 +688,7 @@ "loc": { "start": { "line": 16, - "column": 15 + "column": 14 }, "end": { "line": 19, @@ -699,7 +699,7 @@ "loc": { "start": { "line": 16, - "column": 15 + "column": 14 }, "end": { "line": 19, diff --git a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_retrun_enum-expected.txt b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_retrun_enum-expected.txt index ae8e7882a3..18ef5aa299 100644 --- a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_retrun_enum-expected.txt +++ b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_retrun_enum-expected.txt @@ -656,7 +656,7 @@ "loc": { "start": { "line": 17, - "column": 15 + "column": 14 }, "end": { "line": 23, @@ -667,7 +667,7 @@ "loc": { "start": { "line": 17, - "column": 15 + "column": 14 }, "end": { "line": 23, diff --git a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_array-expected.txt b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_array-expected.txt index a333dff5f0..a3aa7c7921 100644 --- a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_array-expected.txt +++ b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_array-expected.txt @@ -579,7 +579,7 @@ "loc": { "start": { "line": 16, - "column": 15 + "column": 14 }, "end": { "line": 20, @@ -590,7 +590,7 @@ "loc": { "start": { "line": 16, - "column": 15 + "column": 14 }, "end": { "line": 20, diff --git a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_lambda_expression-expected.txt b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_lambda_expression-expected.txt index 2237eae3ae..fea46aa2f9 100644 --- a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_lambda_expression-expected.txt +++ b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_lambda_expression-expected.txt @@ -134,7 +134,7 @@ "loc": { "start": { "line": 23, - "column": 1 + "column": 5 }, "end": { "line": 23, @@ -369,7 +369,7 @@ "loc": { "start": { "line": 16, - "column": 16 + "column": 15 }, "end": { "line": 22, @@ -380,7 +380,7 @@ "loc": { "start": { "line": 16, - "column": 16 + "column": 15 }, "end": { "line": 22, diff --git a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_literal-expected.txt b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_literal-expected.txt index 84d4b48482..904969d645 100644 --- a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_literal-expected.txt +++ b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_literal-expected.txt @@ -410,7 +410,7 @@ "loc": { "start": { "line": 16, - "column": 15 + "column": 14 }, "end": { "line": 21, @@ -421,7 +421,7 @@ "loc": { "start": { "line": 16, - "column": 15 + "column": 14 }, "end": { "line": 21, diff --git a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_union-expected.txt b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_union-expected.txt index 191ba526c8..0a5f2826a7 100644 --- a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_union-expected.txt +++ b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_union-expected.txt @@ -622,7 +622,7 @@ "loc": { "start": { "line": 16, - "column": 15 + "column": 14 }, "end": { "line": 22, @@ -633,7 +633,7 @@ "loc": { "start": { "line": 16, - "column": 15 + "column": 14 }, "end": { "line": 22, diff --git a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_scope-expected.txt b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_scope-expected.txt index 1034ff0fdf..a5cc56b6ac 100644 --- a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_scope-expected.txt +++ b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_scope-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 11 + "column": 10 } } } @@ -554,7 +554,7 @@ "loc": { "start": { "line": 18, - "column": 15 + "column": 14 }, "end": { "line": 20, @@ -565,7 +565,7 @@ "loc": { "start": { "line": 18, - "column": 15 + "column": 14 }, "end": { "line": 20, diff --git a/ets2panda/test/compiler/ets/launch_expression-expected.txt b/ets2panda/test/compiler/ets/launch_expression-expected.txt index 8ff5489b25..cd6f543d26 100644 --- a/ets2panda/test/compiler/ets/launch_expression-expected.txt +++ b/ets2panda/test/compiler/ets/launch_expression-expected.txt @@ -271,7 +271,7 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, @@ -327,7 +327,7 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, @@ -410,11 +410,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 31 + "column": 30 } } }, @@ -493,11 +493,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 31 + "column": 30 } } } @@ -706,7 +706,7 @@ }, "end": { "line": 18, - "column": 15 + "column": 30 } } }, @@ -768,7 +768,7 @@ }, "end": { "line": 19, - "column": 15 + "column": 30 } } }, diff --git a/ets2panda/test/compiler/ets/objectLiteralAbstract-expected.txt b/ets2panda/test/compiler/ets/objectLiteralAbstract-expected.txt index e4799e206c..5db12240c7 100644 --- a/ets2panda/test/compiler/ets/objectLiteralAbstract-expected.txt +++ b/ets2panda/test/compiler/ets/objectLiteralAbstract-expected.txt @@ -255,11 +255,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 15 + "column": 14 } } } @@ -383,7 +383,7 @@ }, "end": { "line": 18, - "column": 11 + "column": 14 } } } diff --git a/ets2panda/test/compiler/ets/objectLiteralBadKey-expected.txt b/ets2panda/test/compiler/ets/objectLiteralBadKey-expected.txt index 37364fa25b..939b83aee6 100644 --- a/ets2panda/test/compiler/ets/objectLiteralBadKey-expected.txt +++ b/ets2panda/test/compiler/ets/objectLiteralBadKey-expected.txt @@ -301,11 +301,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 21, - "column": 3 + "column": 2 } } } @@ -428,8 +428,8 @@ "column": 5 }, "end": { - "line": 19, - "column": 11 + "line": 21, + "column": 2 } } } diff --git a/ets2panda/test/compiler/ets/objectLiteralInaccessibleKey-expected.txt b/ets2panda/test/compiler/ets/objectLiteralInaccessibleKey-expected.txt index 7d776f219a..169a5fc028 100644 --- a/ets2panda/test/compiler/ets/objectLiteralInaccessibleKey-expected.txt +++ b/ets2panda/test/compiler/ets/objectLiteralInaccessibleKey-expected.txt @@ -351,11 +351,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 22, - "column": 3 + "column": 2 } } } @@ -478,8 +478,8 @@ "column": 5 }, "end": { - "line": 20, - "column": 11 + "line": 22, + "column": 2 } } } diff --git a/ets2panda/test/compiler/ets/objectLiteralInterface-expected.txt b/ets2panda/test/compiler/ets/objectLiteralInterface-expected.txt index 368098ad83..5cd0f4bddf 100644 --- a/ets2panda/test/compiler/ets/objectLiteralInterface-expected.txt +++ b/ets2panda/test/compiler/ets/objectLiteralInterface-expected.txt @@ -161,11 +161,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 15 + "column": 14 } } } @@ -289,7 +289,7 @@ }, "end": { "line": 18, - "column": 11 + "column": 14 } } } diff --git a/ets2panda/test/compiler/ets/objectLiteralNoContextType-expected.txt b/ets2panda/test/compiler/ets/objectLiteralNoContextType-expected.txt index ef22164be0..1d661df1c8 100644 --- a/ets2panda/test/compiler/ets/objectLiteralNoContextType-expected.txt +++ b/ets2panda/test/compiler/ets/objectLiteralNoContextType-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 12 + "column": 11 } } } diff --git a/ets2panda/test/compiler/ets/objectLiteralNoParameterlessConstructor-expected.txt b/ets2panda/test/compiler/ets/objectLiteralNoParameterlessConstructor-expected.txt index 365d537e22..4ca426fbcd 100644 --- a/ets2panda/test/compiler/ets/objectLiteralNoParameterlessConstructor-expected.txt +++ b/ets2panda/test/compiler/ets/objectLiteralNoParameterlessConstructor-expected.txt @@ -298,11 +298,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 15 + "column": 14 } } } @@ -426,7 +426,7 @@ }, "end": { "line": 20, - "column": 11 + "column": 14 } } } diff --git a/ets2panda/test/compiler/ets/objectLiteralNoSuchKey-expected.txt b/ets2panda/test/compiler/ets/objectLiteralNoSuchKey-expected.txt index d7eb3607ec..5af2594c5c 100644 --- a/ets2panda/test/compiler/ets/objectLiteralNoSuchKey-expected.txt +++ b/ets2panda/test/compiler/ets/objectLiteralNoSuchKey-expected.txt @@ -302,11 +302,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 21, - "column": 3 + "column": 2 } } } @@ -429,8 +429,8 @@ "column": 5 }, "end": { - "line": 19, - "column": 11 + "line": 21, + "column": 2 } } } diff --git a/ets2panda/test/compiler/ets/objectLiteralPrimitiveContextType-expected.txt b/ets2panda/test/compiler/ets/objectLiteralPrimitiveContextType-expected.txt index d4c28c364b..6113219ccd 100644 --- a/ets2panda/test/compiler/ets/objectLiteralPrimitiveContextType-expected.txt +++ b/ets2panda/test/compiler/ets/objectLiteralPrimitiveContextType-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 17 + "column": 16 } } } @@ -218,7 +218,7 @@ }, "end": { "line": 16, - "column": 11 + "column": 16 } } } diff --git a/ets2panda/test/compiler/ets/objectLiteralPrivateConstructor-expected.txt b/ets2panda/test/compiler/ets/objectLiteralPrivateConstructor-expected.txt index 65af224bc8..47d07f348f 100644 --- a/ets2panda/test/compiler/ets/objectLiteralPrivateConstructor-expected.txt +++ b/ets2panda/test/compiler/ets/objectLiteralPrivateConstructor-expected.txt @@ -256,11 +256,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 15 + "column": 14 } } } @@ -384,7 +384,7 @@ }, "end": { "line": 20, - "column": 11 + "column": 14 } } } diff --git a/ets2panda/test/compiler/ets/objectLiteralReadonlyKey-expected.txt b/ets2panda/test/compiler/ets/objectLiteralReadonlyKey-expected.txt index 277e55a111..b919165f8e 100644 --- a/ets2panda/test/compiler/ets/objectLiteralReadonlyKey-expected.txt +++ b/ets2panda/test/compiler/ets/objectLiteralReadonlyKey-expected.txt @@ -351,11 +351,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 22, - "column": 3 + "column": 2 } } } @@ -478,8 +478,8 @@ "column": 5 }, "end": { - "line": 20, - "column": 11 + "line": 22, + "column": 2 } } } diff --git a/ets2panda/test/compiler/ets/objectLiteralWrongValueType-expected.txt b/ets2panda/test/compiler/ets/objectLiteralWrongValueType-expected.txt index ba7bf8cb40..e741bd36d0 100644 --- a/ets2panda/test/compiler/ets/objectLiteralWrongValueType-expected.txt +++ b/ets2panda/test/compiler/ets/objectLiteralWrongValueType-expected.txt @@ -351,11 +351,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 22, - "column": 3 + "column": 2 } } } @@ -478,8 +478,8 @@ "column": 5 }, "end": { - "line": 20, - "column": 11 + "line": 22, + "column": 2 } } } diff --git a/ets2panda/test/compiler/ets/throwingFunctionCheck1-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionCheck1-expected.txt index 14b1a16a40..ec00b6e667 100644 --- a/ets2panda/test/compiler/ets/throwingFunctionCheck1-expected.txt +++ b/ets2panda/test/compiler/ets/throwingFunctionCheck1-expected.txt @@ -134,11 +134,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 28 + "column": 27 } } } diff --git a/ets2panda/test/compiler/ets/typeAlias-expected.txt b/ets2panda/test/compiler/ets/typeAlias-expected.txt index 4f17d69d03..2f9467386e 100644 --- a/ets2panda/test/compiler/ets/typeAlias-expected.txt +++ b/ets2panda/test/compiler/ets/typeAlias-expected.txt @@ -179,11 +179,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 29 + "column": 28 } } } diff --git a/ets2panda/test/parser/ets/Dollar_dollar_1-expected.txt b/ets2panda/test/parser/ets/Dollar_dollar_1-expected.txt index b50e9e4867..e3d9bb2699 100644 --- a/ets2panda/test/parser/ets/Dollar_dollar_1-expected.txt +++ b/ets2panda/test/parser/ets/Dollar_dollar_1-expected.txt @@ -133,7 +133,7 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, diff --git a/ets2panda/test/parser/ets/Dollar_dollar_3-expected.txt b/ets2panda/test/parser/ets/Dollar_dollar_3-expected.txt index f981e5c354..d4d7953e1d 100644 --- a/ets2panda/test/parser/ets/Dollar_dollar_3-expected.txt +++ b/ets2panda/test/parser/ets/Dollar_dollar_3-expected.txt @@ -296,7 +296,7 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 18, @@ -368,7 +368,7 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, diff --git a/ets2panda/test/parser/ets/Dollar_dollar_4-expected.txt b/ets2panda/test/parser/ets/Dollar_dollar_4-expected.txt index f38a7fdcff..ad15034d81 100644 --- a/ets2panda/test/parser/ets/Dollar_dollar_4-expected.txt +++ b/ets2panda/test/parser/ets/Dollar_dollar_4-expected.txt @@ -118,7 +118,7 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, diff --git a/ets2panda/test/parser/ets/FunctionType-expected.txt b/ets2panda/test/parser/ets/FunctionType-expected.txt index 051ecf2aa9..dc021dada9 100644 --- a/ets2panda/test/parser/ets/FunctionType-expected.txt +++ b/ets2panda/test/parser/ets/FunctionType-expected.txt @@ -569,7 +569,7 @@ }, "end": { "line": 16, - "column": 32 + "column": 6 } } }, @@ -674,7 +674,7 @@ }, "end": { "line": 17, - "column": 26 + "column": 6 } } }, diff --git a/ets2panda/test/parser/ets/ambiguous_call_1-expected.txt b/ets2panda/test/parser/ets/ambiguous_call_1-expected.txt index 6c87709fc0..1484280686 100644 --- a/ets2panda/test/parser/ets/ambiguous_call_1-expected.txt +++ b/ets2panda/test/parser/ets/ambiguous_call_1-expected.txt @@ -621,7 +621,7 @@ "loc": { "start": { "line": 16, - "column": 14 + "column": 13 }, "end": { "line": 16, @@ -632,7 +632,7 @@ "loc": { "start": { "line": 16, - "column": 14 + "column": 13 }, "end": { "line": 16, @@ -814,7 +814,7 @@ "loc": { "start": { "line": 17, - "column": 14 + "column": 13 }, "end": { "line": 17, @@ -825,7 +825,7 @@ "loc": { "start": { "line": 17, - "column": 14 + "column": 13 }, "end": { "line": 17, @@ -1062,7 +1062,7 @@ "loc": { "start": { "line": 22, - "column": 15 + "column": 14 }, "end": { "line": 24, @@ -1073,7 +1073,7 @@ "loc": { "start": { "line": 22, - "column": 15 + "column": 14 }, "end": { "line": 24, diff --git a/ets2panda/test/parser/ets/ambiguous_call_2-expected.txt b/ets2panda/test/parser/ets/ambiguous_call_2-expected.txt index 6fb45ac9a5..d6d64da7f5 100644 --- a/ets2panda/test/parser/ets/ambiguous_call_2-expected.txt +++ b/ets2panda/test/parser/ets/ambiguous_call_2-expected.txt @@ -1022,7 +1022,7 @@ "loc": { "start": { "line": 16, - "column": 14 + "column": 13 }, "end": { "line": 16, @@ -1033,7 +1033,7 @@ "loc": { "start": { "line": 16, - "column": 14 + "column": 13 }, "end": { "line": 16, @@ -1325,7 +1325,7 @@ "loc": { "start": { "line": 17, - "column": 14 + "column": 13 }, "end": { "line": 17, @@ -1336,7 +1336,7 @@ "loc": { "start": { "line": 17, - "column": 14 + "column": 13 }, "end": { "line": 17, @@ -1640,7 +1640,7 @@ "loc": { "start": { "line": 18, - "column": 14 + "column": 13 }, "end": { "line": 18, @@ -1651,7 +1651,7 @@ "loc": { "start": { "line": 18, - "column": 14 + "column": 13 }, "end": { "line": 18, @@ -1916,7 +1916,7 @@ "loc": { "start": { "line": 26, - "column": 15 + "column": 14 }, "end": { "line": 28, @@ -1927,7 +1927,7 @@ "loc": { "start": { "line": 26, - "column": 15 + "column": 14 }, "end": { "line": 28, diff --git a/ets2panda/test/parser/ets/ambiguous_call_3-expected.txt b/ets2panda/test/parser/ets/ambiguous_call_3-expected.txt index eaca9b0b5c..b037238447 100644 --- a/ets2panda/test/parser/ets/ambiguous_call_3-expected.txt +++ b/ets2panda/test/parser/ets/ambiguous_call_3-expected.txt @@ -701,7 +701,7 @@ "loc": { "start": { "line": 16, - "column": 14 + "column": 13 }, "end": { "line": 16, @@ -712,7 +712,7 @@ "loc": { "start": { "line": 16, - "column": 14 + "column": 13 }, "end": { "line": 16, @@ -894,7 +894,7 @@ "loc": { "start": { "line": 17, - "column": 14 + "column": 13 }, "end": { "line": 17, @@ -905,7 +905,7 @@ "loc": { "start": { "line": 17, - "column": 14 + "column": 13 }, "end": { "line": 17, @@ -1142,7 +1142,7 @@ "loc": { "start": { "line": 22, - "column": 15 + "column": 14 }, "end": { "line": 24, @@ -1153,7 +1153,7 @@ "loc": { "start": { "line": 22, - "column": 15 + "column": 14 }, "end": { "line": 24, diff --git a/ets2panda/test/parser/ets/array-expected.txt b/ets2panda/test/parser/ets/array-expected.txt index 94a5bd22f3..3a3d657a17 100644 --- a/ets2panda/test/parser/ets/array-expected.txt +++ b/ets2panda/test/parser/ets/array-expected.txt @@ -161,11 +161,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 24 + "column": 23 } } }, @@ -260,11 +260,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 35 + "column": 34 } } } @@ -373,7 +373,7 @@ }, "end": { "line": 16, - "column": 15 + "column": 23 } } }, @@ -463,7 +463,7 @@ }, "end": { "line": 17, - "column": 18 + "column": 34 } } }, diff --git a/ets2panda/test/parser/ets/arrayHoldingNullValue-expected.txt b/ets2panda/test/parser/ets/arrayHoldingNullValue-expected.txt index 6ef51b7c7d..5f4c36f800 100644 --- a/ets2panda/test/parser/ets/arrayHoldingNullValue-expected.txt +++ b/ets2panda/test/parser/ets/arrayHoldingNullValue-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 28 + "column": 27 } } }, @@ -174,11 +174,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 31 + "column": 30 } } }, @@ -230,11 +230,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 31 + "column": 30 } } } @@ -371,7 +371,7 @@ }, "end": { "line": 16, - "column": 20 + "column": 27 } } }, @@ -461,7 +461,7 @@ }, "end": { "line": 17, - "column": 23 + "column": 30 } } }, @@ -579,7 +579,7 @@ }, "end": { "line": 18, - "column": 23 + "column": 30 } } }, diff --git a/ets2panda/test/parser/ets/assign-expected.txt b/ets2panda/test/parser/ets/assign-expected.txt index 89ce3dbfca..1ee8a063a2 100644 --- a/ets2panda/test/parser/ets/assign-expected.txt +++ b/ets2panda/test/parser/ets/assign-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 11 + "column": 10 } } } diff --git a/ets2panda/test/parser/ets/async_function_bad-expected.txt b/ets2panda/test/parser/ets/async_function_bad-expected.txt index 2e3d432ead..a993bdde6d 100644 --- a/ets2panda/test/parser/ets/async_function_bad-expected.txt +++ b/ets2panda/test/parser/ets/async_function_bad-expected.txt @@ -1 +1 @@ -SyntaxError: 'async' flags must be used for functions at top-level. [async_function_bad.ets:16:7] +SyntaxError: 'async' flags must be used for functions only at top-level. [async_function_bad.ets:16:7] diff --git a/ets2panda/test/parser/ets/async_with_lambda-expected.txt b/ets2panda/test/parser/ets/async_with_lambda-expected.txt index dba529e9ed..f9fdfc7136 100644 --- a/ets2panda/test/parser/ets/async_with_lambda-expected.txt +++ b/ets2panda/test/parser/ets/async_with_lambda-expected.txt @@ -161,7 +161,7 @@ }, "end": { "line": 16, - "column": 16 + "column": 11 } } }, diff --git a/ets2panda/test/parser/ets/await_keyword-expected.txt b/ets2panda/test/parser/ets/await_keyword-expected.txt index da5fba9bfd..b9e70d8bf5 100644 --- a/ets2panda/test/parser/ets/await_keyword-expected.txt +++ b/ets2panda/test/parser/ets/await_keyword-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 38, - "column": 1 + "column": 5 }, "end": { "line": 38, - "column": 51 + "column": 50 } } }, @@ -201,7 +201,7 @@ "loc": { "start": { "line": 39, - "column": 1 + "column": 5 }, "end": { "line": 39, @@ -2837,7 +2837,7 @@ }, "end": { "line": 38, - "column": 43 + "column": 50 } } }, @@ -2942,7 +2942,7 @@ }, "end": { "line": 39, - "column": 23 + "column": 41 } } } diff --git a/ets2panda/test/parser/ets/binary_op-expected.txt b/ets2panda/test/parser/ets/binary_op-expected.txt index 2364125730..131c35f763 100644 --- a/ets2panda/test/parser/ets/binary_op-expected.txt +++ b/ets2panda/test/parser/ets/binary_op-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 11 + "column": 10 } } }, @@ -174,11 +174,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 11 + "column": 10 } } }, @@ -230,11 +230,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 15 + "column": 14 } } }, @@ -286,11 +286,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 16 + "column": 15 } } }, @@ -383,7 +383,7 @@ "loc": { "start": { "line": 21, - "column": 1 + "column": 5 }, "end": { "line": 21, @@ -439,11 +439,11 @@ "loc": { "start": { "line": 22, - "column": 1 + "column": 5 }, "end": { "line": 22, - "column": 30 + "column": 29 } } }, @@ -525,11 +525,11 @@ "loc": { "start": { "line": 25, - "column": 1 + "column": 5 }, "end": { "line": 25, - "column": 19 + "column": 18 } } }, @@ -640,11 +640,11 @@ "loc": { "start": { "line": 26, - "column": 1 + "column": 5 }, "end": { "line": 26, - "column": 25 + "column": 24 } } }, @@ -726,11 +726,11 @@ "loc": { "start": { "line": 29, - "column": 1 + "column": 5 }, "end": { "line": 29, - "column": 20 + "column": 19 } } }, @@ -812,11 +812,11 @@ "loc": { "start": { "line": 30, - "column": 1 + "column": 5 }, "end": { "line": 30, - "column": 20 + "column": 19 } } }, @@ -956,11 +956,11 @@ "loc": { "start": { "line": 31, - "column": 1 + "column": 5 }, "end": { "line": 31, - "column": 34 + "column": 33 } } }, @@ -1100,11 +1100,11 @@ "loc": { "start": { "line": 32, - "column": 1 + "column": 5 }, "end": { "line": 32, - "column": 34 + "column": 33 } } }, @@ -1244,11 +1244,11 @@ "loc": { "start": { "line": 33, - "column": 1 + "column": 5 }, "end": { "line": 33, - "column": 34 + "column": 33 } } }, @@ -1388,11 +1388,11 @@ "loc": { "start": { "line": 34, - "column": 1 + "column": 5 }, "end": { "line": 34, - "column": 34 + "column": 33 } } }, @@ -1474,11 +1474,11 @@ "loc": { "start": { "line": 37, - "column": 1 + "column": 5 }, "end": { "line": 37, - "column": 17 + "column": 16 } } }, @@ -1560,11 +1560,11 @@ "loc": { "start": { "line": 38, - "column": 1 + "column": 5 }, "end": { "line": 38, - "column": 17 + "column": 16 } } }, @@ -1646,11 +1646,11 @@ "loc": { "start": { "line": 39, - "column": 1 + "column": 5 }, "end": { "line": 39, - "column": 17 + "column": 16 } } }, @@ -1848,11 +1848,11 @@ "loc": { "start": { "line": 40, - "column": 1 + "column": 5 }, "end": { "line": 40, - "column": 33 + "column": 32 } } }, @@ -1934,11 +1934,11 @@ "loc": { "start": { "line": 43, - "column": 1 + "column": 5 }, "end": { "line": 43, - "column": 18 + "column": 17 } } }, @@ -2020,11 +2020,11 @@ "loc": { "start": { "line": 44, - "column": 1 + "column": 5 }, "end": { "line": 44, - "column": 18 + "column": 17 } } }, @@ -2106,11 +2106,11 @@ "loc": { "start": { "line": 45, - "column": 1 + "column": 5 }, "end": { "line": 45, - "column": 21 + "column": 20 } } }, @@ -2192,11 +2192,11 @@ "loc": { "start": { "line": 46, - "column": 1 + "column": 5 }, "end": { "line": 46, - "column": 21 + "column": 20 } } }, @@ -2278,11 +2278,11 @@ "loc": { "start": { "line": 49, - "column": 1 + "column": 5 }, "end": { "line": 49, - "column": 17 + "column": 16 } } }, @@ -2364,11 +2364,11 @@ "loc": { "start": { "line": 50, - "column": 1 + "column": 5 }, "end": { "line": 50, - "column": 17 + "column": 16 } } }, @@ -2450,11 +2450,11 @@ "loc": { "start": { "line": 51, - "column": 1 + "column": 5 }, "end": { "line": 51, - "column": 18 + "column": 17 } } }, @@ -2536,11 +2536,11 @@ "loc": { "start": { "line": 52, - "column": 1 + "column": 5 }, "end": { "line": 52, - "column": 18 + "column": 17 } } }, @@ -2622,11 +2622,11 @@ "loc": { "start": { "line": 53, - "column": 1 + "column": 5 }, "end": { "line": 53, - "column": 32 + "column": 31 } } }, @@ -2708,11 +2708,11 @@ "loc": { "start": { "line": 56, - "column": 1 + "column": 5 }, "end": { "line": 56, - "column": 18 + "column": 17 } } }, @@ -2794,11 +2794,11 @@ "loc": { "start": { "line": 57, - "column": 1 + "column": 5 }, "end": { "line": 57, - "column": 18 + "column": 17 } } }, @@ -2880,11 +2880,11 @@ "loc": { "start": { "line": 58, - "column": 1 + "column": 5 }, "end": { "line": 58, - "column": 19 + "column": 18 } } }, @@ -3024,11 +3024,11 @@ "loc": { "start": { "line": 59, - "column": 1 + "column": 5 }, "end": { "line": 59, - "column": 29 + "column": 28 } } }, @@ -3110,11 +3110,11 @@ "loc": { "start": { "line": 62, - "column": 1 + "column": 5 }, "end": { "line": 62, - "column": 17 + "column": 16 } } }, @@ -3196,11 +3196,11 @@ "loc": { "start": { "line": 63, - "column": 1 + "column": 5 }, "end": { "line": 63, - "column": 17 + "column": 16 } } }, @@ -3340,11 +3340,11 @@ "loc": { "start": { "line": 64, - "column": 1 + "column": 5 }, "end": { "line": 64, - "column": 25 + "column": 24 } } }, @@ -3426,11 +3426,11 @@ "loc": { "start": { "line": 67, - "column": 1 + "column": 5 }, "end": { "line": 67, - "column": 17 + "column": 16 } } }, @@ -3512,11 +3512,11 @@ "loc": { "start": { "line": 68, - "column": 1 + "column": 5 }, "end": { "line": 68, - "column": 17 + "column": 16 } } }, @@ -3598,11 +3598,11 @@ "loc": { "start": { "line": 69, - "column": 1 + "column": 5 }, "end": { "line": 69, - "column": 17 + "column": 16 } } }, @@ -3800,11 +3800,11 @@ "loc": { "start": { "line": 70, - "column": 1 + "column": 5 }, "end": { "line": 70, - "column": 33 + "column": 32 } } }, @@ -3944,11 +3944,11 @@ "loc": { "start": { "line": 73, - "column": 1 + "column": 5 }, "end": { "line": 73, - "column": 27 + "column": 26 } } }, @@ -4088,11 +4088,11 @@ "loc": { "start": { "line": 74, - "column": 1 + "column": 5 }, "end": { "line": 74, - "column": 29 + "column": 28 } } }, @@ -4435,11 +4435,11 @@ "loc": { "start": { "line": 75, - "column": 1 + "column": 5 }, "end": { "line": 75, - "column": 63 + "column": 62 } } }, @@ -4782,11 +4782,11 @@ "loc": { "start": { "line": 76, - "column": 1 + "column": 5 }, "end": { "line": 76, - "column": 64 + "column": 63 } } }, @@ -4955,11 +4955,11 @@ "loc": { "start": { "line": 77, - "column": 1 + "column": 5 }, "end": { "line": 77, - "column": 35 + "column": 34 } } } @@ -5402,7 +5402,7 @@ }, "end": { "line": 22, - "column": 22 + "column": 29 } } }, diff --git a/ets2panda/test/parser/ets/boolean-expected.txt b/ets2panda/test/parser/ets/boolean-expected.txt index ddbbcc7ffe..bb679ea24a 100644 --- a/ets2panda/test/parser/ets/boolean-expected.txt +++ b/ets2panda/test/parser/ets/boolean-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 23 + "column": 22 } } } @@ -218,7 +218,7 @@ }, "end": { "line": 16, - "column": 15 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/break-expected.txt b/ets2panda/test/parser/ets/break-expected.txt index c165861131..de23f03f7f 100644 --- a/ets2panda/test/parser/ets/break-expected.txt +++ b/ets2panda/test/parser/ets/break-expected.txt @@ -161,11 +161,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 26 + "column": 25 } } } @@ -274,7 +274,7 @@ }, "end": { "line": 16, - "column": 15 + "column": 25 } } }, diff --git a/ets2panda/test/parser/ets/cast_expressions5-expected.txt b/ets2panda/test/parser/ets/cast_expressions5-expected.txt index d8a3a2b217..e68c5b2871 100644 --- a/ets2panda/test/parser/ets/cast_expressions5-expected.txt +++ b/ets2panda/test/parser/ets/cast_expressions5-expected.txt @@ -717,11 +717,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 26 + "column": 25 } } } @@ -817,7 +817,7 @@ }, "end": { "line": 16, - "column": 21 + "column": 25 } } }, diff --git a/ets2panda/test/parser/ets/class_instance-expected.txt b/ets2panda/test/parser/ets/class_instance-expected.txt index a4e953fd73..ec3b1a26ab 100644 --- a/ets2panda/test/parser/ets/class_instance-expected.txt +++ b/ets2panda/test/parser/ets/class_instance-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 11 + "column": 10 } } }, @@ -174,11 +174,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 12 + "column": 11 } } }, @@ -256,11 +256,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 21 + "column": 20 } } }, @@ -356,11 +356,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 23 + "column": 22 } } }, @@ -500,11 +500,11 @@ "loc": { "start": { "line": 21, - "column": 1 + "column": 5 }, "end": { "line": 21, - "column": 30 + "column": 29 } } } diff --git a/ets2panda/test/parser/ets/const_enum-expected.txt b/ets2panda/test/parser/ets/const_enum-expected.txt index 512ed79e80..bfb000b710 100644 --- a/ets2panda/test/parser/ets/const_enum-expected.txt +++ b/ets2panda/test/parser/ets/const_enum-expected.txt @@ -1 +1 @@ -SyntaxError: Identifier expected. [const_enum.ets:16:7] +SyntaxError: Variable declaration expected. [const_enum.ets:16:7] diff --git a/ets2panda/test/parser/ets/continue-expected.txt b/ets2panda/test/parser/ets/continue-expected.txt index cd8cfe6fab..264fa69017 100644 --- a/ets2panda/test/parser/ets/continue-expected.txt +++ b/ets2panda/test/parser/ets/continue-expected.txt @@ -161,11 +161,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 26 + "column": 25 } } } @@ -274,7 +274,7 @@ }, "end": { "line": 16, - "column": 15 + "column": 25 } } }, diff --git a/ets2panda/test/parser/ets/decl_infer-expected.txt b/ets2panda/test/parser/ets/decl_infer-expected.txt index 0455f4f8b2..effb99d39e 100644 --- a/ets2panda/test/parser/ets/decl_infer-expected.txt +++ b/ets2panda/test/parser/ets/decl_infer-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 12 + "column": 11 } } }, @@ -174,11 +174,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 14 + "column": 13 } } }, @@ -230,11 +230,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 15 + "column": 14 } } }, @@ -286,11 +286,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 15 + "column": 14 } } }, @@ -342,11 +342,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 16 + "column": 15 } } } diff --git a/ets2panda/test/parser/ets/exports-expected.txt b/ets2panda/test/parser/ets/exports-expected.txt index aab03ca622..aaceffc96d 100644 --- a/ets2panda/test/parser/ets/exports-expected.txt +++ b/ets2panda/test/parser/ets/exports-expected.txt @@ -339,11 +339,11 @@ "loc": { "start": { "line": 16, - "column": 8 + "column": 12 }, "end": { "line": 16, - "column": 19 + "column": 18 } } } diff --git a/ets2panda/test/parser/ets/for_of-expected.txt b/ets2panda/test/parser/ets/for_of-expected.txt index d3446be05a..cef1c5eec2 100644 --- a/ets2panda/test/parser/ets/for_of-expected.txt +++ b/ets2panda/test/parser/ets/for_of-expected.txt @@ -161,11 +161,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 26 + "column": 25 } } } @@ -274,7 +274,7 @@ }, "end": { "line": 17, - "column": 15 + "column": 25 } } }, diff --git a/ets2panda/test/parser/ets/for_of_02-expected.txt b/ets2panda/test/parser/ets/for_of_02-expected.txt index f7ae611379..adcd757016 100644 --- a/ets2panda/test/parser/ets/for_of_02-expected.txt +++ b/ets2panda/test/parser/ets/for_of_02-expected.txt @@ -161,11 +161,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 26 + "column": 25 } } } @@ -274,7 +274,7 @@ }, "end": { "line": 16, - "column": 15 + "column": 25 } } }, diff --git a/ets2panda/test/parser/ets/functionTypeThrows-expected.txt b/ets2panda/test/parser/ets/functionTypeThrows-expected.txt index 2c3510eb60..db780fab06 100644 --- a/ets2panda/test/parser/ets/functionTypeThrows-expected.txt +++ b/ets2panda/test/parser/ets/functionTypeThrows-expected.txt @@ -259,7 +259,7 @@ }, "end": { "line": 16, - "column": 32 + "column": 6 } } } diff --git a/ets2panda/test/parser/ets/function_implicit_return_type3-expected.txt b/ets2panda/test/parser/ets/function_implicit_return_type3-expected.txt index ef11ad3a75..d3dab3e156 100644 --- a/ets2panda/test/parser/ets/function_implicit_return_type3-expected.txt +++ b/ets2panda/test/parser/ets/function_implicit_return_type3-expected.txt @@ -119,11 +119,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 33 + "column": 32 } } } diff --git a/ets2panda/test/parser/ets/genericDefaultParam_1-expected.txt b/ets2panda/test/parser/ets/genericDefaultParam_1-expected.txt index 09b1fbae7a..8387f49f9a 100644 --- a/ets2panda/test/parser/ets/genericDefaultParam_1-expected.txt +++ b/ets2panda/test/parser/ets/genericDefaultParam_1-expected.txt @@ -1988,7 +1988,7 @@ "loc": { "start": { "line": 31, - "column": 1 + "column": 5 }, "end": { "line": 32, @@ -2182,7 +2182,7 @@ "loc": { "start": { "line": 32, - "column": 1 + "column": 5 }, "end": { "line": 33, @@ -2417,7 +2417,7 @@ "loc": { "start": { "line": 33, - "column": 1 + "column": 5 }, "end": { "line": 34, diff --git a/ets2panda/test/parser/ets/generics_type_param_constraint_3-expected.txt b/ets2panda/test/parser/ets/generics_type_param_constraint_3-expected.txt index 3b525585b9..8a94129e2a 100644 --- a/ets2panda/test/parser/ets/generics_type_param_constraint_3-expected.txt +++ b/ets2panda/test/parser/ets/generics_type_param_constraint_3-expected.txt @@ -458,7 +458,7 @@ "loc": { "start": { "line": 17, - "column": 12 + "column": 11 }, "end": { "line": 19, @@ -469,7 +469,7 @@ "loc": { "start": { "line": 17, - "column": 12 + "column": 11 }, "end": { "line": 19, diff --git a/ets2panda/test/parser/ets/identifier-expected.txt b/ets2panda/test/parser/ets/identifier-expected.txt index 79101bcf96..70df781844 100644 --- a/ets2panda/test/parser/ets/identifier-expected.txt +++ b/ets2panda/test/parser/ets/identifier-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 27 + "column": 26 } } }, @@ -174,11 +174,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 32 + "column": 31 } } }, @@ -230,11 +230,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 28 + "column": 27 } } } @@ -330,7 +330,7 @@ }, "end": { "line": 17, - "column": 22 + "column": 26 } } }, @@ -379,7 +379,7 @@ }, "end": { "line": 18, - "column": 27 + "column": 31 } } }, @@ -428,7 +428,7 @@ }, "end": { "line": 19, - "column": 23 + "column": 27 } } } diff --git a/ets2panda/test/parser/ets/import_tests/diamond/test2-expected.txt b/ets2panda/test/parser/ets/import_tests/diamond/test2-expected.txt index 8112eb8de8..d799f95d2a 100644 --- a/ets2panda/test/parser/ets/import_tests/diamond/test2-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/diamond/test2-expected.txt @@ -191,11 +191,11 @@ "loc": { "start": { "line": 18, - "column": 8 + "column": 12 }, "end": { "line": 18, - "column": 22 + "column": 21 } } } diff --git a/ets2panda/test/parser/ets/import_tests/diamond/test3-expected.txt b/ets2panda/test/parser/ets/import_tests/diamond/test3-expected.txt index 433f4b32ea..ce83883aad 100644 --- a/ets2panda/test/parser/ets/import_tests/diamond/test3-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/diamond/test3-expected.txt @@ -191,11 +191,11 @@ "loc": { "start": { "line": 18, - "column": 8 + "column": 12 }, "end": { "line": 18, - "column": 22 + "column": 21 } } } diff --git a/ets2panda/test/parser/ets/import_tests/diamond/test4-expected.txt b/ets2panda/test/parser/ets/import_tests/diamond/test4-expected.txt index 49fc3015d8..96bbb0c8bb 100644 --- a/ets2panda/test/parser/ets/import_tests/diamond/test4-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/diamond/test4-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 8 + "column": 12 }, "end": { "line": 16, - "column": 20 + "column": 19 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_alias/export-expected.txt b/ets2panda/test/parser/ets/import_tests/import_alias/export-expected.txt index 6f65df0476..03aa93b5c2 100644 --- a/ets2panda/test/parser/ets/import_tests/import_alias/export-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_alias/export-expected.txt @@ -580,11 +580,11 @@ "loc": { "start": { "line": 28, - "column": 1 + "column": 5 }, "end": { "line": 28, - "column": 15 + "column": 14 } } }, @@ -636,11 +636,11 @@ "loc": { "start": { "line": 30, - "column": 8 + "column": 12 }, "end": { "line": 30, - "column": 22 + "column": 21 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_all-expected.txt b/ets2panda/test/parser/ets/import_tests/import_all-expected.txt index a05f2eaec9..34fdeb2579 100755 --- a/ets2panda/test/parser/ets/import_tests/import_all-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_all-expected.txt @@ -264,11 +264,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 47 + "column": 46 } } }, @@ -352,11 +352,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 46 + "column": 45 } } }, @@ -439,11 +439,11 @@ "loc": { "start": { "line": 21, - "column": 1 + "column": 5 }, "end": { "line": 21, - "column": 49 + "column": 48 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_all_alias_1-expected.txt b/ets2panda/test/parser/ets/import_tests/import_all_alias_1-expected.txt index e105d8c13c..1079f0ac8a 100644 --- a/ets2panda/test/parser/ets/import_tests/import_all_alias_1-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_all_alias_1-expected.txt @@ -267,11 +267,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 57 + "column": 56 } } }, @@ -415,11 +415,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 56 + "column": 55 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_all_alias_2-expected.txt b/ets2panda/test/parser/ets/import_tests/import_all_alias_2-expected.txt index 18b018cd70..623e169b05 100755 --- a/ets2panda/test/parser/ets/import_tests/import_all_alias_2-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_all_alias_2-expected.txt @@ -207,11 +207,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 47 + "column": 46 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_all_type_alias-expected.txt b/ets2panda/test/parser/ets/import_tests/import_all_type_alias-expected.txt index 24bbedcd1f..c58e5d0af3 100644 --- a/ets2panda/test/parser/ets/import_tests/import_all_type_alias-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_all_type_alias-expected.txt @@ -244,7 +244,7 @@ "loc": { "start": { "line": 22, - "column": 1 + "column": 5 }, "end": { "line": 22, diff --git a/ets2panda/test/parser/ets/import_tests/import_extension/import_extension_1-expected.txt b/ets2panda/test/parser/ets/import_tests/import_extension/import_extension_1-expected.txt index be0e993ec5..1192ec0859 100644 --- a/ets2panda/test/parser/ets/import_tests/import_extension/import_extension_1-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_extension/import_extension_1-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 8 + "column": 12 }, "end": { "line": 16, - "column": 22 + "column": 21 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_extension/import_extension_2-expected.txt b/ets2panda/test/parser/ets/import_tests/import_extension/import_extension_2-expected.txt index 2e50790ef4..db763b9353 100644 --- a/ets2panda/test/parser/ets/import_tests/import_extension/import_extension_2-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_extension/import_extension_2-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 8 + "column": 12 }, "end": { "line": 16, - "column": 22 + "column": 21 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_name_1-expected.txt b/ets2panda/test/parser/ets/import_tests/import_name_1-expected.txt index 77c11005f8..40e1725683 100755 --- a/ets2panda/test/parser/ets/import_tests/import_name_1-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_name_1-expected.txt @@ -308,11 +308,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 47 + "column": 46 } } }, @@ -396,7 +396,7 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, diff --git a/ets2panda/test/parser/ets/import_tests/import_name_2-expected.txt b/ets2panda/test/parser/ets/import_tests/import_name_2-expected.txt index 4ce97a3c9b..f994a5367e 100755 --- a/ets2panda/test/parser/ets/import_tests/import_name_2-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_name_2-expected.txt @@ -265,11 +265,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 18 + "column": 17 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_name_alias_1-expected.txt b/ets2panda/test/parser/ets/import_tests/import_name_alias_1-expected.txt index 8192941368..5206b86417 100755 --- a/ets2panda/test/parser/ets/import_tests/import_name_alias_1-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_name_alias_1-expected.txt @@ -308,11 +308,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 47 + "column": 46 } } }, @@ -396,11 +396,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 46 + "column": 45 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_name_alias_2-expected.txt b/ets2panda/test/parser/ets/import_tests/import_name_alias_2-expected.txt index 6c17455873..d072593243 100755 --- a/ets2panda/test/parser/ets/import_tests/import_name_alias_2-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_name_alias_2-expected.txt @@ -265,11 +265,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 18 + "column": 17 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_relative_path-expected.txt b/ets2panda/test/parser/ets/import_tests/import_relative_path-expected.txt index c99810cb09..69ad61a034 100755 --- a/ets2panda/test/parser/ets/import_tests/import_relative_path-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_relative_path-expected.txt @@ -207,11 +207,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 47 + "column": 46 } } }, @@ -295,11 +295,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 46 + "column": 45 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_several_1-expected.txt b/ets2panda/test/parser/ets/import_tests/import_several_1-expected.txt index 7ceeda9725..f4fc0df83c 100755 --- a/ets2panda/test/parser/ets/import_tests/import_several_1-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_several_1-expected.txt @@ -366,11 +366,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 47 + "column": 46 } } }, @@ -454,11 +454,11 @@ "loc": { "start": { "line": 21, - "column": 1 + "column": 5 }, "end": { "line": 21, - "column": 46 + "column": 45 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_several_2-expected.txt b/ets2panda/test/parser/ets/import_tests/import_several_2-expected.txt index a1118839c3..a6b9200056 100755 --- a/ets2panda/test/parser/ets/import_tests/import_several_2-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_several_2-expected.txt @@ -264,11 +264,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 19 + "column": 18 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_several_3-expected.txt b/ets2panda/test/parser/ets/import_tests/import_several_3-expected.txt index bb89ff35a9..0c310d7017 100755 --- a/ets2panda/test/parser/ets/import_tests/import_several_3-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_several_3-expected.txt @@ -279,11 +279,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 47 + "column": 46 } } }, @@ -367,11 +367,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 46 + "column": 45 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_several_4-expected.txt b/ets2panda/test/parser/ets/import_tests/import_several_4-expected.txt index 614c31accb..6ea9c81dd2 100644 --- a/ets2panda/test/parser/ets/import_tests/import_several_4-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_several_4-expected.txt @@ -309,11 +309,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 52 + "column": 51 } } }, @@ -457,11 +457,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 56 + "column": 55 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_several_5-expected.txt b/ets2panda/test/parser/ets/import_tests/import_several_5-expected.txt index 3d619efbbe..eb8902b6de 100755 --- a/ets2panda/test/parser/ets/import_tests/import_several_5-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_several_5-expected.txt @@ -279,11 +279,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 47 + "column": 46 } } }, @@ -367,11 +367,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 46 + "column": 45 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_several_6-expected.txt b/ets2panda/test/parser/ets/import_tests/import_several_6-expected.txt index 08763cfb56..4f190cb5ec 100644 --- a/ets2panda/test/parser/ets/import_tests/import_several_6-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_several_6-expected.txt @@ -309,11 +309,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 52 + "column": 51 } } }, @@ -457,11 +457,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 56 + "column": 55 } } } diff --git a/ets2panda/test/parser/ets/import_tests/import_several_7-expected.txt b/ets2panda/test/parser/ets/import_tests/import_several_7-expected.txt index a522257b8f..d4d3958526 100755 --- a/ets2panda/test/parser/ets/import_tests/import_several_7-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_several_7-expected.txt @@ -351,11 +351,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 47 + "column": 46 } } }, @@ -439,11 +439,11 @@ "loc": { "start": { "line": 21, - "column": 1 + "column": 5 }, "end": { "line": 21, - "column": 46 + "column": 45 } } } diff --git a/ets2panda/test/parser/ets/import_tests/modules/module1/src/re_export_file-expected.txt b/ets2panda/test/parser/ets/import_tests/modules/module1/src/re_export_file-expected.txt index 3120da76ac..18b4708ce9 100644 --- a/ets2panda/test/parser/ets/import_tests/modules/module1/src/re_export_file-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/modules/module1/src/re_export_file-expected.txt @@ -1,6 +1,91 @@ { "type": "Program", "statements": [ + { + "type": "ETSReExportDeclaration", + "ets_import_declarations": { + "type": "ImportDeclaration", + "source": { + "type": "StringLiteral", + "value": "./export_file", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 34 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "num", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "imported": { + "type": "Identifier", + "name": "num", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 12 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 34 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, { "type": "ClassDeclaration", "definition": { diff --git a/ets2panda/test/parser/ets/import_tests/modules/module2/src/re_export_file-expected.txt b/ets2panda/test/parser/ets/import_tests/modules/module2/src/re_export_file-expected.txt index 3120da76ac..a4e89c0240 100644 --- a/ets2panda/test/parser/ets/import_tests/modules/module2/src/re_export_file-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/modules/module2/src/re_export_file-expected.txt @@ -1,6 +1,91 @@ { "type": "Program", "statements": [ + { + "type": "ETSReExportDeclaration", + "ets_import_declarations": { + "type": "ImportDeclaration", + "source": { + "type": "StringLiteral", + "value": "../../module1/src/re_export_file", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 53 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "num", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "imported": { + "type": "Identifier", + "name": "num", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 12 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 53 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, { "type": "ClassDeclaration", "definition": { diff --git a/ets2panda/test/parser/ets/import_tests/modules/too_many_default_exports_2-expected.txt b/ets2panda/test/parser/ets/import_tests/modules/too_many_default_exports_2-expected.txt index 286371d4e6..f4b12fc8ce 100644 --- a/ets2panda/test/parser/ets/import_tests/modules/too_many_default_exports_2-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/modules/too_many_default_exports_2-expected.txt @@ -1 +1 @@ -SyntaxError: Only one default export is allowed in a module [too_many_default_exports_2.ets:16:16] +SyntaxError: Only one default export is allowed in a module [too_many_default_exports_2.ets:16:27] diff --git a/ets2panda/test/parser/ets/import_tests/relative_import/alias2-expected.txt b/ets2panda/test/parser/ets/import_tests/relative_import/alias2-expected.txt index 78b1a6b2bb..0ce3e4dd86 100644 --- a/ets2panda/test/parser/ets/import_tests/relative_import/alias2-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/relative_import/alias2-expected.txt @@ -349,11 +349,11 @@ "loc": { "start": { "line": 16, - "column": 8 + "column": 12 }, "end": { "line": 16, - "column": 20 + "column": 19 } } } diff --git a/ets2panda/test/parser/ets/index_expressions-expected.txt b/ets2panda/test/parser/ets/index_expressions-expected.txt index da4f144916..39fc2ad997 100644 --- a/ets2panda/test/parser/ets/index_expressions-expected.txt +++ b/ets2panda/test/parser/ets/index_expressions-expected.txt @@ -144,11 +144,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 20 + "column": 19 } } }, @@ -230,11 +230,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 14 + "column": 13 } } }, @@ -317,11 +317,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 14 + "column": 13 } } }, @@ -434,11 +434,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 17 + "column": 16 } } } diff --git a/ets2panda/test/parser/ets/lambda_import_alias_1-2-expected.txt b/ets2panda/test/parser/ets/lambda_import_alias_1-2-expected.txt index a84470483e..2821fed828 100644 --- a/ets2panda/test/parser/ets/lambda_import_alias_1-2-expected.txt +++ b/ets2panda/test/parser/ets/lambda_import_alias_1-2-expected.txt @@ -303,7 +303,7 @@ "loc": { "start": { "line": 18, - "column": 8 + "column": 12 }, "end": { "line": 18, diff --git a/ets2panda/test/parser/ets/launch_with_call_expression-expected.txt b/ets2panda/test/parser/ets/launch_with_call_expression-expected.txt index d5c7850550..2e69814082 100644 --- a/ets2panda/test/parser/ets/launch_with_call_expression-expected.txt +++ b/ets2panda/test/parser/ets/launch_with_call_expression-expected.txt @@ -408,7 +408,7 @@ "loc": { "start": { "line": 21, - "column": 1 + "column": 5 }, "end": { "line": 21, diff --git a/ets2panda/test/parser/ets/null-expected.txt b/ets2panda/test/parser/ets/null-expected.txt index d50eba3d37..f8d95b5469 100644 --- a/ets2panda/test/parser/ets/null-expected.txt +++ b/ets2panda/test/parser/ets/null-expected.txt @@ -255,11 +255,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 27 + "column": 26 } } }, @@ -352,7 +352,7 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, @@ -508,7 +508,7 @@ }, "end": { "line": 18, - "column": 19 + "column": 26 } } }, @@ -585,7 +585,7 @@ }, "end": { "line": 19, - "column": 14 + "column": 25 } } }, diff --git a/ets2panda/test/parser/ets/null_invalid-expected.txt b/ets2panda/test/parser/ets/null_invalid-expected.txt index 8084118420..991dd59ae5 100644 --- a/ets2panda/test/parser/ets/null_invalid-expected.txt +++ b/ets2panda/test/parser/ets/null_invalid-expected.txt @@ -119,11 +119,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 20 + "column": 19 } } } @@ -297,7 +297,7 @@ }, "end": { "line": 17, - "column": 17 + "column": 19 } } } diff --git a/ets2panda/test/parser/ets/null_valid-expected.txt b/ets2panda/test/parser/ets/null_valid-expected.txt index d5877df6bd..b1e599b104 100644 --- a/ets2panda/test/parser/ets/null_valid-expected.txt +++ b/ets2panda/test/parser/ets/null_valid-expected.txt @@ -119,11 +119,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 27 + "column": 26 } } } @@ -325,7 +325,7 @@ }, "end": { "line": 17, - "column": 22 + "column": 26 } } } diff --git a/ets2panda/test/parser/ets/object-expected.txt b/ets2panda/test/parser/ets/object-expected.txt index 9f1511caa9..caf59e7c60 100644 --- a/ets2panda/test/parser/ets/object-expected.txt +++ b/ets2panda/test/parser/ets/object-expected.txt @@ -189,7 +189,7 @@ }, "end": { "line": 16, - "column": 15 + "column": 6 } } } diff --git a/ets2panda/test/parser/ets/optional-chaining-array-expected.txt b/ets2panda/test/parser/ets/optional-chaining-array-expected.txt index 9fc7887951..9a02f3f966 100644 --- a/ets2panda/test/parser/ets/optional-chaining-array-expected.txt +++ b/ets2panda/test/parser/ets/optional-chaining-array-expected.txt @@ -161,11 +161,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 35 + "column": 34 } } }, @@ -275,11 +275,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 34 + "column": 33 } } }, @@ -389,11 +389,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 39 + "column": 38 } } } @@ -530,7 +530,7 @@ }, "end": { "line": 16, - "column": 17 + "column": 34 } } }, @@ -728,7 +728,7 @@ }, "end": { "line": 19, - "column": 21 + "column": 9 } } }, diff --git a/ets2panda/test/parser/ets/optional_chaining_invalid_property-expected.txt b/ets2panda/test/parser/ets/optional_chaining_invalid_property-expected.txt index 2c046490ec..c357cbf4de 100644 --- a/ets2panda/test/parser/ets/optional_chaining_invalid_property-expected.txt +++ b/ets2panda/test/parser/ets/optional_chaining_invalid_property-expected.txt @@ -456,7 +456,7 @@ "loc": { "start": { "line": 22, - "column": 1 + "column": 5 }, "end": { "line": 24, @@ -543,11 +543,11 @@ "loc": { "start": { "line": 26, - "column": 1 + "column": 5 }, "end": { "line": 26, - "column": 30 + "column": 29 } } } @@ -670,8 +670,8 @@ "column": 5 }, "end": { - "line": 22, - "column": 15 + "line": 24, + "column": 2 } } }, diff --git a/ets2panda/test/parser/ets/optional_chaining_nested_property-expected.txt b/ets2panda/test/parser/ets/optional_chaining_nested_property-expected.txt index 1e67c713bc..120efe8f89 100644 --- a/ets2panda/test/parser/ets/optional_chaining_nested_property-expected.txt +++ b/ets2panda/test/parser/ets/optional_chaining_nested_property-expected.txt @@ -533,7 +533,7 @@ "loc": { "start": { "line": 23, - "column": 1 + "column": 5 }, "end": { "line": 25, @@ -650,11 +650,11 @@ "loc": { "start": { "line": 27, - "column": 1 + "column": 5 }, "end": { "line": 27, - "column": 42 + "column": 41 } } } @@ -777,8 +777,8 @@ "column": 5 }, "end": { - "line": 23, - "column": 15 + "line": 25, + "column": 2 } } }, diff --git a/ets2panda/test/parser/ets/optional_chaining_object_property-expected.txt b/ets2panda/test/parser/ets/optional_chaining_object_property-expected.txt index 3e7ff288e9..c97274831d 100644 --- a/ets2panda/test/parser/ets/optional_chaining_object_property-expected.txt +++ b/ets2panda/test/parser/ets/optional_chaining_object_property-expected.txt @@ -456,7 +456,7 @@ "loc": { "start": { "line": 22, - "column": 1 + "column": 5 }, "end": { "line": 24, @@ -571,11 +571,11 @@ "loc": { "start": { "line": 26, - "column": 1 + "column": 5 }, "end": { "line": 26, - "column": 33 + "column": 32 } } }, @@ -686,11 +686,11 @@ "loc": { "start": { "line": 27, - "column": 1 + "column": 5 }, "end": { "line": 27, - "column": 36 + "column": 35 } } } @@ -813,8 +813,8 @@ "column": 5 }, "end": { - "line": 22, - "column": 15 + "line": 24, + "column": 2 } } }, @@ -972,7 +972,7 @@ }, "end": { "line": 27, - "column": 18 + "column": 35 } } } diff --git a/ets2panda/test/parser/ets/optional_union_paramter-expected.txt b/ets2panda/test/parser/ets/optional_union_paramter-expected.txt index adab9def3e..22c62beb9b 100644 --- a/ets2panda/test/parser/ets/optional_union_paramter-expected.txt +++ b/ets2panda/test/parser/ets/optional_union_paramter-expected.txt @@ -1244,7 +1244,7 @@ "loc": { "start": { "line": 21, - "column": 15 + "column": 14 }, "end": { "line": 23, @@ -1255,7 +1255,7 @@ "loc": { "start": { "line": 21, - "column": 15 + "column": 14 }, "end": { "line": 23, diff --git a/ets2panda/test/parser/ets/parentheses_expression_value-expected.txt b/ets2panda/test/parser/ets/parentheses_expression_value-expected.txt index 32bc14b3a4..38eb06e701 100644 --- a/ets2panda/test/parser/ets/parentheses_expression_value-expected.txt +++ b/ets2panda/test/parser/ets/parentheses_expression_value-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 11 + "column": 10 } } }, @@ -174,11 +174,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 13 + "column": 12 } } }, @@ -230,11 +230,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 15 + "column": 14 } } }, @@ -287,11 +287,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 13 + "column": 12 } } } diff --git a/ets2panda/test/parser/ets/predefined_types-expected.txt b/ets2panda/test/parser/ets/predefined_types-expected.txt index 1917db3b88..630c603172 100644 --- a/ets2panda/test/parser/ets/predefined_types-expected.txt +++ b/ets2panda/test/parser/ets/predefined_types-expected.txt @@ -161,7 +161,7 @@ }, "end": { "line": 17, - "column": 12 + "column": 6 } } }, @@ -210,7 +210,7 @@ }, "end": { "line": 18, - "column": 13 + "column": 6 } } }, @@ -259,7 +259,7 @@ }, "end": { "line": 19, - "column": 11 + "column": 6 } } }, @@ -308,7 +308,7 @@ }, "end": { "line": 20, - "column": 12 + "column": 6 } } }, @@ -357,7 +357,7 @@ }, "end": { "line": 22, - "column": 13 + "column": 6 } } }, @@ -406,7 +406,7 @@ }, "end": { "line": 23, - "column": 14 + "column": 6 } } }, @@ -455,7 +455,7 @@ }, "end": { "line": 25, - "column": 12 + "column": 6 } } } diff --git a/ets2panda/test/parser/ets/re_export/folder/re_export_6-expected.txt b/ets2panda/test/parser/ets/re_export/folder/re_export_6-expected.txt index 3120da76ac..20dda9a192 100644 --- a/ets2panda/test/parser/ets/re_export/folder/re_export_6-expected.txt +++ b/ets2panda/test/parser/ets/re_export/folder/re_export_6-expected.txt @@ -1,6 +1,76 @@ { "type": "Program", "statements": [ + { + "type": "ETSReExportDeclaration", + "ets_import_declarations": { + "type": "ImportDeclaration", + "source": { + "type": "StringLiteral", + "value": "./export", + "loc": { + "start": { + "line": 16, + "column": 15 + }, + "end": { + "line": 16, + "column": 25 + } + } + }, + "specifiers": [ + { + "type": "ImportNamespaceSpecifier", + "local": { + "type": "Identifier", + "name": "", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 14 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 25 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, { "type": "ClassDeclaration", "definition": { diff --git a/ets2panda/test/parser/ets/re_export/folder/re_export_7-expected.txt b/ets2panda/test/parser/ets/re_export/folder/re_export_7-expected.txt index 3120da76ac..06cdf82860 100644 --- a/ets2panda/test/parser/ets/re_export/folder/re_export_7-expected.txt +++ b/ets2panda/test/parser/ets/re_export/folder/re_export_7-expected.txt @@ -1,6 +1,76 @@ { "type": "Program", "statements": [ + { + "type": "ETSReExportDeclaration", + "ets_import_declarations": { + "type": "ImportDeclaration", + "source": { + "type": "StringLiteral", + "value": "./folder2/export", + "loc": { + "start": { + "line": 16, + "column": 15 + }, + "end": { + "line": 16, + "column": 33 + } + } + }, + "specifiers": [ + { + "type": "ImportNamespaceSpecifier", + "local": { + "type": "Identifier", + "name": "", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 14 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 33 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, { "type": "ClassDeclaration", "definition": { diff --git a/ets2panda/test/parser/ets/re_export/folderIndex/index-expected.txt b/ets2panda/test/parser/ets/re_export/folderIndex/index-expected.txt index 3120da76ac..45e1126c1a 100644 --- a/ets2panda/test/parser/ets/re_export/folderIndex/index-expected.txt +++ b/ets2panda/test/parser/ets/re_export/folderIndex/index-expected.txt @@ -1,6 +1,91 @@ { "type": "Program", "statements": [ + { + "type": "ETSReExportDeclaration", + "ets_import_declarations": { + "type": "ImportDeclaration", + "source": { + "type": "StringLiteral", + "value": "./test", + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 26 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "ad", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 11 + } + } + }, + "imported": { + "type": "Identifier", + "name": "ad", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 11 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 11 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 27 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, { "type": "ClassDeclaration", "definition": { diff --git a/ets2panda/test/parser/ets/re_export/re_export-expected.txt b/ets2panda/test/parser/ets/re_export/re_export-expected.txt index 3120da76ac..20dda9a192 100644 --- a/ets2panda/test/parser/ets/re_export/re_export-expected.txt +++ b/ets2panda/test/parser/ets/re_export/re_export-expected.txt @@ -1,6 +1,76 @@ { "type": "Program", "statements": [ + { + "type": "ETSReExportDeclaration", + "ets_import_declarations": { + "type": "ImportDeclaration", + "source": { + "type": "StringLiteral", + "value": "./export", + "loc": { + "start": { + "line": 16, + "column": 15 + }, + "end": { + "line": 16, + "column": 25 + } + } + }, + "specifiers": [ + { + "type": "ImportNamespaceSpecifier", + "local": { + "type": "Identifier", + "name": "", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 14 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 25 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, { "type": "ClassDeclaration", "definition": { diff --git a/ets2panda/test/parser/ets/re_export/re_export_2-expected.txt b/ets2panda/test/parser/ets/re_export/re_export_2-expected.txt index 3120da76ac..2dd3ed4c2f 100644 --- a/ets2panda/test/parser/ets/re_export/re_export_2-expected.txt +++ b/ets2panda/test/parser/ets/re_export/re_export_2-expected.txt @@ -1,6 +1,91 @@ { "type": "Program", "statements": [ + { + "type": "ETSReExportDeclaration", + "ets_import_declarations": { + "type": "ImportDeclaration", + "source": { + "type": "StringLiteral", + "value": "./export", + "loc": { + "start": { + "line": 16, + "column": 26 + }, + "end": { + "line": 16, + "column": 36 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "FOO", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 16, + "column": 19 + } + } + }, + "imported": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 19 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 36 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, { "type": "ClassDeclaration", "definition": { diff --git a/ets2panda/test/parser/ets/re_export/re_export_3-expected.txt b/ets2panda/test/parser/ets/re_export/re_export_3-expected.txt index 3120da76ac..94176ba582 100644 --- a/ets2panda/test/parser/ets/re_export/re_export_3-expected.txt +++ b/ets2panda/test/parser/ets/re_export/re_export_3-expected.txt @@ -1,6 +1,91 @@ { "type": "Program", "statements": [ + { + "type": "ETSReExportDeclaration", + "ets_import_declarations": { + "type": "ImportDeclaration", + "source": { + "type": "StringLiteral", + "value": "./export", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "imported": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 12 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, { "type": "ClassDeclaration", "definition": { diff --git a/ets2panda/test/parser/ets/re_export/re_export_4-expected.txt b/ets2panda/test/parser/ets/re_export/re_export_4-expected.txt index 5d09166882..be7ffc30da 100644 --- a/ets2panda/test/parser/ets/re_export/re_export_4-expected.txt +++ b/ets2panda/test/parser/ets/re_export/re_export_4-expected.txt @@ -1,6 +1,176 @@ { "type": "Program", "statements": [ + { + "type": "ETSReExportDeclaration", + "ets_import_declarations": { + "type": "ImportDeclaration", + "source": { + "type": "StringLiteral", + "value": "./export", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "imported": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 12 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "ETSReExportDeclaration", + "ets_import_declarations": { + "type": "ImportDeclaration", + "source": { + "type": "StringLiteral", + "value": "./export_2", + "loc": { + "start": { + "line": 17, + "column": 19 + }, + "end": { + "line": 17, + "column": 31 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 12 + } + } + }, + "imported": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 12 + } + } + }, + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 12 + } + } + } + ], + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 31 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, { "type": "ClassDeclaration", "definition": { diff --git a/ets2panda/test/parser/ets/re_export/re_export_5-expected.txt b/ets2panda/test/parser/ets/re_export/re_export_5-expected.txt index 5d09166882..147bdc8a24 100644 --- a/ets2panda/test/parser/ets/re_export/re_export_5-expected.txt +++ b/ets2panda/test/parser/ets/re_export/re_export_5-expected.txt @@ -1,6 +1,146 @@ { "type": "Program", "statements": [ + { + "type": "ETSReExportDeclaration", + "ets_import_declarations": { + "type": "ImportDeclaration", + "source": { + "type": "StringLiteral", + "value": "./export", + "loc": { + "start": { + "line": 16, + "column": 15 + }, + "end": { + "line": 16, + "column": 25 + } + } + }, + "specifiers": [ + { + "type": "ImportNamespaceSpecifier", + "local": { + "type": "Identifier", + "name": "", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 14 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 25 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "ETSReExportDeclaration", + "ets_import_declarations": { + "type": "ImportDeclaration", + "source": { + "type": "StringLiteral", + "value": "./export_2", + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 27 + } + } + }, + "specifiers": [ + { + "type": "ImportNamespaceSpecifier", + "local": { + "type": "Identifier", + "name": "", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 14 + } + } + } + ], + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 27 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, { "type": "ClassDeclaration", "definition": { diff --git a/ets2panda/test/parser/ets/rest_parameter_01-expected.txt b/ets2panda/test/parser/ets/rest_parameter_01-expected.txt index 19a0a0e6e6..537df9b4b0 100644 --- a/ets2panda/test/parser/ets/rest_parameter_01-expected.txt +++ b/ets2panda/test/parser/ets/rest_parameter_01-expected.txt @@ -302,7 +302,7 @@ "loc": { "start": { "line": 16, - "column": 14 + "column": 13 }, "end": { "line": 18, @@ -313,7 +313,7 @@ "loc": { "start": { "line": 16, - "column": 14 + "column": 13 }, "end": { "line": 18, @@ -534,7 +534,7 @@ "loc": { "start": { "line": 20, - "column": 14 + "column": 13 }, "end": { "line": 22, @@ -545,7 +545,7 @@ "loc": { "start": { "line": 20, - "column": 14 + "column": 13 }, "end": { "line": 22, diff --git a/ets2panda/test/parser/ets/rest_parameter_02-expected.txt b/ets2panda/test/parser/ets/rest_parameter_02-expected.txt index 126625750a..1514ec4748 100644 --- a/ets2panda/test/parser/ets/rest_parameter_02-expected.txt +++ b/ets2panda/test/parser/ets/rest_parameter_02-expected.txt @@ -328,7 +328,7 @@ "loc": { "start": { "line": 16, - "column": 14 + "column": 13 }, "end": { "line": 18, @@ -339,7 +339,7 @@ "loc": { "start": { "line": 16, - "column": 14 + "column": 13 }, "end": { "line": 18, @@ -575,7 +575,7 @@ "loc": { "start": { "line": 20, - "column": 14 + "column": 13 }, "end": { "line": 22, @@ -586,7 +586,7 @@ "loc": { "start": { "line": 20, - "column": 14 + "column": 13 }, "end": { "line": 22, diff --git a/ets2panda/test/parser/ets/rest_parameter_03-expected.txt b/ets2panda/test/parser/ets/rest_parameter_03-expected.txt index bf94e31aa1..1799a3c9a3 100644 --- a/ets2panda/test/parser/ets/rest_parameter_03-expected.txt +++ b/ets2panda/test/parser/ets/rest_parameter_03-expected.txt @@ -1 +1 @@ -SyntaxError: Both optional and rest parameters are not allowed in function's parameter list. [rest_parameter_03.ets:16:14] +SyntaxError: Both optional and rest parameters are not allowed in function's parameter list. [rest_parameter_03.ets:16:13] diff --git a/ets2panda/test/parser/ets/return-expected.txt b/ets2panda/test/parser/ets/return-expected.txt index ee83fa8590..45f9c493e3 100644 --- a/ets2panda/test/parser/ets/return-expected.txt +++ b/ets2panda/test/parser/ets/return-expected.txt @@ -161,11 +161,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 26 + "column": 25 } } } @@ -274,7 +274,7 @@ }, "end": { "line": 16, - "column": 15 + "column": 25 } } }, diff --git a/ets2panda/test/parser/ets/selective_export/selective_export_bad-expected.txt b/ets2panda/test/parser/ets/selective_export/selective_export_bad-expected.txt index dc09c9ecd8..840f7dbccf 100644 --- a/ets2panda/test/parser/ets/selective_export/selective_export_bad-expected.txt +++ b/ets2panda/test/parser/ets/selective_export/selective_export_bad-expected.txt @@ -1 +1 @@ -SyntaxError: Cannot find name 'foo' to export. [selective_export_bad.ets:16:8] +SyntaxError: Cannot find name 'foo' to export. [selective_export_bad.ets:16:10] diff --git a/ets2panda/test/parser/ets/simple_types-expected.txt b/ets2panda/test/parser/ets/simple_types-expected.txt index b75839eeb2..ce0e4dda7f 100644 --- a/ets2panda/test/parser/ets/simple_types-expected.txt +++ b/ets2panda/test/parser/ets/simple_types-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 19 + "column": 18 } } }, @@ -189,11 +189,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 23 + "column": 22 } } }, @@ -245,11 +245,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 25 + "column": 24 } } }, @@ -316,11 +316,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 36 + "column": 35 } } }, @@ -372,11 +372,11 @@ "loc": { "start": { "line": 21, - "column": 1 + "column": 5 }, "end": { "line": 21, - "column": 23 + "column": 22 } } }, @@ -428,11 +428,11 @@ "loc": { "start": { "line": 22, - "column": 1 + "column": 5 }, "end": { "line": 22, - "column": 20 + "column": 19 } } }, @@ -484,11 +484,11 @@ "loc": { "start": { "line": 26, - "column": 1 + "column": 5 }, "end": { "line": 26, - "column": 23 + "column": 22 } } }, @@ -540,11 +540,11 @@ "loc": { "start": { "line": 27, - "column": 1 + "column": 5 }, "end": { "line": 27, - "column": 24 + "column": 23 } } }, @@ -597,11 +597,11 @@ "loc": { "start": { "line": 29, - "column": 1 + "column": 5 }, "end": { "line": 29, - "column": 17 + "column": 16 } } } @@ -697,7 +697,7 @@ }, "end": { "line": 16, - "column": 12 + "column": 18 } } }, @@ -746,7 +746,7 @@ }, "end": { "line": 17, - "column": 13 + "column": 22 } } }, @@ -795,7 +795,7 @@ }, "end": { "line": 18, - "column": 11 + "column": 24 } } }, @@ -844,7 +844,7 @@ }, "end": { "line": 19, - "column": 12 + "column": 35 } } }, @@ -893,7 +893,7 @@ }, "end": { "line": 21, - "column": 15 + "column": 22 } } }, @@ -942,7 +942,7 @@ }, "end": { "line": 22, - "column": 12 + "column": 19 } } }, @@ -1019,7 +1019,7 @@ }, "end": { "line": 24, - "column": 13 + "column": 6 } } }, @@ -1068,7 +1068,7 @@ }, "end": { "line": 26, - "column": 13 + "column": 22 } } }, @@ -1117,7 +1117,7 @@ }, "end": { "line": 27, - "column": 14 + "column": 23 } } }, @@ -1166,7 +1166,7 @@ }, "end": { "line": 29, - "column": 12 + "column": 16 } } } diff --git a/ets2panda/test/parser/ets/string-expected.txt b/ets2panda/test/parser/ets/string-expected.txt index 657641c244..38083df2f9 100644 --- a/ets2panda/test/parser/ets/string-expected.txt +++ b/ets2panda/test/parser/ets/string-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 25 + "column": 24 } } }, @@ -174,11 +174,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 25 + "column": 24 } } } @@ -302,7 +302,7 @@ }, "end": { "line": 16, - "column": 16 + "column": 24 } } }, @@ -379,7 +379,7 @@ }, "end": { "line": 17, - "column": 16 + "column": 24 } } } diff --git a/ets2panda/test/parser/ets/ternary-expected.txt b/ets2panda/test/parser/ets/ternary-expected.txt index b80d1cd97c..f74401a8ee 100644 --- a/ets2panda/test/parser/ets/ternary-expected.txt +++ b/ets2panda/test/parser/ets/ternary-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 11 + "column": 10 } } }, @@ -174,11 +174,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 11 + "column": 10 } } }, @@ -303,11 +303,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 23 + "column": 22 } } } diff --git a/ets2panda/test/parser/ets/test_jsvalue-expected.txt b/ets2panda/test/parser/ets/test_jsvalue-expected.txt index f172336108..ee9b4367bf 100644 --- a/ets2panda/test/parser/ets/test_jsvalue-expected.txt +++ b/ets2panda/test/parser/ets/test_jsvalue-expected.txt @@ -189,7 +189,7 @@ }, "end": { "line": 16, - "column": 16 + "column": 6 } } } diff --git a/ets2panda/test/parser/ets/test_jsvalue_get_double-expected.txt b/ets2panda/test/parser/ets/test_jsvalue_get_double-expected.txt index 59de21d316..e95785906d 100644 --- a/ets2panda/test/parser/ets/test_jsvalue_get_double-expected.txt +++ b/ets2panda/test/parser/ets/test_jsvalue_get_double-expected.txt @@ -119,11 +119,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 23 + "column": 22 } } } @@ -247,7 +247,7 @@ }, "end": { "line": 16, - "column": 16 + "column": 6 } } }, @@ -296,7 +296,7 @@ }, "end": { "line": 17, - "column": 18 + "column": 22 } } } diff --git a/ets2panda/test/parser/ets/test_jsvalue_get_property_1-expected.txt b/ets2panda/test/parser/ets/test_jsvalue_get_property_1-expected.txt index dfd10c05a7..73bf02b622 100644 --- a/ets2panda/test/parser/ets/test_jsvalue_get_property_1-expected.txt +++ b/ets2panda/test/parser/ets/test_jsvalue_get_property_1-expected.txt @@ -149,11 +149,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 33 + "column": 32 } } } @@ -277,7 +277,7 @@ }, "end": { "line": 16, - "column": 16 + "column": 6 } } }, @@ -354,7 +354,7 @@ }, "end": { "line": 17, - "column": 20 + "column": 32 } } } diff --git a/ets2panda/test/parser/ets/test_jsvalue_get_property_2-expected.txt b/ets2panda/test/parser/ets/test_jsvalue_get_property_2-expected.txt index b19aae6384..69a2a714c4 100644 --- a/ets2panda/test/parser/ets/test_jsvalue_get_property_2-expected.txt +++ b/ets2panda/test/parser/ets/test_jsvalue_get_property_2-expected.txt @@ -179,11 +179,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 47 + "column": 46 } } } @@ -307,7 +307,7 @@ }, "end": { "line": 16, - "column": 16 + "column": 6 } } }, @@ -384,7 +384,7 @@ }, "end": { "line": 17, - "column": 20 + "column": 46 } } } diff --git a/ets2panda/test/parser/ets/test_type_alias9-expected.txt b/ets2panda/test/parser/ets/test_type_alias9-expected.txt index 20df64b662..f71a0b03d7 100644 --- a/ets2panda/test/parser/ets/test_type_alias9-expected.txt +++ b/ets2panda/test/parser/ets/test_type_alias9-expected.txt @@ -226,11 +226,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 17 + "column": 16 } } }, @@ -397,11 +397,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 52 + "column": 51 } } } @@ -525,7 +525,7 @@ }, "end": { "line": 19, - "column": 13 + "column": 16 } } }, @@ -602,7 +602,7 @@ }, "end": { "line": 20, - "column": 16 + "column": 51 } } } diff --git a/ets2panda/test/parser/ets/throwsRethrowsAsVariables-expected.txt b/ets2panda/test/parser/ets/throwsRethrowsAsVariables-expected.txt index 203a0147ad..f0c71fd715 100644 --- a/ets2panda/test/parser/ets/throwsRethrowsAsVariables-expected.txt +++ b/ets2panda/test/parser/ets/throwsRethrowsAsVariables-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 16 + "column": 15 } } }, @@ -174,11 +174,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 18 + "column": 17 } } } diff --git a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_mismatch_lambda_signature-expected.txt b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_mismatch_lambda_signature-expected.txt index fba13eb71c..f3e0754f7f 100644 --- a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_mismatch_lambda_signature-expected.txt +++ b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_mismatch_lambda_signature-expected.txt @@ -118,7 +118,7 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, diff --git a/ets2panda/test/parser/ets/tuple_type_1-expected.txt b/ets2panda/test/parser/ets/tuple_type_1-expected.txt index 101d5111ac..bca78f1e0e 100644 --- a/ets2panda/test/parser/ets/tuple_type_1-expected.txt +++ b/ets2panda/test/parser/ets/tuple_type_1-expected.txt @@ -359,11 +359,11 @@ "loc": { "start": { "line": 22, - "column": 1 + "column": 5 }, "end": { "line": 22, - "column": 34 + "column": 33 } } }, @@ -470,11 +470,11 @@ "loc": { "start": { "line": 23, - "column": 1 + "column": 5 }, "end": { "line": 23, - "column": 44 + "column": 43 } } }, @@ -569,11 +569,11 @@ "loc": { "start": { "line": 24, - "column": 1 + "column": 5 }, "end": { "line": 24, - "column": 50 + "column": 49 } } }, @@ -625,11 +625,11 @@ "loc": { "start": { "line": 25, - "column": 1 + "column": 5 }, "end": { "line": 25, - "column": 16 + "column": 15 } } }, @@ -710,11 +710,11 @@ "loc": { "start": { "line": 26, - "column": 1 + "column": 5 }, "end": { "line": 26, - "column": 42 + "column": 41 } } }, @@ -809,11 +809,11 @@ "loc": { "start": { "line": 27, - "column": 1 + "column": 5 }, "end": { "line": 27, - "column": 50 + "column": 49 } } } @@ -1342,7 +1342,7 @@ }, "end": { "line": 22, - "column": 26 + "column": 33 } } }, @@ -1476,7 +1476,7 @@ }, "end": { "line": 23, - "column": 26 + "column": 43 } } }, @@ -1663,7 +1663,7 @@ }, "end": { "line": 24, - "column": 39 + "column": 49 } } }, @@ -1713,7 +1713,7 @@ }, "end": { "line": 25, - "column": 12 + "column": 15 } } }, @@ -1847,7 +1847,7 @@ }, "end": { "line": 26, - "column": 34 + "column": 41 } } }, @@ -1994,7 +1994,7 @@ }, "end": { "line": 27, - "column": 39 + "column": 49 } } } diff --git a/ets2panda/test/parser/ets/unary_op-expected.txt b/ets2panda/test/parser/ets/unary_op-expected.txt index 9a9d965671..32aa0ba97d 100644 --- a/ets2panda/test/parser/ets/unary_op-expected.txt +++ b/ets2panda/test/parser/ets/unary_op-expected.txt @@ -118,11 +118,11 @@ "loc": { "start": { "line": 16, - "column": 1 + "column": 5 }, "end": { "line": 16, - "column": 11 + "column": 10 } } }, @@ -190,11 +190,11 @@ "loc": { "start": { "line": 17, - "column": 1 + "column": 5 }, "end": { "line": 17, - "column": 13 + "column": 12 } } }, @@ -262,11 +262,11 @@ "loc": { "start": { "line": 18, - "column": 1 + "column": 5 }, "end": { "line": 18, - "column": 13 + "column": 12 } } }, @@ -333,11 +333,11 @@ "loc": { "start": { "line": 19, - "column": 1 + "column": 5 }, "end": { "line": 19, - "column": 12 + "column": 11 } } }, @@ -405,11 +405,11 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 20, - "column": 12 + "column": 11 } } }, @@ -477,11 +477,11 @@ "loc": { "start": { "line": 21, - "column": 1 + "column": 5 }, "end": { "line": 21, - "column": 12 + "column": 11 } } }, @@ -533,11 +533,11 @@ "loc": { "start": { "line": 22, - "column": 1 + "column": 5 }, "end": { "line": 22, - "column": 14 + "column": 13 } } }, @@ -605,11 +605,11 @@ "loc": { "start": { "line": 23, - "column": 1 + "column": 5 }, "end": { "line": 23, - "column": 12 + "column": 11 } } }, @@ -677,11 +677,11 @@ "loc": { "start": { "line": 25, - "column": 1 + "column": 5 }, "end": { "line": 25, - "column": 12 + "column": 11 } } } diff --git a/ets2panda/test/parser/ets/user_defined_22-expected.txt b/ets2panda/test/parser/ets/user_defined_22-expected.txt index 6b33f24143..f61d047d2f 100644 --- a/ets2panda/test/parser/ets/user_defined_22-expected.txt +++ b/ets2panda/test/parser/ets/user_defined_22-expected.txt @@ -456,7 +456,7 @@ "loc": { "start": { "line": 20, - "column": 1 + "column": 5 }, "end": { "line": 21, @@ -570,7 +570,7 @@ "loc": { "start": { "line": 22, - "column": 1 + "column": 5 }, "end": { "line": 22, @@ -789,7 +789,7 @@ }, "end": { "line": 22, - "column": 11 + "column": 14 } } } diff --git a/ets2panda/test/parser/ets/user_defined_3-expected.txt b/ets2panda/test/parser/ets/user_defined_3-expected.txt index 18603423f6..4ed6dec988 100644 --- a/ets2panda/test/parser/ets/user_defined_3-expected.txt +++ b/ets2panda/test/parser/ets/user_defined_3-expected.txt @@ -161,7 +161,7 @@ }, "end": { "line": 16, - "column": 22 + "column": 14 } } }, @@ -210,7 +210,7 @@ }, "end": { "line": 17, - "column": 26 + "column": 16 } } }, @@ -259,7 +259,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 15 } } }, @@ -308,7 +308,7 @@ }, "end": { "line": 19, - "column": 20 + "column": 13 } } }, @@ -357,7 +357,7 @@ }, "end": { "line": 20, - "column": 22 + "column": 14 } } }, @@ -406,7 +406,7 @@ }, "end": { "line": 21, - "column": 18 + "column": 12 } } }, @@ -455,7 +455,7 @@ }, "end": { "line": 22, - "column": 20 + "column": 13 } } }, @@ -504,7 +504,7 @@ }, "end": { "line": 23, - "column": 20 + "column": 13 } } }, diff --git a/ets2panda/test/unit/public/es2panda_public_test.cpp b/ets2panda/test/unit/public/es2panda_public_test.cpp index 2987e79dc3..545928c077 100644 --- a/ets2panda/test/unit/public/es2panda_public_test.cpp +++ b/ets2panda/test/unit/public/es2panda_public_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 @@ -94,9 +94,8 @@ function main() { impl_->AstNodeForEach(impl_->ProgramAst(impl_->ContextProgram(ctx)), func, &arg); - std::vector expected {"C", "n", "string", "constructor", "constructor", "ETSGLOBAL", - "_$init$_", "_$init$_", "main", "main", "c", "C", - "console", "log", "c", "n", ""}; + std::vector expected {"C", "n", "string", "constructor", "constructor", "main", + "c", "C", "console", "log", "c", "n"}; ASSERT_EQ(arg.ids, expected); impl_->DestroyContext(ctx); diff --git a/ets2panda/test/unit/public/plugin_test.expected.txt b/ets2panda/test/unit/public/plugin_test.expected.txt index f578824e84..b1a9b406b0 100644 --- a/ets2panda/test/unit/public/plugin_test.expected.txt +++ b/ets2panda/test/unit/public/plugin_test.expected.txt @@ -1,9 +1,5 @@ Hi there! After parse -ETSGLOBAL -_$init$_ -_$init$_ -main main m n @@ -11,6 +7,5 @@ console log m n - After check After lowerings diff --git a/ets2panda/util/arktsconfig.cpp b/ets2panda/util/arktsconfig.cpp index a043b1b27e..f0bb657577 100644 --- a/ets2panda/util/arktsconfig.cpp +++ b/ets2panda/util/arktsconfig.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2023-2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 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 @@ -321,7 +321,7 @@ static std::string TrimPath(const std::string &path) return trimmedPath; } -std::string ArkTsConfig::ResolvePath(const std::string &path) +std::optional ArkTsConfig::ResolvePath(const std::string &path) const { for (const auto &[alias, paths] : paths_) { auto trimmedAlias = TrimPath(alias); @@ -334,7 +334,7 @@ std::string ArkTsConfig::ResolvePath(const std::string &path) return resolved; } } - return ""; + return std::nullopt; } #ifdef ARKTSCONFIG_USE_FILESYSTEM diff --git a/ets2panda/util/arktsconfig.h b/ets2panda/util/arktsconfig.h index 7df76fdfa3..0d8f4bdd18 100644 --- a/ets2panda/util/arktsconfig.h +++ b/ets2panda/util/arktsconfig.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2023-2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 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 @@ -80,7 +80,7 @@ public: explicit ArkTsConfig(std::string configPath) : configPath_(std::move(configPath)) {} bool Parse(); - std::string ResolvePath(const std::string &path); + std::optional ResolvePath(const std::string &path) const; std::string ConfigPath() const { diff --git a/ets2panda/util/errorHandler.cpp b/ets2panda/util/errorHandler.cpp new file mode 100644 index 0000000000..635c04cc75 --- /dev/null +++ b/ets2panda/util/errorHandler.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2023 - 2024 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. + */ + +#include "util/errorHandler.h" + +namespace ark::es2panda::util { + +void ErrorHandler::ThrowSyntaxError(std::string_view errorMessage, const lexer::SourcePosition &pos) const +{ + lexer::LineIndex index(program_->SourceCode()); + lexer::SourceLocation loc = index.GetLocation(pos); + + throw Error {ErrorType::SYNTAX, program_->SourceFilePath().Utf8(), errorMessage, loc.line, loc.col}; +} + +void ErrorHandler::ThrowSyntaxError(const parser::Program *program, std::string_view errorMessage, + const lexer::SourcePosition &pos) +{ + ErrorHandler(program).ThrowSyntaxError(errorMessage, pos); +} + +} // namespace ark::es2panda::util diff --git a/ets2panda/util/errorHandler.h b/ets2panda/util/errorHandler.h new file mode 100644 index 0000000000..a021dc294b --- /dev/null +++ b/ets2panda/util/errorHandler.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 - 2024 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. + */ + +#ifndef PANDA_ERRORHANDLER_H +#define PANDA_ERRORHANDLER_H + +#include +#include "parser/program/program.h" +#include "lexer/token/sourceLocation.h" + +namespace ark::es2panda::util { + +class ErrorHandler { +public: + explicit ErrorHandler(const parser::Program *program) : program_(program) {} + + [[noreturn]] void ThrowSyntaxError(std::string_view errorMessage, const lexer::SourcePosition &pos) const; + + [[noreturn]] static void ThrowSyntaxError(const parser::Program *program, std::string_view errorMessage, + const lexer::SourcePosition &pos); + +private: + const parser::Program *program_; +}; +} // namespace ark::es2panda::util + +#endif // PANDA_ERRORHANDLER_H diff --git a/ets2panda/util/helpers.cpp b/ets2panda/util/helpers.cpp index c068835dfe..8a22728336 100644 --- a/ets2panda/util/helpers.cpp +++ b/ets2panda/util/helpers.cpp @@ -522,20 +522,16 @@ std::vector Helpers::CollectBindingNames(ir::AstNode *node) return bindings; } -void Helpers::CheckImportedName(ArenaVector *specifiers, const ir::ImportSpecifier *specifier, - const std::string &fileName) +void Helpers::CheckImportedName(const ArenaVector &specifiers, + const ir::ImportSpecifier *specifier, const std::string &fileName) { auto newIdentName = specifier->Imported()->Name(); auto newAliasName = specifier->Local()->Name(); std::stringstream message {}; - for (auto *it : *specifiers) { - if (!it->IsImportSpecifier()) { - continue; - } - - auto savedIdentName = it->AsImportSpecifier()->Imported()->Name(); - auto savedAliasName = it->AsImportSpecifier()->Local()->Name(); + for (auto *it : specifiers) { + auto savedIdentName = it->Imported()->Name(); + auto savedAliasName = it->Local()->Name(); if (savedIdentName == savedAliasName && savedAliasName == newIdentName) { message << "Warning: '" << newIdentName << "' has already imported "; diff --git a/ets2panda/util/helpers.h b/ets2panda/util/helpers.h index 009bd08879..0c6342fa18 100644 --- a/ets2panda/util/helpers.h +++ b/ets2panda/util/helpers.h @@ -64,6 +64,40 @@ enum class LogLevel : std::uint8_t { INVALID, }; +class NodeAllocator { +public: + template + static T *NoSetParent(ArenaAllocator *alloc, Args &&...args) + { + return alloc->New(std::forward(args)...); + } + + template + static T *ForceSetParent(ArenaAllocator *alloc, Args &&...args) + { + auto *ret = NoSetParent(alloc, std::forward(args)...); + if (ret == nullptr) { + return nullptr; + } + ret->Iterate([ret](ir::AstNode *child) { child->SetParent(ret); }); + return ret; + } + + template + static T *Alloc(ArenaAllocator *alloc, Args &&...args) + { + auto *ret = NoSetParent(alloc, std::forward(args)...); + if (ret == nullptr) { + return nullptr; + } + ret->Iterate([ret](ir::AstNode *child) { + ASSERT(child->Parent() == nullptr); + child->SetParent(ret); + }); + return ret; + } +}; + class Helpers { public: Helpers() = delete; @@ -127,11 +161,18 @@ public: static bool IsPattern(const ir::AstNode *node); static std::vector CollectBindingNames(ir::AstNode *node); static util::StringView FunctionName(ArenaAllocator *allocator, const ir::ScriptFunction *func); - static void CheckImportedName(ArenaVector *specifiers, const ir::ImportSpecifier *specifier, - const std::string &fileName); + static void CheckImportedName(const ArenaVector &specifiers, + const ir::ImportSpecifier *specifier, const std::string &fileName); static std::tuple ParamName(ArenaAllocator *allocator, const ir::AstNode *param, uint32_t index); + template + static ArenaVector ConvertVector(const ArenaVector &src) + { + ArenaVector dst(src.begin(), src.end(), src.get_allocator()); + return dst; + } + template static bool IsTargetFitInSourceRange(Target target) { diff --git a/ets2panda/util/pathHandler.cpp b/ets2panda/util/pathHandler.cpp index 2b333d8a49..27b566e7c0 100644 --- a/ets2panda/util/pathHandler.cpp +++ b/ets2panda/util/pathHandler.cpp @@ -121,11 +121,8 @@ StringView PathHandler::AddPath(const StringView &callerPath, const StringView & return resolvedPath; } -void PathHandler::CollectDefaultSources() +void PathHandler::CollectDefaultSources(const std::vector &stdlib) { - std::vector stdlib = {"std/core", "std/math", "std/containers", "std/time", - "std/interop/js", "std/debug", "std/debug/concurrency", "escompat"}; - for (auto const &path : stdlib) { StringView callerPath = util::UString(allocator_).View(); StringView stdlibPath = ResolveSourcePath(callerPath, util::UString(path, allocator_).View()); @@ -150,16 +147,16 @@ void PathHandler::CollectDefaultSources() } } -std::vector PathHandler::GetParseList() const +ArenaVector PathHandler::GetParseList() const { - std::vector parseableSources; - for (const auto path : pathes_) { - if (!path.second.IsParsed() && !ark::os::file::File::IsDirectory(path.first.Mutf8())) { + ArenaVector parseableSources(allocator_->Adapter()); + for (const auto [path, info] : pathes_) { + if (!info.IsParsed() && !ark::os::file::File::IsDirectory(path.Mutf8())) { // NOTE(rsipka): it should be handled in a better way - if (path.second.IsObjectfile()) { - parseableSources.emplace(parseableSources.begin(), path.first.Mutf8()); + if (info.IsObjectfile()) { + parseableSources.emplace(parseableSources.begin(), path); } else { - parseableSources.emplace_back(path.first.Mutf8()); + parseableSources.emplace_back(path); } } } @@ -259,12 +256,12 @@ StringView PathHandler::ResolveSourcePath(const StringView &callerPath, const St } else { ASSERT(arktsConfig_ != nullptr); auto resolvedPath = arktsConfig_->ResolvePath(path.Mutf8()); - if (resolvedPath.empty()) { + if (!resolvedPath) { throw Error(ErrorType::GENERIC, "", "Can't find prefix for '" + path.Mutf8() + "' in " + arktsConfig_->ConfigPath()); } - return AppendExtension(util::UString(resolvedPath, allocator_).View()); + return AppendExtension(util::UString(resolvedPath.value(), allocator_).View()); } if (containsDelim) { @@ -275,5 +272,12 @@ StringView PathHandler::ResolveSourcePath(const StringView &callerPath, const St return util::UString(baseUrl, allocator_).View(); } +std::vector &PathHandler::StdLib() +{ + static std::vector stdlib {"std/core", "std/math", "std/containers", "std/time", + "std/interop/js", "std/debug", "std/debug/concurrency", "escompat"}; + return stdlib; +} + } // namespace ark::es2panda::util #undef USE_UNIX_SYSCALL diff --git a/ets2panda/util/pathHandler.h b/ets2panda/util/pathHandler.h index 2325659e16..b850cc23e8 100644 --- a/ets2panda/util/pathHandler.h +++ b/ets2panda/util/pathHandler.h @@ -16,11 +16,15 @@ #ifndef ES2PANDA_UTIL_PATH_HANDLER_H #define ES2PANDA_UTIL_PATH_HANDLER_H -#include "util/arktsconfig.h" -#include "util/ustring.h" #include #include +#include "es2panda.h" +#include "parser/program/program.h" +#include "util/arktsconfig.h" +#include "util/ustring.h" +#include + namespace ark::es2panda::util { class ParseInfo { @@ -74,11 +78,51 @@ private: class PathHandler { public: + struct ImportData { + Language lang; + std::string module; + bool hasDecl; + }; + + static std::vector &StdLib(); + + ImportData GetImportData(util::StringView path, ScriptExtension extension) + { + const auto &dynamicPaths = arktsConfig_->DynamicPaths(); + auto key = ark::os::NormalizePath(path.Mutf8()); + + auto it = dynamicPaths.find(key); + if (it == dynamicPaths.cend()) { + key = ark::os::RemoveExtension(key); + } + + while (it == dynamicPaths.cend() && !key.empty()) { + it = dynamicPaths.find(key); + if (it != dynamicPaths.cend()) { + break; + } + key = ark::os::GetParentDir(key); + } + + if (it != dynamicPaths.cend()) { + return {it->second.GetLanguage(), key, it->second.HasDecl()}; + } + return {ToLanguage(extension), path.Mutf8(), true}; + } + + bool IsStdLib(const parser::Program *program) const + { + const auto &stdlib = StdLib(); + auto fileFolder = program->GetPackageName().Mutf8(); + std::replace(fileFolder.begin(), fileFolder.end(), '.', '/'); + return std::count(stdlib.begin(), stdlib.end(), fileFolder) != 0; + } + explicit PathHandler(ark::ArenaAllocator *allocator) : allocator_(allocator), pathes_(allocator->Adapter()) {} StringView AddPath(const StringView &callerPath, const StringView &path); - std::vector GetParseList() const; - void CollectDefaultSources(); + ArenaVector GetParseList() const; + void CollectDefaultSources(const std::vector &stdlib); void MarkAsParsed(const StringView &path) { diff --git a/ets2panda/varbinder/ETSBinder.cpp b/ets2panda/varbinder/ETSBinder.cpp index e927733cc3..9aa93b8edb 100644 --- a/ets2panda/varbinder/ETSBinder.cpp +++ b/ets2panda/varbinder/ETSBinder.cpp @@ -944,7 +944,7 @@ void ETSBinder::BuildImportDeclaration(ir::ETSImportDeclaration *decl) return; } - auto specifiers = decl->Specifiers(); + const auto &specifiers = decl->Specifiers(); for (auto specifier : specifiers) { AddSpecifiersToTopBindings(specifier, decl, decl->Source()); diff --git a/ets2panda/varbinder/ETSBinder.h b/ets2panda/varbinder/ETSBinder.h index 126c851d20..5ab6ba05cb 100644 --- a/ets2panda/varbinder/ETSBinder.h +++ b/ets2panda/varbinder/ETSBinder.h @@ -223,16 +223,6 @@ public: bool IsDynamicNamespaceVariable(const Variable *var) const; const DynamicImportData *DynamicImportDataForVar(const Variable *var) const; - static constexpr std::string_view DEFAULT_IMPORT_SOURCE_FILE = ".ets"; - static constexpr std::string_view DEFAULT_IMPORT_SOURCE = R"( -import * from "std/core"; -import * from "std/math"; -import * from "std/containers"; -import * from "std/time"; -import * from "std/interop/js"; -import * from "escompat"; -)"; - void ResolveReferenceForScope(ir::AstNode *node, Scope *scope); void ResolveReferencesForScope(ir::AstNode const *parent, Scope *scope); diff --git a/ets2panda/varbinder/varbinder.h b/ets2panda/varbinder/varbinder.h index e31c2df4d5..09451ba7ad 100644 --- a/ets2panda/varbinder/varbinder.h +++ b/ets2panda/varbinder/varbinder.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 - 2024 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 @@ -129,6 +129,11 @@ public: return varScope_; } + bool IsETSBinder() const + { + return Extension() == ScriptExtension::ETS; + } + ETSBinder *AsETSBinder() { ASSERT(Extension() == ScriptExtension::ETS); -- Gitee From ad3ab0a39e4f3b6b182c2b13ad2a7b0b48e657fa Mon Sep 17 00:00:00 2001 From: Tatiana Pivovarova Date: Fri, 1 Mar 2024 16:08:10 +0300 Subject: [PATCH 03/12] Update copyrights Signed-off-by: Tatiana Pivovarova --- ets2panda/ir/ets/etsReExportDeclaration.cpp | 2 +- ets2panda/lexer/lexer.h | 2 +- ets2panda/parser/TypedParser.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ets2panda/ir/ets/etsReExportDeclaration.cpp b/ets2panda/ir/ets/etsReExportDeclaration.cpp index ba34dce3b5..40d24158f6 100644 --- a/ets2panda/ir/ets/etsReExportDeclaration.cpp +++ b/ets2panda/ir/ets/etsReExportDeclaration.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 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 diff --git a/ets2panda/lexer/lexer.h b/ets2panda/lexer/lexer.h index 4dd897f26c..04236797cd 100644 --- a/ets2panda/lexer/lexer.h +++ b/ets2panda/lexer/lexer.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 diff --git a/ets2panda/parser/TypedParser.h b/ets2panda/parser/TypedParser.h index 30871a0f8b..988f1d8171 100644 --- a/ets2panda/parser/TypedParser.h +++ b/ets2panda/parser/TypedParser.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 -- Gitee From b562ce54bc5526099dc24e1f59c64c69558d9de9 Mon Sep 17 00:00:00 2001 From: Shimenkov Mikhail Date: Mon, 22 Jan 2024 20:05:10 +0300 Subject: [PATCH 04/12] Object literal lowering Moving object literal of class type implementation from CodeGen phase to separate lowering phase Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/I91MQZ Signed-off-by: Shimenkov Mikhail --- ets2panda/BUILD.gn | 1 + ets2panda/CMakeLists.txt | 1 + ets2panda/checker/ETSAnalyzer.cpp | 23 +- ets2panda/checker/SemanticAnalyzer.h | 1 + ets2panda/compiler/core/ASTCompiler.h | 3 +- ets2panda/compiler/core/ETSCompiler.cpp | 38 ++-- .../compiler/lowering/ets/expandBrackets.cpp | 8 +- .../compiler/lowering/ets/expandBrackets.h | 2 +- .../lowering/ets/objectLiteralLowering.cpp | 199 ++++++++++++++++++ .../lowering/ets/objectLiteralLowering.h | 32 +++ .../compiler/lowering/ets/opAssignment.cpp | 2 +- .../compiler/lowering/ets/recordLowering.cpp | 2 +- ets2panda/compiler/lowering/phase.cpp | 3 + .../lowering/scopesInit/scopesInitPhase.cpp | 7 + .../lowering/scopesInit/scopesInitPhase.h | 1 + .../ir/expressions/assignmentExpression.h | 9 + ets2panda/ir/expressions/blockExpression.cpp | 15 +- ets2panda/ir/expressions/blockExpression.h | 16 ++ ets2panda/ir/expressions/identifier.cpp | 1 - ets2panda/ir/expressions/identifier.h | 16 -- ets2panda/ir/expressions/memberExpression.h | 15 +- ets2panda/parser/TypedParser.cpp | 20 +- .../test/runtime/ets/objectLiteral-2.ets | 65 ++++++ ets2panda/varbinder/ETSBinder.cpp | 6 + ets2panda/varbinder/varbinder.cpp | 7 + 25 files changed, 418 insertions(+), 75 deletions(-) create mode 100644 ets2panda/compiler/lowering/ets/objectLiteralLowering.cpp create mode 100644 ets2panda/compiler/lowering/ets/objectLiteralLowering.h create mode 100644 ets2panda/test/runtime/ets/objectLiteral-2.ets diff --git a/ets2panda/BUILD.gn b/ets2panda/BUILD.gn index 74bd09ea1d..e05b00f040 100644 --- a/ets2panda/BUILD.gn +++ b/ets2panda/BUILD.gn @@ -166,6 +166,7 @@ libes2panda_sources = [ "compiler/lowering/ets/lambdaLowering.cpp", "compiler/lowering/ets/objectIndexAccess.cpp", "compiler/lowering/ets/objectIterator.cpp", + "compiler/lowering/ets/objectLiteralLowering.cpp", "compiler/lowering/ets/opAssignment.cpp", "compiler/lowering/ets/optionalLowering.cpp", "compiler/lowering/ets/promiseVoid.cpp", diff --git a/ets2panda/CMakeLists.txt b/ets2panda/CMakeLists.txt index 94c8943315..0d28088d95 100644 --- a/ets2panda/CMakeLists.txt +++ b/ets2panda/CMakeLists.txt @@ -169,6 +169,7 @@ set(ES2PANDA_LIB_SRC compiler/lowering/ets/promiseVoid.cpp compiler/lowering/ets/structLowering.cpp compiler/lowering/ets/defaultParameterLowering.cpp + compiler/lowering/ets/objectLiteralLowering.cpp ir/astDump.cpp ir/srcDump.cpp ir/astNode.cpp diff --git a/ets2panda/checker/ETSAnalyzer.cpp b/ets2panda/checker/ETSAnalyzer.cpp index 6920c69210..6d56ae949e 100644 --- a/ets2panda/checker/ETSAnalyzer.cpp +++ b/ets2panda/checker/ETSAnalyzer.cpp @@ -1023,8 +1023,20 @@ static checker::Signature *ResolveCallForETSExtensionFuncHelperType(checker::ETS checker::Type *ETSAnalyzer::Check(ir::BlockExpression *st) const { - (void)st; - UNREACHABLE(); + ETSChecker *checker = GetETSChecker(); + checker::ScopeContext scopeCtx(checker, st->Scope()); + + if (st->TsType() == nullptr) { + for (auto *const node : st->Statements()) { + node->Check(checker); + } + + auto lastStmt = st->Statements().back(); + ASSERT(lastStmt->IsExpressionStatement()); + st->SetTsType(lastStmt->AsExpressionStatement()->GetExpression()->TsType()); + } + + return st->TsType(); } ArenaVector GetUnionTypeSignatures(ETSChecker *checker, checker::ETSUnionType *etsUnionType) @@ -1438,8 +1450,9 @@ void ETSAnalyzer::CheckObjectExprProps(const ir::ObjectExpression *expr) const checker->ThrowTypeError({"key in class composite should be either identifier or string literal"}, expr->Start()); } - varbinder::LocalVariable *lv = objType->GetProperty(pname, checker::PropertySearchFlags::SEARCH_INSTANCE_FIELD | - checker::PropertySearchFlags::SEARCH_IN_BASE); + varbinder::LocalVariable *lv = objType->GetProperty( + pname, checker::PropertySearchFlags::SEARCH_INSTANCE_FIELD | checker::PropertySearchFlags::SEARCH_IN_BASE | + checker::PropertySearchFlags::SEARCH_INSTANCE_METHOD); if (lv == nullptr) { checker->ThrowTypeError({"type ", objType->Name(), " has no property named ", pname}, propExpr->Start()); } @@ -1473,7 +1486,7 @@ checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::OmittedExpression *expr) UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::OpaqueTypeNode *expr) const +checker::Type *ETSAnalyzer::Check(ir::OpaqueTypeNode *expr) const { return expr->TsType(); } diff --git a/ets2panda/checker/SemanticAnalyzer.h b/ets2panda/checker/SemanticAnalyzer.h index 4dd9b7b00f..271d26ff12 100644 --- a/ets2panda/checker/SemanticAnalyzer.h +++ b/ets2panda/checker/SemanticAnalyzer.h @@ -55,6 +55,7 @@ #include "ir/expressions/assignmentExpression.h" #include "ir/expressions/awaitExpression.h" #include "ir/expressions/binaryExpression.h" +#include "ir/expressions/blockExpression.h" #include "ir/expressions/callExpression.h" #include "ir/expressions/chainExpression.h" #include "ir/expressions/classExpression.h" diff --git a/ets2panda/compiler/core/ASTCompiler.h b/ets2panda/compiler/core/ASTCompiler.h index cfc7a034e5..e7673b5148 100644 --- a/ets2panda/compiler/core/ASTCompiler.h +++ b/ets2panda/compiler/core/ASTCompiler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 - 2023 Huawei Device Co., Ltd. + * Copyright (c) 2021 - 2024 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 @@ -55,6 +55,7 @@ #include "ir/expressions/assignmentExpression.h" #include "ir/expressions/awaitExpression.h" #include "ir/expressions/binaryExpression.h" +#include "ir/expressions/blockExpression.h" #include "ir/expressions/callExpression.h" #include "ir/expressions/chainExpression.h" #include "ir/expressions/classExpression.h" diff --git a/ets2panda/compiler/core/ETSCompiler.cpp b/ets2panda/compiler/core/ETSCompiler.cpp index 75cd902a53..1b75ae5caf 100644 --- a/ets2panda/compiler/core/ETSCompiler.cpp +++ b/ets2panda/compiler/core/ETSCompiler.cpp @@ -755,8 +755,10 @@ void ConvertArgumentsForFunctionalCall(checker::ETSChecker *const checker, const void ETSCompiler::Compile(const ir::BlockExpression *expr) const { - (void)expr; - UNREACHABLE(); + ETSGen *etsg = GetETSGen(); + compiler::LocalRegScope lrs(etsg, expr->Scope()); + + etsg->CompileStatements(expr->Statements()); } bool ETSCompiler::IsSucceedCompilationProxyMemberExpr(const ir::CallExpression *expr) const @@ -1153,28 +1155,18 @@ void ETSCompiler::Compile(const ir::ObjectExpression *expr) const { ETSGen *etsg = GetETSGen(); compiler::RegScope rs {etsg}; - checker::ETSObjectType const *objType = expr->TsType()->AsETSObjectType(); compiler::VReg objReg = etsg->AllocReg(); - if (expr->TsType()->IsETSDynamicType()) { - auto *signatureInfo = etsg->Allocator()->New(etsg->Allocator()); - auto *createObjSig = etsg->Allocator()->New( - signatureInfo, nullptr, compiler::Signatures::BUILTIN_JSRUNTIME_CREATE_OBJECT); - compiler::VReg dummyReg = compiler::VReg::RegStart(); - etsg->CallDynamic(expr, dummyReg, dummyReg, createObjSig, - ArenaVector(etsg->Allocator()->Adapter())); - } else { - checker::Signature *emptySig = nullptr; - for (checker::Signature *sig : objType->ConstructSignatures()) { - if (sig->Params().empty()) { - emptySig = sig; - break; - } - } - if (emptySig == nullptr) { // Would have already thrown in the checker. - UNREACHABLE(); - } - etsg->InitObject(expr, emptySig, ArenaVector(etsg->Allocator()->Adapter())); - } + + // NOTE: object expressions of dynamic type are not handled in objectLiteralLowering phase + ASSERT(expr->TsType()->IsETSDynamicType()); + + auto *signatureInfo = etsg->Allocator()->New(etsg->Allocator()); + auto *createObjSig = etsg->Allocator()->New( + signatureInfo, nullptr, compiler::Signatures::BUILTIN_JSRUNTIME_CREATE_OBJECT); + compiler::VReg dummyReg = compiler::VReg::RegStart(); + etsg->CallDynamic(expr, dummyReg, dummyReg, createObjSig, + ArenaVector(etsg->Allocator()->Adapter())); + etsg->SetAccumulatorType(expr->TsType()); etsg->StoreAccumulator(expr, objReg); diff --git a/ets2panda/compiler/lowering/ets/expandBrackets.cpp b/ets2panda/compiler/lowering/ets/expandBrackets.cpp index 14e621be80..4071200149 100644 --- a/ets2panda/compiler/lowering/ets/expandBrackets.cpp +++ b/ets2panda/compiler/lowering/ets/expandBrackets.cpp @@ -75,7 +75,7 @@ ir::Expression *ExpandBracketsPhase::ProcessNewArrayInstanceExpression( newInstanceExpression->SetTsType(nullptr); InitScopesPhaseETS::RunExternalNode(blockExpression, checker->VarBinder()); - checker->VarBinder()->AsETSBinder()->ResolveReferencesForScope(blockExpression, scope); + checker->VarBinder()->AsETSBinder()->ResolveReferencesForScope(blockExpression, NearestScope(blockExpression)); blockExpression->Check(checker); return blockExpression; @@ -136,7 +136,7 @@ ir::Expression *ExpandBracketsPhase::ProcessNewMultiDimArrayInstanceExpression( } if (returnExpression != nullptr) { - return CreateNewMultiDimArrayInstanceExpression(checker, newInstanceExpression, returnExpression, scope); + return CreateNewMultiDimArrayInstanceExpression(checker, newInstanceExpression, returnExpression); } return newInstanceExpression; @@ -145,14 +145,14 @@ ir::Expression *ExpandBracketsPhase::ProcessNewMultiDimArrayInstanceExpression( // NOTE: Just to reduce the size of 'ProcessNewMultiDimArrayInstanceExpression' method ir::Expression *ExpandBracketsPhase::CreateNewMultiDimArrayInstanceExpression( checker::ETSChecker *checker, ir::ETSNewMultiDimArrayInstanceExpression *newInstanceExpression, - ir::BlockExpression *blockExpression, varbinder::Scope *scope) const + ir::BlockExpression *blockExpression) const { blockExpression->SetParent(newInstanceExpression->Parent()); newInstanceExpression->SetTsType(nullptr); blockExpression->AddStatement(checker->AllocNode(newInstanceExpression)); InitScopesPhaseETS::RunExternalNode(blockExpression, checker->VarBinder()); - checker->VarBinder()->AsETSBinder()->ResolveReferencesForScope(blockExpression, scope); + checker->VarBinder()->AsETSBinder()->ResolveReferencesForScope(blockExpression, NearestScope(blockExpression)); blockExpression->Check(checker); return blockExpression; diff --git a/ets2panda/compiler/lowering/ets/expandBrackets.h b/ets2panda/compiler/lowering/ets/expandBrackets.h index 23f536a56f..672e6a5115 100644 --- a/ets2panda/compiler/lowering/ets/expandBrackets.h +++ b/ets2panda/compiler/lowering/ets/expandBrackets.h @@ -39,7 +39,7 @@ private: ir::Expression *CreateNewMultiDimArrayInstanceExpression( checker::ETSChecker *checker, ir::ETSNewMultiDimArrayInstanceExpression *newInstanceExpression, - ir::BlockExpression *blockExpression, varbinder::Scope *scope) const; + ir::BlockExpression *blockExpression) const; }; } // namespace ark::es2panda::compiler diff --git a/ets2panda/compiler/lowering/ets/objectLiteralLowering.cpp b/ets2panda/compiler/lowering/ets/objectLiteralLowering.cpp new file mode 100644 index 0000000000..07f6c9f7cf --- /dev/null +++ b/ets2panda/compiler/lowering/ets/objectLiteralLowering.cpp @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2024 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. + */ + +#include "objectLiteralLowering.h" + +#include "checker/ETSchecker.h" +#include "compiler/lowering/scopesInit/scopesInitPhase.h" +#include "compiler/lowering/util.h" + +namespace ark::es2panda::compiler { + +std::string_view ObjectLiteralLowering::Name() const +{ + return "ObjectLiteralLowering"; +} + +static constexpr std::string_view NESTED_BLOCK_EXPRESSION = "_$NESTED_BLOCK_EXPRESSION$_"; + +static void RestoreNestedBlockExpression(const ArenaVector &statements, + std::deque &nestedBlckExprs, varbinder::Scope *scope) +{ + if (!nestedBlckExprs.empty()) { + for (auto stmt : statements) { + if (!stmt->IsExpressionStatement() || + !stmt->AsExpressionStatement()->GetExpression()->IsAssignmentExpression()) { + continue; + } + + auto *assign = stmt->AsExpressionStatement()->GetExpression()->AsAssignmentExpression(); + + if (assign->Right()->IsStringLiteral() && + assign->Right()->AsStringLiteral()->Str().Is(NESTED_BLOCK_EXPRESSION)) { + auto nestedBlckExpr = nestedBlckExprs.front(); + nestedBlckExprs.pop_front(); + nestedBlckExpr->Scope()->SetParent(scope); + assign->SetRight(nestedBlckExpr); + } + } + // All nested block expressions should be restored + ASSERT(nestedBlckExprs.empty()); + } +} + +static void GenerateNewStatements(checker::ETSChecker *checker, ir::ObjectExpression *objExpr, std::stringstream &ss, + std::vector &newStmts, + std::deque &nestedBlckExprs) +{ + auto *const allocator = checker->Allocator(); + + auto *const classType = objExpr->PreferredType()->AsETSObjectType(); + + auto addNode = [&newStmts](ir::AstNode *node) -> int { + newStmts.emplace_back(node); + return newStmts.size(); + }; + + // Generating: let : = new (); + auto *genSymIdent = Gensym(allocator); + auto *preferredType = checker->AllocNode(classType); + ss << "let @@I" << addNode(genSymIdent) << ": @@T" << addNode(preferredType) << " = new @@I" + << addNode(checker->AllocNode(classType->Name(), allocator)); + + // Type params of class type + if (!classType->TypeArguments().empty()) { + ss << "<"; + for (auto *type : classType->TypeArguments()) { + type->ToString(ss); + ss << ","; + } + ss << ">"; + } + ss << "();" << std::endl; + + // Generating: .key_i = value_i ( i <= [0, object_literal.properties.size) ) + for (auto *propExpr : objExpr->Properties()) { + ASSERT(propExpr->IsProperty()); + auto *prop = propExpr->AsProperty(); + ir::Expression *key = prop->Key(); + ir::Expression *value = prop->Value(); + + ir::Identifier *keyIdent = key->IsStringLiteral() + ? checker->AllocNode(key->AsStringLiteral()->Str(), allocator) + : key->AsIdentifier(); + + ss << "@@I" << addNode(genSymIdent->Clone(allocator, nullptr)) << ".@@I" << addNode(keyIdent); + + if (value->IsBlockExpression()) { + // Case of nested object literal (all nested object literals has already been processed) + // Corresponding nested block expressions should be stored somewhere and restored after ScopesPhase + // Because it has already processed them + // Predefined String Literal acts as placeholder + ss << " = \"" << NESTED_BLOCK_EXPRESSION << "\";" << std::endl; + nestedBlckExprs.emplace_back(value->AsBlockExpression()); + } else { + ss << " = @@E" << addNode(value) << ";" << std::endl; + } + } + + ss << "(@@I" << addNode(genSymIdent->Clone(allocator, nullptr)) << ");" << std::endl; +} + +static ir::AstNode *HandleObjectLiteralLowering(public_lib::Context *ctx, ir::ObjectExpression *objExpr) +{ + /* + * For given object literal of class type generates following block expression: + * + * ({ + * let : = new (); + * .key_i = value_i ( i <= [0, object_literal.properties.size) ) + * ; <-- NOTE: result of block expression + * }) + */ + + if (objExpr->PreferredType() == nullptr) { + return objExpr; + } + + auto *const checker = ctx->checker->AsETSChecker(); + auto *const parser = ctx->parser->AsETSParser(); + auto *const varbinder = ctx->compilerContext->VarBinder()->AsETSBinder(); + + std::stringstream ss; + // Double-ended queue for storing nested block expressions that have already been processed earlier + std::deque nestedBlckExprs; + std::vector newStmts; + + GenerateNewStatements(checker, objExpr, ss, newStmts, nestedBlckExprs); + + auto *loweringResult = parser->CreateFormattedExpression(ss.str(), newStmts, parser::DEFAULT_SOURCE_FILE); + loweringResult->SetParent(objExpr->Parent()); + + auto scopeCtx = varbinder::LexicalScope::Enter(varbinder, NearestScope(objExpr)); + InitScopesPhaseETS::RunExternalNode(loweringResult, varbinder); + + // Restoring nested block expressions + RestoreNestedBlockExpression(loweringResult->AsBlockExpression()->Statements(), nestedBlckExprs, + loweringResult->Scope()); + + varbinder->ResolveReferencesForScope(loweringResult, NearestScope(loweringResult)); + + checker::SavedCheckerContext scc {checker, checker::CheckerStatus::IGNORE_VISIBILITY}; + loweringResult->Check(checker); + + return loweringResult; +} + +bool ObjectLiteralLowering::Perform(public_lib::Context *ctx, parser::Program *program) +{ + for (auto &[_, extPrograms] : program->ExternalSources()) { + (void)_; + for (auto *extProg : extPrograms) { + Perform(ctx, extProg); + } + } + + program->Ast()->TransformChildrenRecursively([ctx](ir::AstNode *ast) -> ir::AstNode * { + // Skip processing dynamic objects + if (ast->IsObjectExpression() && !ast->AsObjectExpression()->PreferredType()->AsETSObjectType()->HasObjectFlag( + checker::ETSObjectFlags::DYNAMIC)) { + return HandleObjectLiteralLowering(ctx, ast->AsObjectExpression()); + } + return ast; + }); + + return true; +} + +bool ObjectLiteralLowering::Postcondition(public_lib::Context *ctx, const parser::Program *program) +{ + for (auto &[_, extPrograms] : program->ExternalSources()) { + (void)_; + for (auto *extProg : extPrograms) { + if (!Postcondition(ctx, extProg)) { + return false; + } + } + } + + // In all object literal contexts (except dynamic) a substitution should take place + return !program->Ast()->IsAnyChild([](const ir::AstNode *ast) -> bool { + return ast->IsObjectExpression() && + !ast->AsObjectExpression()->PreferredType()->AsETSObjectType()->HasObjectFlag( + checker::ETSObjectFlags::DYNAMIC); + }); +} + +} // namespace ark::es2panda::compiler diff --git a/ets2panda/compiler/lowering/ets/objectLiteralLowering.h b/ets2panda/compiler/lowering/ets/objectLiteralLowering.h new file mode 100644 index 0000000000..1661d47e2c --- /dev/null +++ b/ets2panda/compiler/lowering/ets/objectLiteralLowering.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 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. + */ + +#ifndef ES2PANDA_COMPILER_LOWERING_OBJECT_LITERAL_H +#define ES2PANDA_COMPILER_LOWERING_OBJECT_LITERAL_H + +#include "compiler/lowering/phase.h" + +namespace ark::es2panda::compiler { + +class ObjectLiteralLowering : public Phase { +public: + std::string_view Name() const override; + bool Perform(public_lib::Context *ctx, parser::Program *program) override; + bool Postcondition(public_lib::Context *ctx, const parser::Program *program) override; +}; + +} // namespace ark::es2panda::compiler + +#endif diff --git a/ets2panda/compiler/lowering/ets/opAssignment.cpp b/ets2panda/compiler/lowering/ets/opAssignment.cpp index 7bb87bb0b5..3425d45010 100644 --- a/ets2panda/compiler/lowering/ets/opAssignment.cpp +++ b/ets2panda/compiler/lowering/ets/opAssignment.cpp @@ -200,7 +200,7 @@ ir::Expression *HandleOpAssignment(public_lib::Context *ctx, checker::ETSChecker loweringResult->SetParent(assignment->Parent()); InitScopesPhaseETS::RunExternalNode(loweringResult, ctx->compilerContext->VarBinder()); - checker->VarBinder()->AsETSBinder()->ResolveReferencesForScope(loweringResult, scope); + checker->VarBinder()->AsETSBinder()->ResolveReferencesForScope(loweringResult, NearestScope(loweringResult)); loweringResult->Check(checker); AdjustBoxingUnboxingFlags(loweringResult, assignment); diff --git a/ets2panda/compiler/lowering/ets/recordLowering.cpp b/ets2panda/compiler/lowering/ets/recordLowering.cpp index 651fca74c0..b6f287dbb0 100644 --- a/ets2panda/compiler/lowering/ets/recordLowering.cpp +++ b/ets2panda/compiler/lowering/ets/recordLowering.cpp @@ -146,7 +146,7 @@ ir::Expression *RecordLowering::UpdateObjectExpression(ir::ObjectExpression *exp // Run checks InitScopesPhaseETS::RunExternalNode(block, ctx->compilerContext->VarBinder()); - checker->VarBinder()->AsETSBinder()->ResolveReferencesForScope(block, scope); + checker->VarBinder()->AsETSBinder()->ResolveReferencesForScope(block, NearestScope(block)); block->Check(checker); // Replace Object Expression with Block Expression diff --git a/ets2panda/compiler/lowering/phase.cpp b/ets2panda/compiler/lowering/phase.cpp index 2055acf5c9..347bb56933 100644 --- a/ets2panda/compiler/lowering/phase.cpp +++ b/ets2panda/compiler/lowering/phase.cpp @@ -27,6 +27,7 @@ #include "compiler/lowering/ets/objectIndexAccess.h" #include "compiler/lowering/ets/objectIterator.h" #include "compiler/lowering/ets/opAssignment.h" +#include "compiler/lowering/ets/objectLiteralLowering.h" #include "compiler/lowering/ets/optionalLowering.h" #include "compiler/lowering/ets/promiseVoid.h" #include "compiler/lowering/ets/structLowering.h" @@ -58,6 +59,7 @@ static LambdaConstructionPhase g_lambdaConstructionPhase; static OpAssignmentLowering g_opAssignmentLowering; static ObjectIndexLowering g_objectIndexLowering; static ObjectIteratorLowering g_objectIteratorLowering; +static ObjectLiteralLowering g_objectLiteralLowering; static TupleLowering g_tupleLowering; // Can be only applied after checking phase, and OP_ASSIGNMENT_LOWERING phase static UnionLowering g_unionLowering; static OptionalLowering g_optionalLowering; @@ -101,6 +103,7 @@ std::vector GetETSPhaseList() &g_tupleLowering, &g_unionLowering, &g_expandBracketsPhase, + &g_objectLiteralLowering, &g_pluginsAfterLowerings, }; } diff --git a/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.cpp b/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.cpp index d140930812..45ed555119 100644 --- a/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.cpp +++ b/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.cpp @@ -696,6 +696,13 @@ void InitScopesPhaseETS::BindVarDecl(ir::Identifier *binding, ir::Expression *in decl->BindNode(init); } +void InitScopesPhaseETS::VisitBlockExpression(ir::BlockExpression *blockExpr) +{ + auto localCtx = varbinder::LexicalScope(VarBinder()); + BindScopeNode(GetScope(), blockExpr); + Iterate(blockExpr); +} + void InitScopesPhaseETS::VisitClassStaticBlock(ir::ClassStaticBlock *staticBlock) { const auto func = staticBlock->Function(); diff --git a/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.h b/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.h index b7705dbc18..35674b53dc 100644 --- a/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.h +++ b/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.h @@ -333,6 +333,7 @@ private: void DeclareClassMethod(ir::MethodDefinition *method); void VisitClassStaticBlock(ir::ClassStaticBlock *staticBlock) override; + void VisitBlockExpression(ir::BlockExpression *blockExpr) override; void VisitImportNamespaceSpecifier(ir::ImportNamespaceSpecifier *importSpec) override; void VisitImportSpecifier([[maybe_unused]] ir::ImportSpecifier *importSpec) override {}; void VisitImportDefaultSpecifier([[maybe_unused]] ir::ImportDefaultSpecifier *importSpec) override {}; diff --git a/ets2panda/ir/expressions/assignmentExpression.h b/ets2panda/ir/expressions/assignmentExpression.h index 0fdd049d7f..1f8a61e0cb 100644 --- a/ets2panda/ir/expressions/assignmentExpression.h +++ b/ets2panda/ir/expressions/assignmentExpression.h @@ -70,6 +70,15 @@ public: return right_; } + void SetRight(Expression *const expr) noexcept + { + right_ = expr; + + if (right_ != nullptr) { + right_->SetParent(this); + } + } + [[nodiscard]] const Expression *Result() const noexcept { return result_; diff --git a/ets2panda/ir/expressions/blockExpression.cpp b/ets2panda/ir/expressions/blockExpression.cpp index 0ee58651c7..4734244604 100644 --- a/ets2panda/ir/expressions/blockExpression.cpp +++ b/ets2panda/ir/expressions/blockExpression.cpp @@ -72,12 +72,14 @@ void BlockExpression::Dump(ir::AstDumper *dumper) const void BlockExpression::Dump(ir::SrcDumper *dumper) const { + dumper->Add("({"); for (auto *statement : statements_) { statement->Dump(dumper); if (statement != statements_.back()) { dumper->Endl(); } } + dumper->Add("})"); } void BlockExpression::Compile([[maybe_unused]] compiler::PandaGen *pg) const @@ -87,9 +89,7 @@ void BlockExpression::Compile([[maybe_unused]] compiler::PandaGen *pg) const void BlockExpression::Compile(compiler::ETSGen *etsg) const { - for (auto const *const node : statements_) { - node->Compile(etsg); - } + etsg->GetAstCompiler()->Compile(this); } checker::Type *BlockExpression::Check([[maybe_unused]] checker::TSChecker *checker) @@ -99,13 +99,6 @@ checker::Type *BlockExpression::Check([[maybe_unused]] checker::TSChecker *check checker::Type *BlockExpression::Check(checker::ETSChecker *checker) { - if (TsType() == nullptr) { - for (auto *const node : statements_) { - if (auto *const exprType = node->Check(checker); exprType != nullptr) { - SetTsType(exprType); - } - } - } - return TsType(); + return checker->GetAnalyzer()->Check(this); } } // namespace ark::es2panda::ir diff --git a/ets2panda/ir/expressions/blockExpression.h b/ets2panda/ir/expressions/blockExpression.h index 56f74c100f..05430c809a 100644 --- a/ets2panda/ir/expressions/blockExpression.h +++ b/ets2panda/ir/expressions/blockExpression.h @@ -63,6 +63,21 @@ public: [[nodiscard]] BlockExpression *Clone(ArenaAllocator *allocator, AstNode *parent) override; + bool IsScopeBearer() const noexcept override + { + return true; + } + + varbinder::Scope *Scope() const noexcept override + { + return scope_; + } + + void SetScope(varbinder::Scope *scope) + { + scope_ = scope; + } + void TransformChildren(const NodeTransformer &cb) override; void Iterate(const NodeTraverser &cb) const override; void Dump(ir::AstDumper *dumper) const override; @@ -78,6 +93,7 @@ public: } private: + varbinder::Scope *scope_ = {}; ArenaVector statements_; }; } // namespace ark::es2panda::ir diff --git a/ets2panda/ir/expressions/identifier.cpp b/ets2panda/ir/expressions/identifier.cpp index cf25361ac4..17c05b9580 100644 --- a/ets2panda/ir/expressions/identifier.cpp +++ b/ets2panda/ir/expressions/identifier.cpp @@ -28,7 +28,6 @@ Identifier::Identifier([[maybe_unused]] Tag const tag, Identifier const &other, { name_ = other.name_; flags_ = other.flags_; - variable_ = other.variable_; for (auto *decorator : other.decorators_) { decorators_.emplace_back(decorator->Clone(allocator, this)); diff --git a/ets2panda/ir/expressions/identifier.h b/ets2panda/ir/expressions/identifier.h index 005d471dcb..8a35310ae9 100644 --- a/ets2panda/ir/expressions/identifier.h +++ b/ets2panda/ir/expressions/identifier.h @@ -170,21 +170,6 @@ public: flags_ |= IdentifierFlags::IGNORE_BOX; } - [[nodiscard]] varbinder::Variable *Variable() const noexcept - { - return variable_; - } - - void SetVariable(varbinder::Variable *const variable) noexcept - { - variable_ = variable; - } - - [[nodiscard]] varbinder::Variable *Variable() noexcept - { - return variable_; - } - void AddDecorators([[maybe_unused]] ArenaVector &&decorators) override { decorators_ = std::move(decorators); @@ -217,7 +202,6 @@ private: util::StringView name_; IdentifierFlags flags_ {IdentifierFlags::NONE}; ArenaVector decorators_; - varbinder::Variable *variable_ {}; }; } // namespace ark::es2panda::ir diff --git a/ets2panda/ir/expressions/memberExpression.h b/ets2panda/ir/expressions/memberExpression.h index 9d5da48de7..7fae0d0ab5 100644 --- a/ets2panda/ir/expressions/memberExpression.h +++ b/ets2panda/ir/expressions/memberExpression.h @@ -102,12 +102,18 @@ public: [[nodiscard]] varbinder::LocalVariable *PropVar() noexcept { - return propVar_; + if (Kind() == MemberExpressionKind::ELEMENT_ACCESS) { + return nullptr; + } + return Property()->Variable() != nullptr ? Property()->Variable()->AsLocalVariable() : nullptr; } [[nodiscard]] const varbinder::LocalVariable *PropVar() const noexcept { - return propVar_; + if (Kind() == MemberExpressionKind::ELEMENT_ACCESS) { + return nullptr; + } + return Property()->Variable() != nullptr ? Property()->Variable()->AsLocalVariable() : nullptr; } [[nodiscard]] bool IsComputed() const noexcept @@ -142,7 +148,8 @@ public: void SetPropVar(varbinder::LocalVariable *propVar) noexcept { - propVar_ = propVar; + ASSERT(Property()); + Property()->SetVariable(propVar); } void SetObjectType(checker::ETSObjectType *objType) noexcept @@ -192,7 +199,6 @@ protected: kind_ = other.kind_; computed_ = other.computed_; ignoreBox_ = other.ignoreBox_; - propVar_ = other.propVar_; // Note! Probably, we need to do 'Instantiate(...)' but we haven't access to 'Relation()' here... uncheckedType_ = other.uncheckedType_; objType_ = other.objType_; @@ -221,7 +227,6 @@ private: bool computed_; bool ignoreBox_ {false}; checker::Type *uncheckedType_ {}; - varbinder::LocalVariable *propVar_ {}; checker::ETSObjectType *objType_ {}; }; } // namespace ark::es2panda::ir diff --git a/ets2panda/parser/TypedParser.cpp b/ets2panda/parser/TypedParser.cpp index 28c41b96c3..53a6e12372 100644 --- a/ets2panda/parser/TypedParser.cpp +++ b/ets2panda/parser/TypedParser.cpp @@ -1123,15 +1123,23 @@ ir::ModifierFlags TypedParser::ParseModifiers() ir::Expression *TypedParser::ParseQualifiedName(ExpressionParseFlags flags) { - if (Lexer()->GetToken().Type() != lexer::TokenType::LITERAL_IDENT) { - ThrowSyntaxError("Identifier expected"); + ir::Expression *expr = nullptr; + + switch (Lexer()->GetToken().Type()) { + case lexer::TokenType::PUNCTUATOR_FORMAT: + expr = ParseIdentifierFormatPlaceholder(); + break; + case lexer::TokenType::LITERAL_IDENT: + expr = AllocNode(Lexer()->GetToken().Ident(), Allocator()); + expr->SetRange(Lexer()->GetToken().Loc()); + Lexer()->NextToken(); + break; + default: + ThrowSyntaxError("Identifier expected"); + break; } - ir::Expression *expr = AllocNode(Lexer()->GetToken().Ident(), Allocator()); expr->AsIdentifier()->SetReference(); - expr->SetRange(Lexer()->GetToken().Loc()); - - Lexer()->NextToken(); if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_PERIOD) { expr = ParseQualifiedReference(expr, flags); diff --git a/ets2panda/test/runtime/ets/objectLiteral-2.ets b/ets2panda/test/runtime/ets/objectLiteral-2.ets new file mode 100644 index 0000000000..b9e3ff8321 --- /dev/null +++ b/ets2panda/test/runtime/ets/objectLiteral-2.ets @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2024 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 InnerValue { + private _v: int = 0 + get v(): int { return this._v; } + set v(v: int){ this._v = v; } +} + +class C { + private _x: int = 0 + get x(): int { return this._x; } + set x(x: int){ this._x = x; } + + private _iv: InnerValue = {v: 0} + get iv(): InnerValue { return this._iv; } + set iv(iv:InnerValue){ this._iv = iv; } +} + +function returnC(): C { + return {x: 99, iv: {v: 77}} // return statement +} + +function test(c: C = {}, x: int = 0, ivv: int = 0) { + assert c.x == x : "c.x != x" + assert c.iv.v == ivv : "c.iv.v != ivv" +} + +function main(): int { + let c: C = {"x": 7, iv: {v: 8}}; // variable definition + test(c, 7, 8) + + test() // optional parameter + + let c2 = { // as construction + x: 4, + iv: {v: 5} + } as C; + test(c2, 4, 5) + + c = {x: 5, iv: {v: 6}} // assignment + test(c, 5, 6) + + test({ // function argument + x: 3, + }, 3, 0) + + test(returnC(), 99, 77) + + let ca: C[] = [{x: 42, iv: {v: 1}}, {x: 128, iv: {v: 2}}] // array elements + test(ca[1], 128, 2) + return 0; +} diff --git a/ets2panda/varbinder/ETSBinder.cpp b/ets2panda/varbinder/ETSBinder.cpp index 9aa93b8edb..fd3317e7bb 100644 --- a/ets2panda/varbinder/ETSBinder.cpp +++ b/ets2panda/varbinder/ETSBinder.cpp @@ -15,6 +15,7 @@ #include "ETSBinder.h" +#include "ir/expressions/blockExpression.h" #include "ir/expressions/identifier.h" #include "ir/expressions/thisExpression.h" #include "ir/expressions/typeofExpression.h" @@ -164,6 +165,11 @@ void ETSBinder::ResolveReferenceForScope(ir::AstNode *const node, Scope *const s break; } */ + case ir::AstNodeType::BLOCK_EXPRESSION: { + auto scopeCtx = LexicalScope::Enter(this, node->AsBlockExpression()->Scope()); + ResolveReferences(node); + break; + } default: { ResolveReferencesForScope(node, scope); break; diff --git a/ets2panda/varbinder/varbinder.cpp b/ets2panda/varbinder/varbinder.cpp index 43809bd4f5..8ed80e1a9f 100644 --- a/ets2panda/varbinder/varbinder.cpp +++ b/ets2panda/varbinder/varbinder.cpp @@ -33,6 +33,7 @@ #include "ir/base/spreadElement.h" #include "ir/expressions/arrayExpression.h" #include "ir/expressions/assignmentExpression.h" +#include "ir/expressions/blockExpression.h" #include "ir/expressions/memberExpression.h" #include "ir/expressions/identifier.h" #include "ir/expressions/objectExpression.h" @@ -570,6 +571,12 @@ void VarBinder::ResolveReference(ir::AstNode *childNode) ResolveReferences(childNode); break; } + case ir::AstNodeType::BLOCK_EXPRESSION: { + auto scopeCtx = LexicalScope::Enter(this, childNode->AsBlockExpression()->Scope()); + + ResolveReferences(childNode); + break; + } case ir::AstNodeType::SWITCH_STATEMENT: { auto scopeCtx = LexicalScope::Enter(this, childNode->AsSwitchStatement()->Scope()); -- Gitee From b7f665dad6250d2035cb50c5f326054a638fe7a1 Mon Sep 17 00:00:00 2001 From: Robert Sipka Date: Tue, 19 Dec 2023 17:02:57 +0100 Subject: [PATCH 05/12] Revert the implementation of the builtin void type Change-Id: I155b9235c324f419e830c3c030c02df262072575 Signed-off-by: Gergo Torok Signed-off-by: Robert Sipka --- ets2panda/checker/ETSAnalyzer.cpp | 29 +- ets2panda/checker/ETSchecker.cpp | 8 +- ets2panda/checker/ETSchecker.h | 13 +- ets2panda/checker/ets/aliveAnalyzer.cpp | 6 +- ets2panda/checker/ets/dynamic.cpp | 2 +- ets2panda/checker/ets/function.cpp | 112 ++-- ets2panda/checker/ets/helpers.cpp | 8 +- ets2panda/checker/ets/typeCreation.cpp | 2 - ets2panda/checker/ets/typeRelationContext.cpp | 5 + ets2panda/checker/types/ets/etsVoidType.cpp | 11 +- ets2panda/checker/types/ets/etsVoidType.h | 1 + ets2panda/checker/types/globalTypesHolder.cpp | 6 - ets2panda/checker/types/globalTypesHolder.h | 2 - ets2panda/checker/types/typeFlag.h | 2 +- ets2panda/compiler/core/ETSCompiler.cpp | 40 +- ets2panda/compiler/core/ETSGen.cpp | 21 +- ets2panda/compiler/core/ETSGen.h | 21 +- ets2panda/compiler/core/ETSfunction.cpp | 122 ++-- ets2panda/compiler/core/ETSfunction.h | 5 +- ets2panda/compiler/core/dynamicContext.cpp | 95 +-- ets2panda/compiler/core/dynamicContext.h | 3 +- .../compiler/lowering/ets/lambdaLowering.cpp | 12 +- .../compiler/lowering/ets/promiseVoid.cpp | 11 +- ets2panda/compiler/scripts/signatures.yaml | 71 ++- ets2panda/ir/ets/etsPrimitiveType.cpp | 4 + ets2panda/ir/ets/etsTypeReferencePart.cpp | 15 +- ets2panda/lexer/scripts/keywords.yaml | 1 + ets2panda/lexer/token/token.cpp | 3 +- ets2panda/parser/ETSparser.cpp | 7 + .../compiler/ets/FunctionType1-expected.txt | 66 +- .../compiler/ets/FunctionType2-expected.txt | 64 +- .../compiler/ets/FunctionType3-expected.txt | 100 +-- .../compiler/ets/FunctionType4-expected.txt | 32 +- .../compiler/ets/FunctionType6-expected.txt | 32 +- .../compiler/ets/FunctionType7-expected.txt | 64 +- .../compiler/ets/FunctionType8-expected.txt | 164 +---- .../compiler/ets/FunctionType9-expected.txt | 98 +-- .../compiler/ets/StructTest1-expected.txt | 32 +- .../compiler/ets/StructTest2-expected.txt | 32 +- ...ctMethodDeclaredInParentClass-expected.txt | 296 +-------- ...actNewClassInstanceExpression-expected.txt | 64 +- .../ets/arrowFunctionCapture-expected.txt | 130 +--- .../ets/boxingConversion1-expected.txt | 32 +- .../ets/boxingConversion2-expected.txt | 32 +- .../ets/boxingConversion3-expected.txt | 64 +- .../ets/boxingConversion4-expected.txt | 64 +- .../boxingUnboxingExpressions-expected.txt | 576 ++--------------- .../ets/catch-soft-keyword-expected.txt | 64 +- .../compiler/ets/catchParamScope-expected.txt | 130 +--- .../ets/conversion-w-ASExpr-expected.txt | 32 +- ...rsion_Double-to-Int_typeerror-expected.txt | 32 +- ...le-to-Int_w_try_stmt_typerror-expected.txt | 32 +- ...rsion_Int-to-Double_typeerror-expected.txt | 32 +- ...ntext_Int-to-Double_typeerror-expected.txt | 32 +- .../ets/conversion_w_functions-expected.txt | 32 +- ...rsion_w_functions_w_try-stmts-expected.txt | 32 +- .../ets/enum_as_type_alias-expected.txt | 32 +- .../test/compiler/ets/forUpdate-expected.txt | 32 +- .../ets/forUpdateCharType-expected.txt | 32 +- .../for_of_missing_iterator_type-expected.txt | 64 +- .../ets/from-soft-keyword-0-expected.txt | 64 +- .../ets/from-soft-keyword-1-expected.txt | 98 +-- .../ets/from-soft-keyword-2-expected.txt | 32 +- .../ets/from-soft-keyword-3-expected.txt | 32 +- .../ets/functionPointerArray-expected.txt | 98 +-- .../ets/functionTypeToObject-expected.txt | 68 +- .../ets/function_subtyping_1-expected.txt | 32 +- .../ets/function_subtyping_2-expected.txt | 32 +- .../ets/function_subtyping_3-expected.txt | 32 +- .../ets/generic_arrayaslist-expected.txt | 264 +------- .../generic_class_getter_setter-expected.txt | 64 +- .../ets/generic_deadlock-expected.txt | 32 +- .../ets/generic_function_call_1-expected.txt | 32 +- .../ets/generic_function_call_2-expected.txt | 32 +- .../ets/generic_function_call_3-expected.txt | 32 +- .../ets/generic_function_call_4-expected.txt | 32 +- .../ets/generic_function_call_5-expected.txt | 146 +---- .../ets/generic_function_call_7-expected.txt | 32 +- .../ets/generic_typealias_1-expected.txt | 32 +- .../ets/generic_typealias_2_neg-expected.txt | 32 +- .../ets/generic_typealias_3_neg-expected.txt | 32 +- .../ets/generic_typealias_4_neg-expected.txt | 32 +- .../ets/generic_typealias_5_neg-expected.txt | 32 +- .../ets/generic_typealias_6-expected.txt | 32 +- .../ets/generic_typealias_7_neg-expected.txt | 32 +- .../ets/generic_typealias_8-expected.txt | 32 +- .../ets/generic_typealias_9-expected.txt | 32 +- .../ets/generic_variance_2-expected.txt | 32 +- .../ets/generic_variance_3-expected.txt | 32 +- .../ets/generic_variance_4-expected.txt | 32 +- .../ets/generic_variance_5-expected.txt | 32 +- ...nerics_class_recursive_type_1-expected.txt | 104 +--- .../generics_implicit_lambda1-expected.txt | 76 +-- .../ets/generics_instantiation_1-expected.txt | 64 +- .../ets/generics_instantiation_2-expected.txt | 32 +- .../ets/generics_instantiation_3-expected.txt | 32 +- .../ets/generics_instantiation_4-expected.txt | 32 +- .../generics_interface_bounds_1-expected.txt | 68 +- ...nerics_primitive_type_param_1-expected.txt | 64 +- ...cs_primitive_type_param_neg_1-expected.txt | 32 +- ...cs_primitive_type_param_neg_2-expected.txt | 32 +- .../ets/identifierReference10-expected.txt | 32 +- .../ets/identifierReference11-expected.txt | 32 +- .../ets/identifierReference12-expected.txt | 32 +- .../ets/identifierReference13-expected.txt | 64 +- .../ets/identifierReference14-expected.txt | 128 +--- .../ets/identifierReference2-expected.txt | 34 +- .../ets/identifierReference3-expected.txt | 32 +- .../ets/identifierReference4-expected.txt | 32 +- .../ets/identifierReference5-expected.txt | 132 +--- .../ets/identifierReference8-expected.txt | 64 +- .../ets/identifierReference9-expected.txt | 64 +- .../ets/implicit-conversion-expected.txt | 32 +- .../asyncfun_lambda_lib-expected.txt | 104 +--- .../asyncfunc_lambda_main-expected.txt | 64 +- .../interfaceMethodNotOverridden-expected.txt | 68 +- .../ets/invalidCallInstruction-expected.txt | 66 +- ...dIndirectInheritanceFromClass-expected.txt | 32 +- ...irectInheritanceFromInterface-expected.txt | 32 +- .../ets/invalidInheritance1-expected.txt | 32 +- .../ets/invalidInheritance3-expected.txt | 36 +- .../invalidInheritanceFromClass-expected.txt | 32 +- ...validInheritanceFromInterface-expected.txt | 32 +- ...anceFromInterfaceStaticMethod-expected.txt | 32 +- ...rExpressionFromStaticContext1-expected.txt | 96 +-- ...rExpressionFromStaticContext2-expected.txt | 96 +-- ...rExpressionFromStaticContext3-expected.txt | 96 +-- ...rExpressionFromStaticContext4-expected.txt | 96 +-- ...rExpressionFromStaticContext5-expected.txt | 96 +-- ...rExpressionFromStaticContext6-expected.txt | 96 +-- ...rExpressionFromStaticContext7-expected.txt | 96 +-- ...rExpressionFromStaticContext8-expected.txt | 96 +-- .../ets/invalidPrivateAccess1-expected.txt | 32 +- .../ets/invalidPrivateAccess2-expected.txt | 32 +- .../ets/invalidPrivateAccess3-expected.txt | 96 +-- .../ets/invalidProtectedAccess1-expected.txt | 32 +- .../ets/invalidProtectedAccess2-expected.txt | 32 +- .../ets/invalidProtectedAccess3-expected.txt | 96 +-- ...utBlockStatementDifferentType-expected.txt | 32 +- ...tementDifferentTypeInfunction-expected.txt | 32 +- .../compiler/ets/lambdaFunction1-expected.txt | 32 +- .../compiler/ets/lambdaFunction3-expected.txt | 98 +-- .../compiler/ets/lambdaFunction4-expected.txt | 66 +- .../compiler/ets/lambdaFunction5-expected.txt | 32 +- .../lambda_infer_type-expected.txt | 34 +- ...bda_infer_type_return_lambda1-expected.txt | 36 +- ...type_return_lambda_expression-expected.txt | 36 +- .../ets/lambda_unresolved_ref_1-expected.txt | 496 ++------------- .../ets/launch_expression-expected.txt | 32 +- .../ets/loopWithinLambda-expected.txt | 38 +- .../ets/manyLocalsParamRegUsage-expected.txt | 32 +- .../ets/memberExprInLambda-expected.txt | 70 +-- ...erExpressionFromStaticContext-expected.txt | 288 +-------- ...odOverrideCovariantReturnType-expected.txt | 68 +- ...hodOverrideDifferentSignature-expected.txt | 228 +------ ...methodOverrideWithoutModifier-expected.txt | 64 +- .../ets/mostSpecificMethod1-expected.txt | 96 +-- .../ets/mostSpecificMethod2-expected.txt | 96 +-- .../ets/multipleMethodOverride-expected.txt | 96 +-- ...ullableTypeParamToNonNullable-expected.txt | 32 +- ...n_ensureNotNullArgNotNullable-expected.txt | 64 +- ...ensureNotNullLocalNotNullable-expected.txt | 32 +- ...nsureNotNullReturnNotNullable-expected.txt | 32 +- .../n_nullableTypeInArgNotRef-expected.txt | 32 +- .../n_nullableTypeInReturnNotRef-expected.txt | 32 +- .../ets/n_nullableTypeNotRef-expected.txt | 32 +- .../non-const-lambda-with-scopes-expected.txt | 34 +- .../null_coalescing_generic_1-expected.txt | 32 +- .../compiler/ets/nullableTuple-expected.txt | 32 +- .../ets/overload_with_generics-expected.txt | 64 +- .../test/compiler/ets/override-expected.txt | 32 +- .../test/compiler/ets/override11-expected.txt | 32 +- .../test/compiler/ets/override18-expected.txt | 32 +- .../test/compiler/ets/override19-expected.txt | 32 +- .../test/compiler/ets/override7-expected.txt | 36 +- .../ets/parenthesizedType-expected.txt | 32 +- .../ets/privateMethodOverride-expected.txt | 64 +- ...eferenceEqualityNotCastable_n-expected.txt | 32 +- ...ferenceEqualityNotReference_n-expected.txt | 32 +- .../ets/rethrowingCheck1-expected.txt | 38 +- .../ets/rethrowingCheck2-expected.txt | 38 +- .../ets/rethrowingCheck3-expected.txt | 38 +- .../ets/rethrowingCheck4-expected.txt | 76 +-- .../ets/rethrowingCheck5-expected.txt | 76 +-- .../rethrowingConstructorCheck1-expected.txt | 102 +-- .../rethrowingConstructorCheck2-expected.txt | 102 +-- .../rethrowingConstructorCheck3-expected.txt | 102 +-- .../ets/rethrowingFunctionCheck1-expected.txt | 134 +--- .../ets/rethrowingFunctionCheck2-expected.txt | 134 +--- .../ets/rethrowingFunctionCheck3-expected.txt | 134 +--- .../ets/rethrowingMethodCheck1-expected.txt | 134 +--- .../ets/rethrowingMethodCheck2-expected.txt | 134 +--- .../ets/rethrowingMethodCheck3-expected.txt | 134 +--- .../ets/return_missing_argument-expected.txt | 32 +- .../compiler/ets/setArrayLength1-expected.txt | 32 +- .../compiler/ets/setArrayLength2-expected.txt | 32 +- .../compiler/ets/setArrayLength3-expected.txt | 32 +- ...tchStatementCorrectConversion-expected.txt | 32 +- .../switchStatementWrongBoxing-expected.txt | 32 +- .../ets/throwInCatchClause1-expected.txt | 32 +- .../ets/throwInCatchClause2-expected.txt | 32 +- .../ets/throwInCatchClause3-expected.txt | 32 +- .../ets/throwInFinallyBlock-expected.txt | 32 +- .../ets/throwInFinallyBlock1-expected.txt | 32 +- .../ets/throwInFinallyBlock2-expected.txt | 32 +- .../throwInRethrowingFunction-expected.txt | 70 +-- .../throwInRethrowingFunction2-expected.txt | 38 +- .../ets/throwInThrowingFunction-expected.txt | 32 +- .../ets/throwInTryStatement-expected.txt | 32 +- .../ets/throwWithoutTryCatch-expected.txt | 32 +- .../throwingConstructorCheck1-expected.txt | 32 +- .../throwingConstructorCheck2-expected.txt | 32 +- .../throwingFunctionAsParameter1-expected.txt | 140 +---- .../throwingFunctionAsParameter2-expected.txt | 70 +-- .../ets/throwingFunctionCheck1-expected.txt | 32 +- .../ets/throwingFunctionCheck2-expected.txt | 64 +- .../ets/throwingFunctionCheck3-expected.txt | 96 +-- .../ets/throwingFunctionCheck4-expected.txt | 64 +- .../ets/throwingFunctionCheck5-expected.txt | 64 +- .../ets/throwingFunctionCheck6-expected.txt | 96 +-- .../ets/throwingFunctionType1-expected.txt | 98 +-- .../ets/throwingFunctionType2-expected.txt | 98 +-- .../ets/throwingMethodCheck1-expected.txt | 64 +- .../ets/throwingMethodCheck2-expected.txt | 64 +- .../ets/tryCatchErrorFlow-expected.txt | 32 +- ...yCatchErrorIncorrectParamType-expected.txt | 32 +- ...tryCatchErrorMissingParamType-expected.txt | 32 +- .../compiler/ets/tryCatchFlow-expected.txt | 32 +- .../tryCatchIncorrectParamType-expected.txt | 32 +- .../ets/tryCatchMissingParamType-expected.txt | 32 +- .../ets/tryDefaultCatches-expected.txt | 32 +- .../compiler/ets/tuple_types_1-expected.txt | 32 +- .../ets/tuple_types_10_neg-expected.txt | 32 +- .../ets/tuple_types_11_neg-expected.txt | 32 +- .../compiler/ets/tuple_types_12-expected.txt | 32 +- .../compiler/ets/tuple_types_14-expected.txt | 64 +- .../compiler/ets/tuple_types_15-expected.txt | 32 +- .../compiler/ets/tuple_types_16-expected.txt | 104 +--- .../compiler/ets/tuple_types_17-expected.txt | 32 +- .../compiler/ets/tuple_types_18-expected.txt | 32 +- .../ets/tuple_types_2_neg-expected.txt | 32 +- .../ets/tuple_types_3_neg-expected.txt | 32 +- .../ets/tuple_types_4_neg-expected.txt | 32 +- .../ets/tuple_types_5_neg-expected.txt | 32 +- .../ets/tuple_types_6_neg-expected.txt | 32 +- .../compiler/ets/tuple_types_7-expected.txt | 32 +- .../compiler/ets/tuple_types_8-expected.txt | 32 +- .../ets/tuple_types_9_neg-expected.txt | 32 +- .../compiler/ets/union_types_5-expected.txt | 32 +- ...e_signatures_throw_type_error-expected.txt | 32 +- ...s_throw_type_error_more_param-expected.txt | 32 +- .../voidTypeInBinaryOperation-expected.txt | 66 +- .../parser/ets/AccessBinaryTrees-expected.txt | 64 +- .../parser/ets/AccessFannkuch-expected.txt | 64 +- .../test/parser/ets/AccessNBody-expected.txt | 96 +-- .../test/parser/ets/AccessNSieve-expected.txt | 96 +-- .../ets/Bitops3BitBitsInByte-expected.txt | 64 +- .../parser/ets/BitopsBitsInByte-expected.txt | 64 +- .../parser/ets/BitopsBitwiseAnd-expected.txt | 64 +- .../parser/ets/BitopsNSieveBits-expected.txt | 96 +-- .../parser/ets/Boolean_bitwise-expected.txt | 32 +- .../ets/ControlFlowRecursive-expected.txt | 64 +- .../parser/ets/Dollar_dollar_2-expected.txt | 64 +- .../test/parser/ets/FunctionType-expected.txt | 74 +-- .../FunctionalTypeAsTypeArgument-expected.txt | 34 +- .../ets/InterfacePrivateMethod-expected.txt | 32 +- .../test/parser/ets/MathCordic-expected.txt | 64 +- .../parser/ets/MathPartialSums-expected.txt | 64 +- .../parser/ets/MathSpectralNorm-expected.txt | 160 +---- .../test/parser/ets/Morph3d-expected.txt | 128 +--- .../test/parser/ets/StringBase64-expected.txt | 64 +- .../parser/ets/access_modifier_2-expected.txt | 32 +- .../parser/ets/accessor_call-expected.txt | 32 +- .../parser/ets/accessor_void-expected.txt | 32 +- .../parser/ets/ambiguous_call_1-expected.txt | 96 +-- .../parser/ets/ambiguous_call_2-expected.txt | 128 +--- .../parser/ets/ambiguous_call_3-expected.txt | 96 +-- .../parser/ets/anonymous_class-expected.txt | 32 +- ets2panda/test/parser/ets/array-expected.txt | 96 +-- .../ets/arrayHoldingNullValue-expected.txt | 32 +- .../array_creation_expression-expected.txt | 32 +- ...sion_implicit_cast_assignment-expected.txt | 32 +- .../test/parser/ets/array_new-expected.txt | 32 +- .../parser/ets/array_new_failed-expected.txt | 32 +- .../test/parser/ets/array_type-expected.txt | 32 +- ets2panda/test/parser/ets/assert-expected.txt | 32 +- ets2panda/test/parser/ets/assign-expected.txt | 32 +- .../test/parser/ets/assign-func-expected.txt | 74 +-- .../test/parser/ets/assignments-expected.txt | 32 +- .../parser/ets/async_overload-expected.txt | 32 +- .../parser/ets/async_with_lambda-expected.txt | 136 +--- .../parser/ets/await_keyword-expected.txt | 98 +-- .../test/parser/ets/boolean_cond-expected.txt | 32 +- .../parser/ets/boolean_default-expected.txt | 32 +- ets2panda/test/parser/ets/break-expected.txt | 32 +- .../calling_superclass_methods-expected.txt | 32 +- ets2panda/test/parser/ets/calls-expected.txt | 32 +- .../parser/ets/cast_expressions-expected.txt | 256 +------- .../ets/cast_expressions10-expected.txt | 32 +- .../parser/ets/cast_expressions2-expected.txt | 32 +- .../parser/ets/cast_expressions3-expected.txt | 32 +- .../parser/ets/cast_expressions4-expected.txt | 32 +- .../parser/ets/cast_expressions5-expected.txt | 32 +- .../parser/ets/cast_expressions6-expected.txt | 1 - .../parser/ets/cast_expressions7-expected.txt | 32 +- .../parser/ets/cast_expressions8-expected.txt | 32 +- .../parser/ets/cast_expressions9-expected.txt | 32 +- .../parser/ets/class_composite_1-expected.txt | 32 +- .../conditionalExpressionType-expected.txt | 128 +--- .../test/parser/ets/continue-expected.txt | 32 +- .../parser/ets/declare_class-expected.txt | 34 +- .../ets/declare_class_bad_2-expected.txt | 32 +- .../ets/declare_class_bad_4-expected.txt | 32 +- .../test/parser/ets/declare_func-expected.txt | 32 +- .../parser/ets/declare_func_bad-expected.txt | 32 +- .../parser/ets/declare_iface-expected.txt | 36 +- .../ets/declare_namespace_2-expected.txt | 32 +- .../ets/default_parameter1-expected.txt | 34 +- .../ets/default_parameter10-expected.txt | 32 +- .../ets/default_parameter2-expected.txt | 34 +- .../ets/default_parameter4-expected.txt | 34 +- .../ets/default_parameter5-expected.txt | 34 +- .../ets/default_parameter8-expected.txt | 96 +-- ..._implicitly_typed_return_void-expected.txt | 32 +- .../modules/module-expected.txt | 32 +- .../parser/ets/empty_statement-expected.txt | 64 +- ets2panda/test/parser/ets/enum-expected.txt | 32 +- ets2panda/test/parser/ets/enum10-expected.txt | 32 +- ets2panda/test/parser/ets/enum11-expected.txt | 32 +- ets2panda/test/parser/ets/enum12-expected.txt | 64 +- ets2panda/test/parser/ets/enum13-expected.txt | 64 +- ets2panda/test/parser/ets/enum14-expected.txt | 32 +- ets2panda/test/parser/ets/enum20-expected.txt | 32 +- ets2panda/test/parser/ets/enum6-expected.txt | 32 +- ets2panda/test/parser/ets/enum7-expected.txt | 32 +- ets2panda/test/parser/ets/enum8-expected.txt | 32 +- ets2panda/test/parser/ets/enum9-expected.txt | 32 +- .../test/parser/ets/exports-expected.txt | 32 +- ets2panda/test/parser/ets/for_of-expected.txt | 32 +- .../test/parser/ets/for_of_02-expected.txt | 32 +- .../parser/ets/for_with_break-expected.txt | 32 +- .../ets/functionThrowsRethrows-expected.txt | 64 +- ...unction_implicit_return_type4-expected.txt | 32 +- .../parser/ets/generic_error-expected.txt | 32 +- .../parser/ets/generic_resolve-expected.txt | 98 +-- .../test/parser/ets/generics_1-expected.txt | 32 +- .../test/parser/ets/generics_3-expected.txt | 64 +- .../test/parser/ets/generics_4-expected.txt | 64 +- .../test/parser/ets/generics_5-expected.txt | 64 +- .../test/parser/ets/generics_6-expected.txt | 64 +- .../test/parser/ets/generics_7-expected.txt | 64 +- ...rics_type_param_constraint_10-expected.txt | 32 +- ...erics_type_param_constraint_4-expected.txt | 36 +- ...erics_type_param_constraint_5-expected.txt | 72 +-- ...etter_setter_access_modifiers-expected.txt | 64 +- ...ter_setter_access_modifiers_2-expected.txt | 64 +- .../ets/global_const_vars3-expected.txt | 32 +- .../ets/global_const_vars4-expected.txt | 64 +- ets2panda/test/parser/ets/if-expected.txt | 32 +- .../check_exported_1-expected.txt | 32 +- .../import_tests/default_import-expected.txt | 32 +- .../import_alias/export-expected.txt | 64 +- .../import_alias/import_alias_1-expected.txt | 32 +- .../import_alias/import_alias_2-expected.txt | 32 +- .../import_alias/import_alias_3-expected.txt | 32 +- .../import_alias/import_alias_4-expected.txt | 32 +- ...ort_alias_and_without_alias_1-expected.txt | 32 +- ...ort_alias_and_without_alias_2-expected.txt | 32 +- ...ort_alias_and_without_alias_3-expected.txt | 32 +- .../import_tests/import_all_2-expected.txt | 32 +- .../import_tests/import_all_3-expected.txt | 32 +- .../import_extension-expected.txt | 32 +- .../import_max_as_alias-expected.txt | 32 +- .../import_tests/import_ts_file-expected.txt | 32 +- .../modules/default_export-expected.txt | 64 +- .../missing_default_export-expected.txt | 32 +- .../relative_import/Point-expected.txt | 32 +- .../relative_import/alias2-expected.txt | 32 +- .../test/parser/ets/inheritance2-expected.txt | 32 +- ...interface_method_default_body-expected.txt | 178 +----- .../interface_static_function_1-expected.txt | 32 +- .../interface_static_function_2-expected.txt | 32 +- .../test/parser/ets/interfaces-expected.txt | 96 +-- .../parser/ets/internalParsing-expected.txt | 64 +- .../ets/internalProtectedParsing-expected.txt | 64 +- .../ets/labeledDoWhileStatement-expected.txt | 32 +- .../ets/labeledForStatement-expected.txt | 32 +- .../ets/labeledSwitchStatement-expected.txt | 64 +- .../ets/labeledWhileStatement-expected.txt | 32 +- ets2panda/test/parser/ets/lambda-expected.txt | 134 +--- .../parser/ets/lambda-lambda-expected.txt | 210 +------ .../lambda-type-inference-alias-expected.txt | 130 +--- ...da-type-inference-arg-no-type-expected.txt | 64 +- .../ets/lambda-type-inference-expected.txt | 198 +----- .../lambda-type-inference-neg-expected.txt | 172 +----- .../lambda-type-inference-neg2-expected.txt | 64 +- ...da-type-inference-no-ret-type-expected.txt | 64 +- ...a-type-inference-overloaded-1-expected.txt | 96 +-- ...a-type-inference-overloaded-2-expected.txt | 134 +--- ...a-type-inference-overloaded-3-expected.txt | 204 +----- ...bda-type-inference-overloaded-expected.txt | 166 +---- ...pressionWithoutBlockStatement-expected.txt | 32 +- ...ockStatementCallAVoidFunction-expected.txt | 134 +--- ...sionWithoutBlockStatementVoid-expected.txt | 102 +-- ...atementWithFunctionParameters-expected.txt | 32 +- .../ets/lambdaThrowsRethrows-expected.txt | 132 +--- ets2panda/test/parser/ets/launch-expected.txt | 98 +-- .../test/parser/ets/launch_ret-expected.txt | 32 +- .../test/parser/ets/launch_super-expected.txt | 64 +- .../parser/ets/launch_unresolved-expected.txt | 32 +- ets2panda/test/parser/ets/loops-expected.txt | 160 +---- .../ets/main_entry_point_1-expected.txt | 32 +- .../ets/main_entry_point_3-expected.txt | 32 +- .../ets/main_entry_point_4-expected.txt | 32 +- .../ets/main_entry_point_6-expected.txt | 32 +- .../ets/main_entry_point_7-expected.txt | 32 +- .../ets/main_entry_point_8-expected.txt | 32 +- .../ets/main_entry_point_9-expected.txt | 32 +- .../ets/methodThrowsRethrows-expected.txt | 64 +- .../test/parser/ets/method_empty-expected.txt | 96 +-- .../test/parser/ets/method_full-expected.txt | 32 +- .../ets/method_modifier_check_1-expected.txt | 32 +- .../ets/method_modifier_check_10-expected.txt | 32 +- .../ets/method_modifier_check_11-expected.txt | 32 +- .../ets/method_modifier_check_12-expected.txt | 32 +- .../ets/method_modifier_check_13-expected.txt | 32 +- .../ets/method_modifier_check_14-expected.txt | 32 +- .../ets/method_modifier_check_15-expected.txt | 32 +- .../ets/method_modifier_check_16-expected.txt | 32 +- .../ets/method_modifier_check_2-expected.txt | 32 +- .../ets/method_modifier_check_3-expected.txt | 32 +- .../ets/method_modifier_check_4-expected.txt | 32 +- .../ets/method_modifier_check_5-expected.txt | 32 +- .../ets/method_modifier_check_6-expected.txt | 32 +- .../ets/method_modifier_check_7-expected.txt | 32 +- .../ets/method_modifier_check_8-expected.txt | 32 +- .../ets/method_modifier_check_9-expected.txt | 32 +- .../ets/method_override_throw_1-expected.txt | 548 ++-------------- .../ets/method_override_throw_2-expected.txt | 68 +- .../ets/method_override_throw_3-expected.txt | 144 +---- .../ets/method_override_throw_4-expected.txt | 140 +---- .../ets/method_override_throw_5-expected.txt | 64 +- .../ets/method_override_throw_6-expected.txt | 64 +- .../test/parser/ets/methods-expected.txt | 352 +---------- .../ets/n_arrayHoldingNullValue-expected.txt | 32 +- ...ableFromFunctionToNonNullable-expected.txt | 32 +- ...ableFromMethodToNullableParam-expected.txt | 32 +- ...n_assignNullableToNonNullable-expected.txt | 32 +- ...ignNullableToNonNullableArray-expected.txt | 32 +- ...ullableToNonNullableTypeAlias-expected.txt | 32 +- ...callFunctionWithNullableParam-expected.txt | 64 +- ...erfaceMethodWithNullableParam-expected.txt | 100 +-- ...n_callMethodWithNullableParam-expected.txt | 64 +- ...ive_function_with_return_type-expected.txt | 64 +- ..._function_without_return_type-expected.txt | 32 +- .../parser/ets/new_expressions-expected.txt | 32 +- .../test/parser/ets/new_object_3-expected.txt | 34 +- .../parser/ets/nonIntegralIndex-expected.txt | 32 +- ets2panda/test/parser/ets/null-expected.txt | 64 +- .../test/parser/ets/nullableType-expected.txt | 160 +---- .../ets/nullable_union_array-expected.txt | 32 +- .../ets/optional_union_paramter-expected.txt | 32 +- .../ets/overrideStaticFunc-expected.txt | 96 +-- .../parentheses_expression_value-expected.txt | 32 +- .../ets/property-access-method-1-expected.txt | 64 +- .../ets/property-access-method-2-expected.txt | 64 +- .../ets/proxyVoidGeneration-expected.txt | 128 +--- .../parser/ets/re_export/export-expected.txt | 34 +- .../ets/re_export/export_2-expected.txt | 34 +- .../ets/re_export/folder/export-expected.txt | 34 +- .../folder/folder2/export-expected.txt | 34 +- .../parser/ets/re_export/import-expected.txt | 34 +- .../ets/re_export/import_2-expected.txt | 34 +- .../ets/re_export/import_3-expected.txt | 34 +- .../ets/re_export/import_4-expected.txt | 34 +- .../ets/re_export/import_5-expected.txt | 34 +- .../ets/re_export/import_6-expected.txt | 34 +- .../ets/re_export/import_7-expected.txt | 34 +- .../ets/re_export/import_8-expected.txt | 34 +- ...egression-target-type-context-expected.txt | 32 +- .../parser/ets/rethrow-func-1-expected.txt | 98 +-- ets2panda/test/parser/ets/return-expected.txt | 32 +- .../test/parser/ets/scoped_decl-expected.txt | 32 +- .../selective_export/import_1-expected.txt | 34 +- .../selective_export/import_2-expected.txt | 34 +- .../selective_export/import_3-expected.txt | 34 +- .../selective_export/import_4-expected.txt | 34 +- .../parser/ets/setter_native-expected.txt | 32 +- .../ets/setter_with_non_void-expected.txt | 32 +- .../test/parser/ets/simple_types-expected.txt | 32 +- .../static_function_override_1-expected.txt | 64 +- .../static_function_override_2-expected.txt | 64 +- .../static_function_override_3-expected.txt | 64 +- .../static_function_override_4-expected.txt | 64 +- ...c_invoke_mismatch_signature_2-expected.txt | 32 +- .../parser/ets/string_template-expected.txt | 32 +- .../parser/ets/struct_templete-expected.txt | 32 +- ets2panda/test/parser/ets/switch-expected.txt | 32 +- .../test/parser/ets/switch2-expected.txt | 32 +- .../test/parser/ets/switch_enum-expected.txt | 32 +- .../test/parser/ets/switch_enum2-expected.txt | 32 +- .../parser/ets/test_interface-expected.txt | 97 +-- .../ets/test_jsvalue_set_double-expected.txt | 32 +- .../test_jsvalue_set_property_1-expected.txt | 32 +- .../test_jsvalue_set_property_2-expected.txt | 32 +- .../parser/ets/test_type_alias7-expected.txt | 32 +- .../parser/ets/test_type_alias8-expected.txt | 96 +-- .../throwsRethrowsAsVariables-expected.txt | 102 +-- ..._lambda_define_lambda_in_body-expected.txt | 102 +-- ...bda_mismatch_lambda_signature-expected.txt | 38 +- ...a_mismatch_lambda_signature_1-expected.txt | 38 +- ...ot_transform_trailing_block_1-expected.txt | 38 +- ...ot_transform_trailing_block_2-expected.txt | 38 +- ...ot_transform_trailing_block_3-expected.txt | 70 +-- ...ot_transform_trailing_block_4-expected.txt | 70 +-- .../trailing_lambda_overload-expected.txt | 38 +- .../trailing_lambda_overload_1-expected.txt | 114 +--- ...mbda_transform_trailing_block-expected.txt | 38 +- .../trailing_lambda_type_alias-expected.txt | 102 +-- .../trailing_lambda_with_throw-expected.txt | 76 +-- .../parser/ets/type_variance1-expected.txt | 168 +---- .../ets/undefinedNullNotObject-expected.txt | 432 +++++++++++++ .../ets/undefinedNullNotObject.ets} | 42 +- ...finedNullObjectTypeAnnotation-expected.txt | 584 ++++++++++++++++++ .../ets/undefinedNullObjectTypeAnnotation.ets | 21 + .../ets/undefinedNullTypeAlias-expected.txt | 476 ++++++++++++++ .../parser/ets/undefinedNullTypeAlias.ets | 21 + .../test/parser/ets/var_declare-expected.txt | 32 +- .../variable_throw_function_1-expected.txt | 306 +-------- .../variable_throw_function_2-expected.txt | 98 +-- ets2panda/test/parser/ets/void-expected.txt | 32 +- .../test-lists/parser/parser-js-ignored.txt | 7 + ets2panda/varbinder/ETSBinder.cpp | 3 + 533 files changed, 4055 insertions(+), 27925 deletions(-) delete mode 100644 ets2panda/test/parser/ets/cast_expressions6-expected.txt create mode 100644 ets2panda/test/parser/ets/undefinedNullNotObject-expected.txt rename ets2panda/test/{runtime/ets/voidInstanceReturn.ets => parser/ets/undefinedNullNotObject.ets} (46%) create mode 100644 ets2panda/test/parser/ets/undefinedNullObjectTypeAnnotation-expected.txt create mode 100644 ets2panda/test/parser/ets/undefinedNullObjectTypeAnnotation.ets create mode 100644 ets2panda/test/parser/ets/undefinedNullTypeAlias-expected.txt create mode 100644 ets2panda/test/parser/ets/undefinedNullTypeAlias.ets diff --git a/ets2panda/checker/ETSAnalyzer.cpp b/ets2panda/checker/ETSAnalyzer.cpp index 6d56ae949e..48669650a3 100644 --- a/ets2panda/checker/ETSAnalyzer.cpp +++ b/ets2panda/checker/ETSAnalyzer.cpp @@ -245,11 +245,11 @@ void CheckPredefinedMethodReturnType(ETSChecker *checker, ir::ScriptFunction *sc return false; }; - if (scriptFunc->IsSetter() && (scriptFunc->Signature()->ReturnType() != checker->GlobalBuiltinVoidType())) { + if (scriptFunc->IsSetter() && (scriptFunc->Signature()->ReturnType() != checker->GlobalVoidType())) { checker->ThrowTypeError("Setter must have void return type", position); } - if (scriptFunc->IsGetter() && (scriptFunc->Signature()->ReturnType() == checker->GlobalBuiltinVoidType())) { + if (scriptFunc->IsGetter() && (scriptFunc->Signature()->ReturnType() == checker->GlobalVoidType())) { checker->ThrowTypeError("Getter must return a value", position); } @@ -257,11 +257,11 @@ void CheckPredefinedMethodReturnType(ETSChecker *checker, ir::ScriptFunction *sc auto const methodName = std::string {ir::PREDEFINED_METHOD} + std::string {name.Utf8()}; if (name.Is(compiler::Signatures::GET_INDEX_METHOD)) { - if (scriptFunc->Signature()->ReturnType() == checker->GlobalBuiltinVoidType()) { + if (scriptFunc->Signature()->ReturnType() == checker->GlobalVoidType()) { checker->ThrowTypeError(methodName + "' shouldn't have void return type.", position); } } else if (name.Is(compiler::Signatures::SET_INDEX_METHOD)) { - if (scriptFunc->Signature()->ReturnType() != checker->GlobalBuiltinVoidType()) { + if (scriptFunc->Signature()->ReturnType() != checker->GlobalVoidType()) { checker->ThrowTypeError(methodName + "' should have void return type.", position); } } else if (name.Is(compiler::Signatures::ITERATOR_METHOD)) { @@ -2219,9 +2219,7 @@ void CheckArgumentVoidType(checker::Type *&funcReturnType, ETSChecker *checker, ir::ReturnStatement *st) { if (name.find(compiler::Signatures::ETS_MAIN_WITH_MANGLE_BEGIN) != std::string::npos) { - if (funcReturnType == checker->GlobalBuiltinVoidType()) { - funcReturnType = checker->GlobalVoidType(); - } else if (!funcReturnType->IsETSVoidType() && !funcReturnType->IsIntType()) { + if (!funcReturnType->IsETSVoidType() && !funcReturnType->IsIntType()) { checker->ThrowTypeError("Bad return type, main enable only void or int type.", st->Start()); } } @@ -2230,8 +2228,8 @@ void CheckArgumentVoidType(checker::Type *&funcReturnType, ETSChecker *checker, void CheckReturnType(ETSChecker *checker, checker::Type *funcReturnType, checker::Type *argumentType, ir::Expression *stArgument, bool isAsync) { - if (funcReturnType->IsETSVoidType() || funcReturnType == checker->GlobalBuiltinVoidType()) { - if (argumentType != checker->GlobalVoidType() && argumentType != checker->GlobalBuiltinVoidType()) { + if (funcReturnType->IsETSVoidType() || funcReturnType == checker->GlobalVoidType()) { + if (argumentType != checker->GlobalVoidType()) { checker->ThrowTypeError("Unexpected return value, enclosing method return type is void.", stArgument->Start()); } @@ -2263,9 +2261,7 @@ void InferReturnType(ETSChecker *checker, ir::ScriptFunction *containingFunc, ch ir::Expression *stArgument) { // First (or single) return statement in the function: - funcReturnType = stArgument == nullptr - ? containingFunc->IsEntryPoint() ? checker->GlobalVoidType() : checker->GlobalBuiltinVoidType() - : stArgument->Check(checker); + funcReturnType = stArgument == nullptr ? checker->GlobalVoidType() : stArgument->Check(checker); if (funcReturnType->HasTypeFlag(checker::TypeFlag::CONSTANT)) { // remove CONSTANT type modifier if exists funcReturnType = @@ -2308,13 +2304,13 @@ void ProcessReturnStatements(ETSChecker *checker, ir::ScriptFunction *containing if (stArgument == nullptr) { // previous return statement(s) have value - if (!funcReturnType->IsETSVoidType() && funcReturnType != checker->GlobalBuiltinVoidType()) { + if (!funcReturnType->IsETSVoidType() && funcReturnType != checker->GlobalVoidType()) { checker->ThrowTypeError("All return statements in the function should be empty or have a value.", st->Start()); } } else { // previous return statement(s) don't have any value - if (funcReturnType->IsETSVoidType() || funcReturnType == checker->GlobalBuiltinVoidType()) { + if (funcReturnType->IsETSVoidType() || funcReturnType == checker->GlobalVoidType()) { checker->ThrowTypeError("All return statements in the function should be empty or have a value.", stArgument->Start()); } @@ -2368,11 +2364,10 @@ checker::Type *ETSAnalyzer::GetFunctionReturnType(ir::ReturnStatement *st, ir::S funcReturnType = returnTypeAnnotation->GetType(checker); if (st->argument_ == nullptr) { - if (!funcReturnType->IsETSVoidType() && funcReturnType != checker->GlobalBuiltinVoidType()) { + if (!funcReturnType->IsETSVoidType() && funcReturnType != checker->GlobalVoidType()) { checker->ThrowTypeError("Missing return value.", st->Start()); } - funcReturnType = - containingFunc->IsEntryPoint() ? checker->GlobalVoidType() : checker->GlobalBuiltinVoidType(); + funcReturnType = checker->GlobalVoidType(); } else { const auto name = containingFunc->Scope()->InternalName().Mutf8(); CheckArgumentVoidType(funcReturnType, checker, name, st); diff --git a/ets2panda/checker/ETSchecker.cpp b/ets2panda/checker/ETSchecker.cpp index 1968b6b553..bad4f1393e 100644 --- a/ets2panda/checker/ETSchecker.cpp +++ b/ets2panda/checker/ETSchecker.cpp @@ -91,7 +91,6 @@ void ETSChecker::InitializeBuiltins(varbinder::ETSBinder *varbinder) const auto varMap = varbinder->TopScope()->Bindings(); auto const objectName = InitBuiltin(this, compiler::Signatures::BUILTIN_OBJECT_CLASS); - auto const voidName = InitBuiltin(this, compiler::Signatures::BUILTIN_VOID_CLASS); for (auto sig : BUILTINS_TO_INIT) { InitBuiltin(this, sig); @@ -109,7 +108,7 @@ void ETSChecker::InitializeBuiltins(varbinder::ETSBinder *varbinder) } for (const auto &[name, var] : varMap) { - if (name == objectName || name == voidName) { + if (name == objectName) { continue; } @@ -356,11 +355,6 @@ ETSObjectType *ETSChecker::GlobalBuiltinJSValueType() const return AsETSObjectType(&GlobalTypesHolder::GlobalJSValueBuiltinType); } -ETSObjectType *ETSChecker::GlobalBuiltinVoidType() const -{ - return AsETSObjectType(&GlobalTypesHolder::GlobalBuiltinVoidType); -} - ETSObjectType *ETSChecker::GlobalBuiltinFunctionType(size_t nargs) const { return AsETSObjectType(&GlobalTypesHolder::GlobalFunctionBuiltinType, nargs); diff --git a/ets2panda/checker/ETSchecker.h b/ets2panda/checker/ETSchecker.h index 48cd3cd27c..e71c513544 100644 --- a/ets2panda/checker/ETSchecker.h +++ b/ets2panda/checker/ETSchecker.h @@ -109,7 +109,6 @@ public: ETSObjectType *GlobalBuiltinJSRuntimeType() const; ETSObjectType *GlobalBuiltinJSValueType() const; ETSObjectType *GlobalBuiltinBoxType(const Type *contents) const; - ETSObjectType *GlobalBuiltinVoidType() const; ETSObjectType *GlobalBuiltinFunctionType(size_t nargs) const; size_t GlobalBuiltinFunctionTypeVariadicThreshold() const; @@ -336,7 +335,7 @@ public: void CheckObjectLiteralArguments(Signature *sig, ArenaVector const &arguments); Signature *ComposeSignature(ir::ScriptFunction *func, SignatureInfo *signatureInfo, Type *returnType, varbinder::Variable *nameVar); - Type *ComposeReturnType(ir::ScriptFunction *func, util::StringView funcName, bool isConstructSig); + Type *ComposeReturnType(ir::ScriptFunction *func); SignatureInfo *ComposeSignatureInfo(ir::ScriptFunction *func); void ValidateMainSignature(ir::ScriptFunction *func); checker::ETSFunctionType *BuildFunctionSignature(ir::ScriptFunction *func, bool isConstructSig = false); @@ -399,12 +398,10 @@ public: void ResolveLambdaObjectInvoke(ir::ClassDefinition *lambdaObject, Signature *signatureRef, bool ifaceOverride); void ResolveLambdaObjectInvoke(ir::ClassDefinition *lambdaObject, ir::ArrowFunctionExpression *lambda, ir::MethodDefinition *proxyMethod, bool isStatic, bool ifaceOverride); - ir::Statement *ResolveLambdaObjectInvokeFuncBody(ir::ClassDefinition *lambdaObject, Signature *signatureRef, - bool ifaceOverride); - ir::Statement *ResolveLambdaObjectInvokeFuncBody(ir::ClassDefinition *lambdaObject, - ir::ArrowFunctionExpression *lambda, - ir::MethodDefinition *proxyMethod, bool isStatic, - bool ifaceOverride); + void ResolveLambdaObjectInvokeFuncBody(ir::ClassDefinition *lambdaObject, Signature *signatureRef, + bool ifaceOverride); + void ResolveLambdaObjectInvokeFuncBody(ir::ClassDefinition *lambdaObject, ir::ArrowFunctionExpression *lambda, + ir::MethodDefinition *proxyMethod, bool isStatic, bool ifaceOverride); void CheckCapturedVariables(); void CheckCapturedVariableInSubnodes(ir::AstNode *node, varbinder::Variable *var); void CheckCapturedVariable(ir::AstNode *node, varbinder::Variable *var); diff --git a/ets2panda/checker/ets/aliveAnalyzer.cpp b/ets2panda/checker/ets/aliveAnalyzer.cpp index b12ca4caff..e325add772 100644 --- a/ets2panda/checker/ets/aliveAnalyzer.cpp +++ b/ets2panda/checker/ets/aliveAnalyzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 - 2023 Huawei Device Co., Ltd. + * Copyright (c) 2021 - 2024 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 @@ -274,13 +274,13 @@ void AliveAnalyzer::AnalyzeMethodDef(const ir::MethodDefinition *methodDef) AnalyzeStat(func->Body()); ASSERT(methodDef->TsType() && methodDef->TsType()->IsETSFunctionType()); const auto *returnType = methodDef->TsType()->AsETSFunctionType()->FindSignature(func)->ReturnType(); - const auto isVoid = returnType->IsETSVoidType() || returnType == checker_->GlobalBuiltinVoidType(); + const auto isVoid = returnType->IsETSVoidType() || returnType == checker_->GlobalVoidType(); auto isPromiseVoid = false; if (returnType->IsETSAsyncFuncReturnType()) { const auto *asAsync = returnType->AsETSAsyncFuncReturnType(); - isPromiseVoid = asAsync->GetPromiseTypeArg() == checker_->GlobalBuiltinVoidType(); + isPromiseVoid = asAsync->GetPromiseTypeArg() == checker_->GlobalETSUndefinedType(); } if (status_ == LivenessStatus::ALIVE && !isVoid && !isPromiseVoid) { diff --git a/ets2panda/checker/ets/dynamic.cpp b/ets2panda/checker/ets/dynamic.cpp index 0d1d3f5589..b175b2e582 100644 --- a/ets2panda/checker/ets/dynamic.cpp +++ b/ets2panda/checker/ets/dynamic.cpp @@ -529,7 +529,7 @@ ir::MethodDefinition *ETSChecker::CreateDynamicModuleClassInitMethod(varbinder:: [this]([[maybe_unused]] varbinder::FunctionScope *scope, [[maybe_unused]] ArenaVector *statements, [[maybe_unused]] ArenaVector *params, - Type **returnType) { *returnType = GlobalBuiltinVoidType(); }); + Type **returnType) { *returnType = GlobalVoidType(); }); } ir::MethodDefinition *ETSChecker::CreateLambdaObjectClassInvokeMethod(varbinder::ClassScope *classScope, diff --git a/ets2panda/checker/ets/function.cpp b/ets2panda/checker/ets/function.cpp index b154503c4c..2fa80607d5 100644 --- a/ets2panda/checker/ets/function.cpp +++ b/ets2panda/checker/ets/function.cpp @@ -45,8 +45,10 @@ #include "ir/expressions/functionExpression.h" #include "ir/expressions/identifier.h" #include "ir/expressions/literals/numberLiteral.h" +#include "ir/expressions/literals/undefinedLiteral.h" #include "ir/expressions/memberExpression.h" #include "ir/expressions/objectExpression.h" +#include "ir/expressions/sequenceExpression.h" #include "ir/expressions/thisExpression.h" #include "ir/statements/blockStatement.h" #include "ir/statements/doWhileStatement.h" @@ -796,28 +798,14 @@ Signature *ETSChecker::ComposeSignature(ir::ScriptFunction *func, SignatureInfo return signature; } -Type *ETSChecker::ComposeReturnType(ir::ScriptFunction *func, util::StringView funcName, bool isConstructSig) +Type *ETSChecker::ComposeReturnType(ir::ScriptFunction *func) { auto *const returnTypeAnnotation = func->ReturnTypeAnnotation(); checker::Type *returnType {}; if (returnTypeAnnotation == nullptr) { // implicit void return type - returnType = isConstructSig || func->IsEntryPoint() || funcName.Is(compiler::Signatures::CCTOR) - ? GlobalVoidType() - : GlobalBuiltinVoidType(); - - if (returnType == nullptr) { - const auto varMap = VarBinder()->TopScope()->Bindings(); - - const auto builtinVoid = varMap.find(compiler::Signatures::BUILTIN_VOID_CLASS); - ASSERT(builtinVoid != varMap.end()); - - BuildBasicClassProperties(builtinVoid->second->Declaration()->Node()->AsClassDefinition()); - - ASSERT(GlobalBuiltinVoidType() != nullptr); - returnType = GlobalBuiltinVoidType(); - } + returnType = GlobalVoidType(); if (func->IsAsyncFunc()) { auto implicitPromiseVoid = [this]() { @@ -826,13 +814,13 @@ Type *ETSChecker::ComposeReturnType(ir::ScriptFunction *func, util::StringView f promiseGlobal->Instantiate(Allocator(), Relation(), GetGlobalTypesHolder())->AsETSObjectType(); promiseType->AddTypeFlag(checker::TypeFlag::GENERIC); promiseType->TypeArguments().clear(); - promiseType->TypeArguments().emplace_back(GlobalBuiltinVoidType()); + promiseType->TypeArguments().emplace_back(GlobalVoidType()); return promiseType; }; returnType = implicitPromiseVoid(); } - } else if (func->IsEntryPoint() && returnTypeAnnotation->GetType(this) == GlobalBuiltinVoidType()) { + } else if (func->IsEntryPoint() && returnTypeAnnotation->GetType(this) == GlobalVoidType()) { returnType = GlobalVoidType(); } else { returnType = returnTypeAnnotation->GetType(this); @@ -926,7 +914,7 @@ checker::ETSFunctionType *ETSChecker::BuildFunctionSignature(ir::ScriptFunction ValidateMainSignature(func); } - auto *returnType = ComposeReturnType(func, funcName, isConstructSig); + auto *returnType = ComposeReturnType(func); auto *signature = ComposeSignature(func, signatureInfo, returnType, nameVar); if (isConstructSig) { signature->AddSignatureFlag(SignatureFlags::CONSTRUCT); @@ -1569,16 +1557,7 @@ void ETSChecker::ResolveLambdaObjectInvoke(ir::ClassDefinition *lambdaObject, ir } // Fill out the type information for the body of the invoke function - auto *resolvedLambdaInvokeFunctionBody = - ResolveLambdaObjectInvokeFuncBody(lambdaObject, lambda, proxyMethod, isStatic, ifaceOverride); - resolvedLambdaInvokeFunctionBody->SetParent(invokeFunc->Body()); - invokeFunc->Body()->AsBlockStatement()->Statements().push_back(resolvedLambdaInvokeFunctionBody); - - if (resolvedLambdaInvokeFunctionBody->IsExpressionStatement()) { - auto *const returnStatement = Allocator()->New(nullptr); - returnStatement->SetParent(invokeFunc->Body()); - invokeFunc->Body()->AsBlockStatement()->Statements().push_back(returnStatement); - } + ResolveLambdaObjectInvokeFuncBody(lambdaObject, lambda, proxyMethod, isStatic, ifaceOverride); } /* Pulled out to appease the Chinese checker */ @@ -1673,10 +1652,9 @@ static ArenaVector ResolveCallParametersForLambdaFuncBody(ETSC return callParams; } -ir::Statement *ETSChecker::ResolveLambdaObjectInvokeFuncBody(ir::ClassDefinition *lambdaObject, - ir::ArrowFunctionExpression *lambda, - ir::MethodDefinition *proxyMethod, bool isStatic, - bool ifaceOverride) +void ETSChecker::ResolveLambdaObjectInvokeFuncBody(ir::ClassDefinition *lambdaObject, + ir::ArrowFunctionExpression *lambda, + ir::MethodDefinition *proxyMethod, bool isStatic, bool ifaceOverride) { const auto &lambdaBody = lambdaObject->Body(); auto *proxySignature = proxyMethod->Function()->Signature(); @@ -1688,7 +1666,6 @@ ir::Statement *ETSChecker::ResolveLambdaObjectInvokeFuncBody(ir::ClassDefinition fieldIdent = AllocNode(proxySignature->Owner()->Name(), Allocator()); fieldPropType = proxySignature->Owner(); fieldIdent->SetVariable(proxySignature->Owner()->Variable()); - fieldIdent->SetTsType(fieldPropType); } else { // Otherwise, we call the proxy method through the saved 'this' field auto *savedThis = lambdaBody[lambdaBody.size() - 4]->AsClassProperty(); @@ -1696,8 +1673,8 @@ ir::Statement *ETSChecker::ResolveLambdaObjectInvokeFuncBody(ir::ClassDefinition fieldPropType = fieldProp->TsType()->AsETSObjectType(); fieldIdent = Allocator()->New(savedThis->Key()->AsIdentifier()->Name(), Allocator()); fieldIdent->SetVariable(fieldProp); - fieldIdent->SetTsType(fieldPropType); } + fieldIdent->SetTsType(fieldPropType); // Set the type information for the proxy function call auto *funcIdent = AllocNode(proxyMethod->Function()->Id()->Name(), Allocator()); @@ -1717,15 +1694,25 @@ ir::Statement *ETSChecker::ResolveLambdaObjectInvokeFuncBody(ir::ClassDefinition resolvedCall->SetTsType(proxySignature->ReturnType()); resolvedCall->SetSignature(proxySignature); + ir::Expression *returnExpression = nullptr; if (proxySignature->ReturnType()->IsETSVoidType()) { - return AllocNode(resolvedCall); - } - - if (ifaceOverride && resolvedCall->TsType()->HasTypeFlag(checker::TypeFlag::ETS_PRIMITIVE)) { - resolvedCall->AddBoxingUnboxingFlags(GetBoxingFlag(resolvedCall->TsType())); + auto *expressionStatementNode = AllocNode(resolvedCall); + expressionStatementNode->SetParent(invokeFunc->Body()); + invokeFunc->Body()->AsBlockStatement()->Statements().push_back(expressionStatementNode); + if (ifaceOverride) { + returnExpression = Allocator()->New(); + returnExpression->Check(this); + } + } else { + if (ifaceOverride && resolvedCall->TsType()->HasTypeFlag(checker::TypeFlag::ETS_PRIMITIVE)) { + resolvedCall->AddBoxingUnboxingFlags(GetBoxingFlag(resolvedCall->TsType())); + } + returnExpression = resolvedCall; } - return AllocNode(resolvedCall); + auto *returnStatement = Allocator()->New(returnExpression); + returnStatement->SetParent(invokeFunc->Body()); + invokeFunc->Body()->AsBlockStatement()->Statements().push_back(returnStatement); } void ETSChecker::ResolveLambdaObjectCtor(ir::ClassDefinition *lambdaObject) @@ -2605,16 +2592,7 @@ void ETSChecker::ResolveLambdaObjectInvoke(ir::ClassDefinition *lambdaObject, Si invokeFunc->Id()->Variable()->AsLocalVariable()); // Fill out the type information for the body of the invoke function - auto *resolvedLambdaInvokeFunctionBody = - ResolveLambdaObjectInvokeFuncBody(lambdaObject, signatureRef, ifaceOverride); - resolvedLambdaInvokeFunctionBody->SetParent(invokeFunc->Body()); - invokeFunc->Body()->AsBlockStatement()->Statements().push_back(resolvedLambdaInvokeFunctionBody); - - if (resolvedLambdaInvokeFunctionBody->IsExpressionStatement()) { - auto *const returnStatement = Allocator()->New(nullptr); - returnStatement->SetParent(invokeFunc->Body()); - invokeFunc->Body()->AsBlockStatement()->Statements().push_back(returnStatement); - } + ResolveLambdaObjectInvokeFuncBody(lambdaObject, signatureRef, ifaceOverride); } static ir::Expression *BuildParamExpression(ETSChecker *checker, ir::Identifier *paramIdent, Type *type) @@ -2689,8 +2667,8 @@ static ArenaVector ResolveCallParametersForLambdaFuncBody(ETSC return callParams; } -ir::Statement *ETSChecker::ResolveLambdaObjectInvokeFuncBody(ir::ClassDefinition *lambdaObject, Signature *signatureRef, - bool ifaceOverride) +void ETSChecker::ResolveLambdaObjectInvokeFuncBody(ir::ClassDefinition *lambdaObject, Signature *signatureRef, + bool ifaceOverride) { const auto &lambdaBody = lambdaObject->Body(); bool isStaticReference = signatureRef->HasSignatureFlag(SignatureFlags::STATIC); @@ -2703,7 +2681,6 @@ ir::Statement *ETSChecker::ResolveLambdaObjectInvokeFuncBody(ir::ClassDefinition fieldIdent->SetReference(); fieldPropType = signatureRef->Owner(); fieldIdent->SetVariable(signatureRef->Owner()->Variable()); - fieldIdent->SetTsType(fieldPropType); } else { // Otherwise, we should call the referenced function through the saved field, which hold the object instance // reference @@ -2712,8 +2689,8 @@ ir::Statement *ETSChecker::ResolveLambdaObjectInvokeFuncBody(ir::ClassDefinition fieldIdent = AllocNode("field0", Allocator()); fieldIdent->SetReference(); fieldIdent->SetVariable(fieldProp); - fieldIdent->SetTsType(fieldPropType); } + fieldIdent->SetTsType(fieldPropType); // Set the type information for the function reference call auto *funcIdent = AllocNode(signatureRef->Function()->Id()->Name(), Allocator()); @@ -2734,15 +2711,25 @@ ir::Statement *ETSChecker::ResolveLambdaObjectInvokeFuncBody(ir::ClassDefinition resolvedCall->SetTsType(signatureRef->ReturnType()); resolvedCall->SetSignature(signatureRef); + ir::Expression *returnExpression = nullptr; if (signatureRef->ReturnType()->IsETSVoidType()) { - return AllocNode(resolvedCall); - } - - if (ifaceOverride && resolvedCall->TsType()->HasTypeFlag(checker::TypeFlag::ETS_PRIMITIVE)) { - resolvedCall->AddBoxingUnboxingFlags(GetBoxingFlag(resolvedCall->TsType())); + auto *expressionStatementNode = AllocNode(resolvedCall); + expressionStatementNode->SetParent(invokeFunc->Body()); + invokeFunc->Body()->AsBlockStatement()->Statements().push_back(expressionStatementNode); + if (ifaceOverride) { + returnExpression = Allocator()->New(); + returnExpression->Check(this); + } + } else { + if (ifaceOverride && resolvedCall->TsType()->HasTypeFlag(checker::TypeFlag::ETS_PRIMITIVE)) { + resolvedCall->AddBoxingUnboxingFlags(GetBoxingFlag(resolvedCall->TsType())); + } + returnExpression = resolvedCall; } - return AllocNode(resolvedCall); + auto *returnStatement = Allocator()->New(returnExpression); + returnStatement->SetParent(invokeFunc->Body()); + invokeFunc->Body()->AsBlockStatement()->Statements().push_back(returnStatement); } bool ETSChecker::AreOverrideEquivalent(Signature *const s1, Signature *const s2) @@ -2765,7 +2752,8 @@ bool ETSChecker::IsReturnTypeSubstitutable(Signature *const s1, Signature *const // type R2 if any of the following is true: // - If R1 is a primitive type then R2 is identical to R1. - if (r1->HasTypeFlag(TypeFlag::ETS_PRIMITIVE | TypeFlag::ETS_ENUM | TypeFlag::ETS_STRING_ENUM)) { + if (r1->HasTypeFlag(TypeFlag::ETS_PRIMITIVE | TypeFlag::ETS_ENUM | TypeFlag::ETS_STRING_ENUM | + TypeFlag::ETS_VOID)) { return Relation()->IsIdenticalTo(r2, r1); } diff --git a/ets2panda/checker/ets/helpers.cpp b/ets2panda/checker/ets/helpers.cpp index 430569dcc9..0d03030ed0 100644 --- a/ets2panda/checker/ets/helpers.cpp +++ b/ets2panda/checker/ets/helpers.cpp @@ -81,7 +81,7 @@ void ETSChecker::CheckTruthinessOfType(ir::Expression *expr) ThrowTypeError("Condition must be of possible condition type", expr->Start()); } - if (unboxedType == GlobalBuiltinVoidType() || unboxedType->IsETSVoidType()) { + if (unboxedType->IsETSVoidType()) { ThrowTypeError("An expression of type 'void' cannot be tested for truthiness", expr->Start()); } @@ -1791,7 +1791,7 @@ Type *ETSChecker::PrimitiveTypeAsETSBuiltinType(Type *objectType) return objectType; } - if (!objectType->HasTypeFlag(TypeFlag::ETS_PRIMITIVE) || objectType->IsETSVoidType()) { + if (!objectType->HasTypeFlag(TypeFlag::ETS_PRIMITIVE)) { return nullptr; } @@ -1815,7 +1815,9 @@ void ETSChecker::AddBoxingUnboxingFlagsToNode(ir::AstNode *node, Type *boxingUnb Type *ETSChecker::MaybePromotedBuiltinType(Type *type) const { - return type->HasTypeFlag(TypeFlag::ETS_PRIMITIVE) ? checker::BoxingConverter::ETSTypeFromSource(this, type) : type; + return type->HasTypeFlag(TypeFlag::ETS_PRIMITIVE) && !type->IsETSVoidType() + ? checker::BoxingConverter::ETSTypeFromSource(this, type) + : type; } Type const *ETSChecker::MaybePromotedBuiltinType(Type const *type) const diff --git a/ets2panda/checker/ets/typeCreation.cpp b/ets2panda/checker/ets/typeCreation.cpp index b02188e7a1..1b317b8e17 100644 --- a/ets2panda/checker/ets/typeCreation.cpp +++ b/ets2panda/checker/ets/typeCreation.cpp @@ -228,7 +228,6 @@ std::map &GetNameToTypeIdMap() {compiler::Signatures::BUILTIN_LONG_BOX_CLASS, GlobalTypeId::ETS_LONG_BOX_BUILTIN}, {compiler::Signatures::BUILTIN_FLOAT_BOX_CLASS, GlobalTypeId::ETS_FLOAT_BOX_BUILTIN}, {compiler::Signatures::BUILTIN_DOUBLE_BOX_CLASS, GlobalTypeId::ETS_DOUBLE_BOX_BUILTIN}, - {compiler::Signatures::BUILTIN_VOID_CLASS, GlobalTypeId::ETS_VOID_BUILTIN}, }; return nameToTypeId; @@ -244,7 +243,6 @@ std::map> & {compiler::Signatures::BUILTIN_ERROR_CLASS, &ETSChecker::GlobalBuiltinErrorType}, {compiler::Signatures::BUILTIN_TYPE_CLASS, &ETSChecker::GlobalBuiltinTypeType}, {compiler::Signatures::BUILTIN_PROMISE_CLASS, &ETSChecker::GlobalBuiltinPromiseType}, - {compiler::Signatures::BUILTIN_VOID_CLASS, &ETSChecker::GlobalBuiltinVoidType}, }; return nameToGlobalType; diff --git a/ets2panda/checker/ets/typeRelationContext.cpp b/ets2panda/checker/ets/typeRelationContext.cpp index f166041961..d958481084 100644 --- a/ets2panda/checker/ets/typeRelationContext.cpp +++ b/ets2panda/checker/ets/typeRelationContext.cpp @@ -121,12 +121,17 @@ void InstantiationContext::InstantiateType(ETSObjectType *type, ir::TSTypeParame if (paramType->HasTypeFlag(TypeFlag::ETS_PRIMITIVE)) { checker_->Relation()->SetNode(it); + auto *const boxedTypeArg = checker_->PrimitiveTypeAsETSBuiltinType(paramType); ASSERT(boxedTypeArg); paramType = boxedTypeArg->Instantiate(checker_->Allocator(), checker_->Relation(), checker_->GetGlobalTypesHolder()); } + if (paramType->IsETSVoidType()) { + paramType = checker_->GlobalETSUndefinedType(); + } + typeArgTypes.push_back(paramType); } } diff --git a/ets2panda/checker/types/ets/etsVoidType.cpp b/ets2panda/checker/types/ets/etsVoidType.cpp index 344b02d418..e2380e4caa 100644 --- a/ets2panda/checker/types/ets/etsVoidType.cpp +++ b/ets2panda/checker/types/ets/etsVoidType.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 - 2023 Huawei Device Co., Ltd. + * Copyright (c) 2021 - 2024 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 @@ -18,11 +18,18 @@ namespace ark::es2panda::checker { void ETSVoidType::Identical(TypeRelation *relation, Type *other) { - if (other->IsETSVoidType()) { + if (other->IsETSVoidType() || other->IsETSUndefinedType()) { relation->Result(true); } } +bool ETSVoidType::AssignmentSource(TypeRelation *relation, Type *target) +{ + Identical(relation, target); + + return relation->IsTrue(); +} + void ETSVoidType::AssignmentTarget([[maybe_unused]] TypeRelation *relation, [[maybe_unused]] Type *source) {} Type *ETSVoidType::Instantiate([[maybe_unused]] ArenaAllocator *allocator, [[maybe_unused]] TypeRelation *relation, diff --git a/ets2panda/checker/types/ets/etsVoidType.h b/ets2panda/checker/types/ets/etsVoidType.h index b0c8c70e06..bf6f9fcf7f 100644 --- a/ets2panda/checker/types/ets/etsVoidType.h +++ b/ets2panda/checker/types/ets/etsVoidType.h @@ -25,6 +25,7 @@ public: void Identical(TypeRelation *relation, Type *other) override; void AssignmentTarget(TypeRelation *relation, Type *source) override; + bool AssignmentSource(TypeRelation *relation, Type *target) override; Type *Instantiate(ArenaAllocator *allocator, TypeRelation *relation, GlobalTypesHolder *globalTypes) override; void ToString(std::stringstream &ss, [[maybe_unused]] bool precise) const override diff --git a/ets2panda/checker/types/globalTypesHolder.cpp b/ets2panda/checker/types/globalTypesHolder.cpp index 08b90b2194..08cfc89bd1 100644 --- a/ets2panda/checker/types/globalTypesHolder.cpp +++ b/ets2panda/checker/types/globalTypesHolder.cpp @@ -134,7 +134,6 @@ GlobalTypesHolder::GlobalTypesHolder(ArenaAllocator *allocator) : builtinNameMap builtinNameMappings_.emplace("LongBox", GlobalTypeId::ETS_LONG_BOX_BUILTIN); builtinNameMappings_.emplace("FloatBox", GlobalTypeId::ETS_FLOAT_BOX_BUILTIN); builtinNameMappings_.emplace("DoubleBox", GlobalTypeId::ETS_DOUBLE_BOX_BUILTIN); - builtinNameMappings_.emplace("void", GlobalTypeId::ETS_VOID_BUILTIN); builtinNameMappings_.emplace("never", GlobalTypeId::ETS_NEVER_BUILTIN); // ETS escompat layer @@ -333,11 +332,6 @@ Type *GlobalTypesHolder::GlobalETSVoidType() return globalTypes_.at(static_cast(GlobalTypeId::ETS_VOID)); } -Type *GlobalTypesHolder::GlobalBuiltinVoidType() -{ - return globalTypes_.at(static_cast(GlobalTypeId::ETS_VOID_BUILTIN)); -} - Type *GlobalTypesHolder::GlobalETSObjectType() { return globalTypes_.at(static_cast(GlobalTypeId::ETS_OBJECT_BUILTIN)); diff --git a/ets2panda/checker/types/globalTypesHolder.h b/ets2panda/checker/types/globalTypesHolder.h index 19fb4abd0c..2e6e2badaf 100644 --- a/ets2panda/checker/types/globalTypesHolder.h +++ b/ets2panda/checker/types/globalTypesHolder.h @@ -53,7 +53,6 @@ enum class GlobalTypeId { ETS_BOOLEAN, ETS_STRING, ETS_VOID, - ETS_VOID_BUILTIN, ETS_OBJECT_BUILTIN, ETS_NULL, ETS_UNDEFINED, @@ -147,7 +146,6 @@ public: Type *GlobalStringType(); Type *GlobalBooleanType(); Type *GlobalVoidType(); - Type *GlobalBuiltinVoidType(); Type *GlobalNullType(); Type *GlobalUndefinedType(); Type *GlobalUnknownType(); diff --git a/ets2panda/checker/types/typeFlag.h b/ets2panda/checker/types/typeFlag.h index ef3a9323e2..7f90671517 100644 --- a/ets2panda/checker/types/typeFlag.h +++ b/ets2panda/checker/types/typeFlag.h @@ -89,7 +89,7 @@ enum class TypeFlag : uint64_t { ETS_TYPE = BYTE | SHORT | INT | LONG | FLOAT | DOUBLE | CHAR | ETS_BOOLEAN | ETS_VOID | ETS_OBJECT | ETS_ARRAY | WILDCARD | ETS_TYPE_PARAMETER | ETS_ENUM | ETS_STRING_ENUM | ETS_DYNAMIC_TYPE | ETS_UNION | ETS_NULL | ETS_UNDEFINED | ETS_NONNULLISH, - ETS_PRIMITIVE = BYTE | SHORT | INT | LONG | FLOAT | DOUBLE | CHAR | ETS_BOOLEAN | ETS_VOID, + ETS_PRIMITIVE = BYTE | SHORT | INT | LONG | FLOAT | DOUBLE | CHAR | ETS_BOOLEAN, ETS_PRIMITIVE_RETURN = BYTE | SHORT | INT | LONG | FLOAT | DOUBLE | CHAR | ETS_BOOLEAN | ETS_ENUM, ETS_ARRAY_INDEX = BYTE | SHORT | INT, ETS_INTEGRAL = BYTE | CHAR | SHORT | INT | LONG, diff --git a/ets2panda/compiler/core/ETSCompiler.cpp b/ets2panda/compiler/core/ETSCompiler.cpp index 1b75ae5caf..8d3933ed29 100644 --- a/ets2panda/compiler/core/ETSCompiler.cpp +++ b/ets2panda/compiler/core/ETSCompiler.cpp @@ -1764,29 +1764,35 @@ void ETSCompiler::Compile(const ir::ReturnStatement *st) const { ETSGen *etsg = GetETSGen(); if (st->Argument() == nullptr) { - if (st->ReturnType() == nullptr || st->ReturnType()->IsETSVoidType()) { - if (etsg->ExtendWithFinalizer(st->parent_, st)) { - return; - } - - if (etsg->CheckControlFlowChange()) { - etsg->ControlFlowChangeBreak(); - } - etsg->EmitReturnVoid(st); + if (etsg->ExtendWithFinalizer(st->parent_, st)) { return; } - etsg->LoadBuiltinVoid(st); - } else { - auto ttctx = compiler::TargetTypeContext(etsg, etsg->ReturnType()); - - if (!etsg->TryLoadConstantExpression(st->Argument())) { - st->Argument()->Compile(etsg); + if (etsg->CheckControlFlowChange()) { + etsg->ControlFlowChangeBreak(); } - etsg->ApplyConversion(st->Argument(), nullptr); - etsg->ApplyConversion(st->Argument(), st->ReturnType()); + + etsg->EmitReturnVoid(st); + + return; } + if (st->Argument()->IsCallExpression() && + st->Argument()->AsCallExpression()->Signature()->ReturnType()->IsETSVoidType()) { + st->Argument()->Compile(etsg); + etsg->EmitReturnVoid(st); + return; + } + + auto ttctx = compiler::TargetTypeContext(etsg, etsg->ReturnType()); + + if (!etsg->TryLoadConstantExpression(st->Argument())) { + st->Argument()->Compile(etsg); + } + + etsg->ApplyConversion(st->Argument(), nullptr); + etsg->ApplyConversion(st->Argument(), st->ReturnType()); + if (etsg->ExtendWithFinalizer(st->parent_, st)) { return; } diff --git a/ets2panda/compiler/core/ETSGen.cpp b/ets2panda/compiler/core/ETSGen.cpp index 1d6a51b9ab..6dbc5b41d7 100644 --- a/ets2panda/compiler/core/ETSGen.cpp +++ b/ets2panda/compiler/core/ETSGen.cpp @@ -41,6 +41,7 @@ #include "checker/ETSchecker.h" #include "checker/ets/boxingConverter.h" #include "checker/types/ets/etsObjectType.h" +#include "checker/types/ets/etsAsyncFuncReturnType.h" #include "checker/types/ets/types.h" #include "parser/program/program.h" @@ -717,11 +718,18 @@ VReg ETSGen::GetThisReg() const void ETSGen::LoadDefaultValue([[maybe_unused]] const ir::AstNode *node, [[maybe_unused]] const checker::Type *type) { + if (type->IsETSAsyncFuncReturnType()) { + LoadDefaultValue(node, type->AsETSAsyncFuncReturnType()->GetPromiseTypeArg()); + return; + } + if (type->IsETSUnionType()) { type = Checker()->GetGlobalTypesHolder()->GlobalETSObjectType(); } - if (type->IsETSObjectType() || type->IsETSArrayType() || type->IsETSTypeParameter()) { + if (type->IsETSObjectType() || type->IsETSArrayType() || type->IsETSTypeParameter() || type->IsETSNullType()) { LoadAccumulatorNull(node, type); + } else if (type->IsETSUndefinedType()) { + LoadAccumulatorUndefined(node); } else if (type->IsETSBooleanType()) { LoadAccumulatorBoolean(node, type->AsETSBooleanType()->GetValue()); } else { @@ -735,12 +743,6 @@ void ETSGen::EmitReturnVoid(const ir::AstNode *node) Sa().Emit(node); } -void ETSGen::LoadBuiltinVoid(const ir::AstNode *node) -{ - LoadStaticProperty(node, Checker()->GlobalBuiltinVoidType(), - FormClassPropReference(Checker()->GlobalBuiltinVoidType(), "void_instance")); -} - void ETSGen::ReturnAcc(const ir::AstNode *node) { const auto *const accType = GetAccumulatorType(); @@ -931,6 +933,11 @@ void ETSGen::CheckedReferenceNarrowingObject(const ir::AstNode *node, const chec void ETSGen::CheckedReferenceNarrowing(const ir::AstNode *node, const checker::Type *target) { + if (target->IsETSVoidType()) { + SetAccumulatorType(target); + return; + } + target = Checker()->GetApparentType(target); ASSERT(target->IsETSReferenceType()); diff --git a/ets2panda/compiler/core/ETSGen.h b/ets2panda/compiler/core/ETSGen.h index 1daa3360f7..76a55cea47 100644 --- a/ets2panda/compiler/core/ETSGen.h +++ b/ets2panda/compiler/core/ETSGen.h @@ -88,7 +88,6 @@ public: void LoadDefaultValue(const ir::AstNode *node, const checker::Type *type); void EmitReturnVoid(const ir::AstNode *node); - void LoadBuiltinVoid(const ir::AstNode *node); void ReturnAcc(const ir::AstNode *node); void BranchIfIsInstance(const ir::AstNode *node, VReg srcReg, const checker::Type *target, Label *ifTrue); @@ -258,6 +257,26 @@ public: Sa().Emit(node, ifNull); } + void BranchIfUndefined([[maybe_unused]] const ir::AstNode *node, [[maybe_unused]] Label *ifUndefined) + { +#ifdef PANDA_WITH_ETS + Sa().Emit(node); + Sa().Emit(node, ifUndefined); +#else + UNREACHABLE(); +#endif // PANDA_WITH_ETS + } + + void BranchIfNotUndefined([[maybe_unused]] const ir::AstNode *node, [[maybe_unused]] Label *ifUndefined) + { +#ifdef PANDA_WITH_ETS + Sa().Emit(node); + Sa().Emit(node, ifUndefined); +#else + UNREACHABLE(); +#endif // PANDA_WITH_ETS + } + void BranchIfNotNull(const ir::AstNode *node, Label *ifNotNull) { Sa().Emit(node, ifNotNull); diff --git a/ets2panda/compiler/core/ETSfunction.cpp b/ets2panda/compiler/core/ETSfunction.cpp index 96faec5de4..ff601154af 100644 --- a/ets2panda/compiler/core/ETSfunction.cpp +++ b/ets2panda/compiler/core/ETSfunction.cpp @@ -57,68 +57,21 @@ void ETSFunction::CallImplicitCtor(ETSGen *etsg) void ETSFunction::CompileSourceBlock(ETSGen *etsg, const ir::BlockStatement *block) { - auto const checkInitializer = [](ArenaVector const &nodes) -> bool { - for (auto const *const node : nodes) { - if (node->IsMethodDefinition() && node->AsClassElement()->Key()->IsIdentifier()) { - if (node->AsClassElement()->Id()->Name() == compiler::Signatures::INIT_METHOD) { - return false; - } - } - } - return true; - }; - auto *scriptFunc = etsg->RootNode()->AsScriptFunction(); if (scriptFunc->IsEnum()) { // NOTE: add enum methods } else if (scriptFunc->IsStaticBlock()) { - const auto *classDef = etsg->ContainingObjectType()->GetDeclNode()->AsClassDefinition(); - - // Check if it is the Global class static constructor and the special '_$init$_" method exists - bool const compileInitializer = classDef->IsGlobal() ? checkInitializer(classDef->Body()) : true; - - for (const auto *prop : classDef->Body()) { - if (!prop->IsClassProperty() || !prop->IsStatic()) { - continue; - } - - // Don't compile variable initializers if they present in '_$init$_" method - auto *const item = prop->AsClassProperty(); - auto *const value = item->Value(); - if (value != nullptr && (compileInitializer || item->IsConst() || value->IsArrowFunctionExpression())) { - item->Compile(etsg); - } - } + CompileAsStaticBlock(etsg); } else if (scriptFunc->IsConstructor()) { - if (scriptFunc->IsImplicitSuperCallNeeded()) { - CallImplicitCtor(etsg); - } - - const auto *classDef = etsg->ContainingObjectType()->GetDeclNode()->AsClassDefinition(); - - for (const auto *prop : classDef->Body()) { - if (!prop->IsClassProperty() || prop->IsStatic()) { - continue; - } - - prop->AsClassProperty()->Compile(etsg); - } + CompileAsConstructor(etsg, scriptFunc); } const auto &statements = block->Statements(); if (statements.empty()) { etsg->SetFirstStmt(block); - if (scriptFunc->IsConstructor() || scriptFunc->IsStaticBlock() || scriptFunc->IsEntryPoint()) { - ASSERT(etsg->ReturnType() != etsg->Checker()->GlobalBuiltinVoidType()); - etsg->EmitReturnVoid(block); - } else { - ASSERT(!etsg->ReturnType()->IsETSVoidType()); - etsg->LoadBuiltinVoid(block); - etsg->ReturnAcc(block); - } - + ExtendWithDefaultReturn(etsg, block, scriptFunc); return; } @@ -127,20 +80,69 @@ void ETSFunction::CompileSourceBlock(ETSGen *etsg, const ir::BlockStatement *blo etsg->CompileStatements(statements); if (!statements.back()->IsReturnStatement()) { - if (scriptFunc->IsConstructor() || scriptFunc->IsStaticBlock() || scriptFunc->IsEntryPoint()) { - ASSERT(etsg->ReturnType() != etsg->Checker()->GlobalBuiltinVoidType()); - etsg->EmitReturnVoid(statements.back()); - return; + ExtendWithDefaultReturn(etsg, statements.back(), scriptFunc); + } +} + +void ETSFunction::ExtendWithDefaultReturn(ETSGen *etsg, const ir::AstNode *node, const ir::ScriptFunction *scriptFunc) +{ + if (etsg->ReturnType()->IsETSVoidType()) { + etsg->EmitReturnVoid(node); + return; + } + + if (scriptFunc->ReturnTypeAnnotation() != nullptr && scriptFunc->ReturnTypeAnnotation()->TsType() != nullptr && + scriptFunc->ReturnTypeAnnotation()->TsType()->IsETSAsyncFuncReturnType()) { + etsg->LoadDefaultValue(node, scriptFunc->ReturnTypeAnnotation()->TsType()); + } else { + etsg->LoadDefaultValue(node, scriptFunc->Signature()->ReturnType()); + } + etsg->ReturnAcc(node); +} + +void ETSFunction::CompileAsStaticBlock(ETSGen *etsg) +{ + const auto *classDef = etsg->ContainingObjectType()->GetDeclNode()->AsClassDefinition(); + + auto const checkInitializer = [](ArenaVector const &nodes) -> bool { + for (auto const *const node : nodes) { + if (node->IsMethodDefinition() && node->AsClassElement()->Key()->IsIdentifier() && + node->AsClassElement()->Id()->Name() == compiler::Signatures::INIT_METHOD) { + return false; + } } + return true; + }; + + // Check if it is the Global class static constructor and the special '_$init$_" method exists + bool const compileInitializer = classDef->IsGlobal() ? checkInitializer(classDef->Body()) : true; + + for (const auto *prop : classDef->Body()) { + if (!prop->IsClassProperty() || !prop->IsStatic()) { + continue; + } + + // Don't compile variable initializers if they present in '_$init$_" method + auto *const item = prop->AsClassProperty(); + if (item->Value() != nullptr && + (compileInitializer || item->IsConst() || item->Value()->IsArrowFunctionExpression())) { + item->Compile(etsg); + } + } +} + +void ETSFunction::CompileAsConstructor(ETSGen *etsg, const ir::ScriptFunction *scriptFunc) +{ + if (scriptFunc->IsImplicitSuperCallNeeded()) { + CallImplicitCtor(etsg); + } - ASSERT(!etsg->ReturnType()->IsETSVoidType()); + const auto *classDef = etsg->ContainingObjectType()->GetDeclNode()->AsClassDefinition(); - if (scriptFunc->Signature()->ReturnType() == etsg->Checker()->GlobalBuiltinVoidType()) { - etsg->LoadBuiltinVoid(statements.back()); - } else { - etsg->LoadDefaultValue(statements.back(), scriptFunc->Signature()->ReturnType()); + for (const auto *prop : classDef->Body()) { + if (prop->IsClassProperty() && !prop->IsStatic()) { + prop->AsClassProperty()->Compile(etsg); } - etsg->ReturnAcc(statements.back()); } } diff --git a/ets2panda/compiler/core/ETSfunction.h b/ets2panda/compiler/core/ETSfunction.h index 312ccea6a7..7251ed9f34 100644 --- a/ets2panda/compiler/core/ETSfunction.h +++ b/ets2panda/compiler/core/ETSfunction.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 - 2023 Huawei Device Co., Ltd. + * Copyright (c) 2021 - 2024 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 @@ -36,8 +36,11 @@ private: static void GenerateEnumMembers(ETSGen *etsg, const ir::AstNode *node, VReg arrayObj, const ir::TSEnumMember *enumMember, int32_t index); static void CompileSourceBlock(ETSGen *etsg, const ir::BlockStatement *block); + static void CompileAsStaticBlock(ETSGen *etsg); + static void CompileAsConstructor(ETSGen *etsg, const ir::ScriptFunction *scriptFunc); static void CompileFunction(ETSGen *etsg); static void CallImplicitCtor(ETSGen *etsg); + static void ExtendWithDefaultReturn(ETSGen *etsg, const ir::AstNode *node, const ir::ScriptFunction *scriptFunc); }; } // namespace ark::es2panda::compiler diff --git a/ets2panda/compiler/core/dynamicContext.cpp b/ets2panda/compiler/core/dynamicContext.cpp index d1d3179c84..4c8ecf6556 100644 --- a/ets2panda/compiler/core/dynamicContext.cpp +++ b/ets2panda/compiler/core/dynamicContext.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 @@ -225,52 +225,7 @@ void ETSTryContext::EmitFinalizer( etsg->Branch(tryStmt_, finalizerTable->LabelSet().CatchEnd()); for (std::pair insertion : finalizerInsertions) { - etsg->SetLabel(tryStmt_, insertion.first.Begin()); - - ASSERT(insertion.second != nullptr); - bool isReturn = insertion.second->IsReturnStatement(); - - compiler::RegScope rs(etsg); - compiler::VReg res = etsg->AllocReg(); - - if (isReturn) { - etsg->SetAccumulatorType(insertion.second->AsReturnStatement()->ReturnType()); - etsg->StoreAccumulator(tryStmt_, res); - etsg->SetVRegType(res, insertion.second->AsReturnStatement()->ReturnType()); - } - - // Second compile of the finaly clause, executed if the statement executed normally, but abrupted by - // return, break, or continue statements. - tryStmt_->FinallyBlock()->Compile(etsg); - - if (isReturn) { - etsg->SetAccumulatorType(insertion.second->AsReturnStatement()->ReturnType()); - etsg->LoadAccumulator(tryStmt_, res); - } - - if (insertion.first.End() != nullptr) { - etsg->Branch(tryStmt_, insertion.first.End()); - } else if (isReturn) { - if (etsg->CheckControlFlowChange()) { - etsg->StoreAccumulator(tryStmt_, res); - etsg->ControlFlowChangeBreak(); - etsg->LoadAccumulator(tryStmt_, res); - } - - if (insertion.second->AsReturnStatement()->ReturnType()->IsETSVoidType()) { - etsg->EmitReturnVoid(tryStmt_); - } else { - etsg->ReturnAcc(tryStmt_); - } - } else if (insertion.second->IsBreakStatement()) { - compiler::Label *target = etsg->ControlFlowChangeBreak(insertion.second->AsBreakStatement()->Ident()); - etsg->Branch(tryStmt_, target); - } else if (insertion.second->IsContinueStatement()) { - compiler::Label *target = etsg->ControlFlowChangeContinue(insertion.second->AsContinueStatement()->Ident()); - etsg->Branch(tryStmt_, target); - } else { - UNREACHABLE(); - } + EmitFinalizerInsertion(etsg, insertion.first, insertion.second); } etsg->SetLabel(tryStmt_, finalizerTable->LabelSet().CatchBegin()); @@ -285,4 +240,50 @@ void ETSTryContext::EmitFinalizer( etsg->SetLabel(tryStmt_, finalizerTable->LabelSet().CatchEnd()); } +void ETSTryContext::EmitFinalizerInsertion(ETSGen *etsg, compiler::LabelPair labelPair, const ir::Statement *statement) +{ + etsg->SetLabel(tryStmt_, labelPair.Begin()); + + ASSERT(statement != nullptr); + bool isReturn = statement->IsReturnStatement(); + + compiler::RegScope rs(etsg); + compiler::VReg res = etsg->AllocReg(); + + if (isReturn) { + etsg->SetAccumulatorType(statement->AsReturnStatement()->ReturnType()); + etsg->StoreAccumulator(tryStmt_, res); + etsg->SetVRegType(res, statement->AsReturnStatement()->ReturnType()); + } + + // Second compile of the finaly clause, executed if the statement executed normally, but abrupted by + // return, break, or continue statements. + tryStmt_->FinallyBlock()->Compile(etsg); + + if (isReturn) { + etsg->SetAccumulatorType(statement->AsReturnStatement()->ReturnType()); + etsg->LoadAccumulator(tryStmt_, res); + } + + if (labelPair.End() != nullptr) { + etsg->Branch(tryStmt_, labelPair.End()); + } else if (isReturn) { + if (etsg->CheckControlFlowChange()) { + etsg->StoreAccumulator(tryStmt_, res); + etsg->ControlFlowChangeBreak(); + etsg->LoadAccumulator(tryStmt_, res); + } + + etsg->ReturnAcc(tryStmt_); + } else if (statement->IsBreakStatement()) { + compiler::Label *target = etsg->ControlFlowChangeBreak(statement->AsBreakStatement()->Ident()); + etsg->Branch(tryStmt_, target); + } else if (statement->IsContinueStatement()) { + compiler::Label *target = etsg->ControlFlowChangeContinue(statement->AsContinueStatement()->Ident()); + etsg->Branch(tryStmt_, target); + } else { + UNREACHABLE(); + } +} + } // namespace ark::es2panda::compiler diff --git a/ets2panda/compiler/core/dynamicContext.h b/ets2panda/compiler/core/dynamicContext.h index 4216c348be..2a2f0838a2 100644 --- a/ets2panda/compiler/core/dynamicContext.h +++ b/ets2panda/compiler/core/dynamicContext.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 @@ -287,6 +287,7 @@ public: void EmitFinalizer(LabelPair trycatchLabelPair, const ArenaVector> &finalizerInsertions); + void EmitFinalizerInsertion(ETSGen *etsg, compiler::LabelPair labelPair, const ir::Statement *statement); private: const ir::TryStatement *tryStmt_ {}; diff --git a/ets2panda/compiler/lowering/ets/lambdaLowering.cpp b/ets2panda/compiler/lowering/ets/lambdaLowering.cpp index cb8cf507c3..d3eae59018 100644 --- a/ets2panda/compiler/lowering/ets/lambdaLowering.cpp +++ b/ets2panda/compiler/lowering/ets/lambdaLowering.cpp @@ -27,13 +27,21 @@ static ir::AstNode *ConvertExpression(checker::ETSChecker *const checker, ir::Ar auto *const expr = function->Body()->AsExpression(); ArenaVector statements(checker->Allocator()->Adapter()); - statements.emplace_back(checker->AllocNode(expr)); + + if ((function->ReturnTypeAnnotation() != nullptr && function->ReturnTypeAnnotation()->IsETSPrimitiveType() && + function->ReturnTypeAnnotation()->AsETSPrimitiveType()->GetPrimitiveType() == ir::PrimitiveType::VOID)) { + statements.emplace_back(checker->AllocNode(expr)); + } else { + statements.emplace_back(checker->AllocNode(expr)); + function->AddFlag(ir::ScriptFunctionFlags::HAS_RETURN); + } + auto *const block = checker->AllocNode(checker->Allocator(), std::move(statements)); + block->SetScope(scope); block->SetParent(function); function->SetBody(block); - function->AddFlag(ir::ScriptFunctionFlags::HAS_RETURN); return arrow; } diff --git a/ets2panda/compiler/lowering/ets/promiseVoid.cpp b/ets2panda/compiler/lowering/ets/promiseVoid.cpp index 990d0183cc..be6913e87c 100644 --- a/ets2panda/compiler/lowering/ets/promiseVoid.cpp +++ b/ets2panda/compiler/lowering/ets/promiseVoid.cpp @@ -41,7 +41,7 @@ static ir::BlockStatement *HandleAsyncScriptFunctionBody(checker::ETSChecker *ch const auto *arg = returnStmt->Argument(); if (arg == nullptr) { auto *voidId = - checker->AllocNode(compiler::Signatures::VOID_OBJECT, checker->Allocator()); + checker->AllocNode(compiler::Signatures::UNDEFINED, checker->Allocator()); const auto &returnLoc = returnStmt->Range(); voidId->SetRange({returnLoc.end, returnLoc.end}); returnStmt->SetArgument(voidId); @@ -65,8 +65,7 @@ static ir::TypeNode *CreatePromiseVoidType(checker::ETSChecker *checker, const l { auto *voidParam = [checker]() { auto paramsVector = ArenaVector(checker->Allocator()->Adapter()); - auto *voidId = - checker->AllocNode(compiler::Signatures::BUILTIN_VOID_CLASS, checker->Allocator()); + auto *voidId = checker->AllocNode(compiler::Signatures::UNDEFINED, checker->Allocator()); voidId->SetReference(); auto *part = checker->AllocNode(voidId); paramsVector.push_back(checker->AllocNode(part)); @@ -117,7 +116,7 @@ static bool CheckForPromiseVoid(const ir::TypeNode *type) } const auto isTypePromise = typePart->Name()->AsIdentifier()->Name() == compiler::Signatures::BUILTIN_PROMISE_CLASS; - const auto isParamVoid = paramPart->Name()->AsIdentifier()->Name() == compiler::Signatures::BUILTIN_VOID_CLASS; + const auto isParamVoid = paramPart->Name()->AsIdentifier()->Name() == compiler::Signatures::UNDEFINED; return isTypePromise && isParamVoid; } @@ -206,9 +205,7 @@ bool PromiseVoidInferencePhase::Postcondition(public_lib::Context *ctx, const pa } const auto *id = arg->AsIdentifier(); - return id->Name() == compiler::Signatures::VOID_OBJECT; - - return true; + return id->Name() == compiler::Signatures::UNDEFINED; }; auto isOk = true; diff --git a/ets2panda/compiler/scripts/signatures.yaml b/ets2panda/compiler/scripts/signatures.yaml index 7e3cc445f8..a1af88cccf 100644 --- a/ets2panda/compiler/scripts/signatures.yaml +++ b/ets2panda/compiler/scripts/signatures.yaml @@ -120,8 +120,10 @@ defines: ref: STATIC_INVOKE_METHOD - name: instantiate ref: STATIC_INSTANTIATE_METHOD - - name: Void - ref: VOID_OBJECT + - name: undefined + ref: UNDEFINED + - name: 'null' + ref: NULL_LITERAL packages: - name: 'std.core' @@ -205,9 +207,6 @@ builtins: - name: Object package: PKG_STD_CORE ref: BUILTIN_OBJECT - - name: void - package: PKG_STD_CORE - ref: BUILTIN_VOID - name: String package: PKG_STD_CORE ref: BUILTIN_STRING @@ -925,61 +924,61 @@ signatures: - callee: BUILTIN_JSRUNTIME method_name: setPropertyBoolean params: [BUILTIN_JSVALUE, BUILTIN_STRING, PRIMITIVE_BOOLEAN] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_PROPERTY_BOOLEAN - callee: BUILTIN_JSRUNTIME method_name: setPropertyByte params: [BUILTIN_JSVALUE, BUILTIN_STRING, PRIMITIVE_BYTE] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_PROPERTY_BYTE - callee: BUILTIN_JSRUNTIME method_name: setPropertyChar params: [BUILTIN_JSVALUE, BUILTIN_STRING, PRIMITIVE_CHAR] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_PROPERTY_CHAR - callee: BUILTIN_JSRUNTIME method_name: setPropertyShort params: [BUILTIN_JSVALUE, BUILTIN_STRING, PRIMITIVE_SHORT] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_PROPERTY_SHORT - callee: BUILTIN_JSRUNTIME method_name: setPropertyInt params: [BUILTIN_JSVALUE, BUILTIN_STRING, PRIMITIVE_INT] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_PROPERTY_INT - callee: BUILTIN_JSRUNTIME method_name: setPropertyLong params: [BUILTIN_JSVALUE, BUILTIN_STRING, PRIMITIVE_LONG] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_PROPERTY_LONG - callee: BUILTIN_JSRUNTIME method_name: setPropertyFloat params: [BUILTIN_JSVALUE, BUILTIN_STRING, PRIMITIVE_FLOAT] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_PROPERTY_FLOAT - callee: BUILTIN_JSRUNTIME method_name: setPropertyDouble params: [BUILTIN_JSVALUE, BUILTIN_STRING, PRIMITIVE_DOUBLE] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_PROPERTY_DOUBLE - callee: BUILTIN_JSRUNTIME method_name: setPropertyString params: [BUILTIN_JSVALUE, BUILTIN_STRING, BUILTIN_STRING] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_PROPERTY_STRING - callee: BUILTIN_JSRUNTIME method_name: setPropertyJSValue params: [BUILTIN_JSVALUE, BUILTIN_STRING, BUILTIN_JSVALUE] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_PROPERTY_JSVALUE - callee: BUILTIN_PROMISE @@ -1047,73 +1046,73 @@ signatures: - callee: BUILTIN_JSRUNTIME method_name: setElementBoolean params: [BUILTIN_JSVALUE, PRIMITIVE_INT, PRIMITIVE_BOOLEAN] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_ELEMENT_BOOLEAN - callee: BUILTIN_JSRUNTIME method_name: setElementByte params: [BUILTIN_JSVALUE, PRIMITIVE_INT, PRIMITIVE_BYTE] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_ELEMENT_BYTE - callee: BUILTIN_JSRUNTIME method_name: setElementChar params: [BUILTIN_JSVALUE, PRIMITIVE_INT, PRIMITIVE_CHAR] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_ELEMENT_CHAR - callee: BUILTIN_JSRUNTIME method_name: setElementShort params: [BUILTIN_JSVALUE, PRIMITIVE_INT, PRIMITIVE_SHORT] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_ELEMENT_SHORT - callee: BUILTIN_JSRUNTIME method_name: setElementInt params: [BUILTIN_JSVALUE, PRIMITIVE_INT, PRIMITIVE_INT] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_ELEMENT_INT - callee: BUILTIN_JSRUNTIME method_name: setElementLong params: [BUILTIN_JSVALUE, PRIMITIVE_INT, PRIMITIVE_LONG] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_ELEMENT_LONG - callee: BUILTIN_JSRUNTIME method_name: setElementFloat params: [BUILTIN_JSVALUE, PRIMITIVE_INT, PRIMITIVE_FLOAT] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_ELEMENT_FLOAT - callee: BUILTIN_JSRUNTIME method_name: setElementDouble params: [BUILTIN_JSVALUE, PRIMITIVE_INT, PRIMITIVE_DOUBLE] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_ELEMENT_DOUBLE - callee: BUILTIN_JSRUNTIME method_name: setElementJSValue params: [BUILTIN_JSVALUE, PRIMITIVE_INT, BUILTIN_JSVALUE] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_SET_ELEMENT_JSVALUE - callee: BUILTIN_JSRUNTIME method_name: __initJSCallClass params: [BUILTIN_STRING] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_INIT_DYNAMIC_CALL_CLASS - callee: BUILTIN_JSRUNTIME method_name: __initJSNewClass params: [BUILTIN_STRING] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_INIT_DYNAMIC_NEW_CLASS - callee: BUILTIN_JSRUNTIME method_name: loadModule params: [BUILTIN_STRING] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_JSRUNTIME_LOAD_MODULE - callee: BUILTIN_JSRUNTIME @@ -1149,7 +1148,7 @@ signatures: - callee: BUILTIN_BOX method_name: set params: [BUILTIN_OBJECT] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_BOX_SET - callee: BUILTIN_BOOLEAN_BOX @@ -1167,7 +1166,7 @@ signatures: - callee: BUILTIN_BOOLEAN_BOX method_name: set params: [PRIMITIVE_BOOLEAN] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_BOOLEAN_BOX_SET - callee: BUILTIN_BYTE_BOX @@ -1185,7 +1184,7 @@ signatures: - callee: BUILTIN_BYTE_BOX method_name: set params: [PRIMITIVE_BYTE] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_BYTE_BOX_SET - callee: BUILTIN_CHAR_BOX @@ -1203,7 +1202,7 @@ signatures: - callee: BUILTIN_CHAR_BOX method_name: set params: [PRIMITIVE_CHAR] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_CHAR_BOX_SET - callee: BUILTIN_SHORT_BOX @@ -1221,7 +1220,7 @@ signatures: - callee: BUILTIN_SHORT_BOX method_name: set params: [PRIMITIVE_SHORT] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_SHORT_BOX_SET - callee: BUILTIN_INT_BOX @@ -1239,7 +1238,7 @@ signatures: - callee: BUILTIN_INT_BOX method_name: set params: [PRIMITIVE_INT] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_INT_BOX_SET - callee: BUILTIN_LONG_BOX @@ -1257,7 +1256,7 @@ signatures: - callee: BUILTIN_LONG_BOX method_name: set params: [PRIMITIVE_LONG] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_LONG_BOX_SET - callee: BUILTIN_FLOAT_BOX @@ -1275,7 +1274,7 @@ signatures: - callee: BUILTIN_FLOAT_BOX method_name: set params: [PRIMITIVE_FLOAT] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_FLOAT_BOX_SET - callee: BUILTIN_DOUBLE_BOX @@ -1293,7 +1292,7 @@ signatures: - callee: BUILTIN_DOUBLE_BOX method_name: set params: [PRIMITIVE_DOUBLE] - return_type: BUILTIN_VOID + return_type: PRIMITIVE_VOID ref: BUILTIN_DOUBLE_BOX_SET - callee: BUILTIN_JSRUNTIME diff --git a/ets2panda/ir/ets/etsPrimitiveType.cpp b/ets2panda/ir/ets/etsPrimitiveType.cpp index db10fd12d2..8bceeec7b5 100644 --- a/ets2panda/ir/ets/etsPrimitiveType.cpp +++ b/ets2panda/ir/ets/etsPrimitiveType.cpp @@ -126,6 +126,10 @@ checker::Type *ETSPrimitiveType::GetType([[maybe_unused]] checker::ETSChecker *c SetTsType(checker->GlobalCharType()); return TsType(); } + case PrimitiveType::VOID: { + SetTsType(checker->GlobalVoidType()); + return TsType(); + } default: { UNREACHABLE(); } diff --git a/ets2panda/ir/ets/etsTypeReferencePart.cpp b/ets2panda/ir/ets/etsTypeReferencePart.cpp index 45d5ee74ef..d1ccc84180 100644 --- a/ets2panda/ir/ets/etsTypeReferencePart.cpp +++ b/ets2panda/ir/ets/etsTypeReferencePart.cpp @@ -90,9 +90,18 @@ checker::Type *ETSTypeReferencePart::Check(checker::ETSChecker *checker) checker::Type *ETSTypeReferencePart::GetType(checker::ETSChecker *checker) { if (prev_ == nullptr) { - if ((name_->IsIdentifier()) && (name_->AsIdentifier()->Variable() != nullptr) && - (name_->AsIdentifier()->Variable()->Declaration()->IsTypeAliasDecl())) { - return checker->HandleTypeAlias(name_, typeParams_); + if (name_->IsIdentifier()) { + if ((name_->AsIdentifier()->Variable() != nullptr) && + (name_->AsIdentifier()->Variable()->Declaration()->IsTypeAliasDecl())) { + return checker->HandleTypeAlias(name_, typeParams_); + } + if (name_->AsIdentifier()->Name() == compiler::Signatures::UNDEFINED) { + return checker->GlobalETSUndefinedType(); + } + + if (name_->AsIdentifier()->Name() == compiler::Signatures::NULL_LITERAL) { + return checker->GlobalETSNullType(); + } } checker::Type *baseType = checker->GetReferencedTypeBase(name_); diff --git a/ets2panda/lexer/scripts/keywords.yaml b/ets2panda/lexer/scripts/keywords.yaml index e89b4ed2fb..9a09b235cd 100644 --- a/ets2panda/lexer/scripts/keywords.yaml +++ b/ets2panda/lexer/scripts/keywords.yaml @@ -476,6 +476,7 @@ keywords: - name: 'void' token: KEYW_VOID keyword: [as, js, ts] + keyword_like: [ets] - name: 'while' token: KEYW_WHILE diff --git a/ets2panda/lexer/token/token.cpp b/ets2panda/lexer/token/token.cpp index 218f76987a..22703ceeae 100644 --- a/ets2panda/lexer/token/token.cpp +++ b/ets2panda/lexer/token/token.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 @@ -113,6 +113,7 @@ bool Token::IsDefinableTypeName() const case TokenType::KEYW_STRING: case TokenType::KEYW_NUMBER: case TokenType::KEYW_BIGINT: + case TokenType::KEYW_VOID: return true; default: return false; diff --git a/ets2panda/parser/ETSparser.cpp b/ets2panda/parser/ETSparser.cpp index 2f005ccbe0..c8efaf5c92 100644 --- a/ets2panda/parser/ETSparser.cpp +++ b/ets2panda/parser/ETSparser.cpp @@ -1915,6 +1915,9 @@ ir::TypeNode *ETSParser::GetTypeAnnotationOfPrimitiveType([[maybe_unused]] lexer case lexer::TokenType::KEYW_LONG: typeAnnotation = ParsePrimitiveType(options, ir::PrimitiveType::LONG); break; + case lexer::TokenType::KEYW_VOID: + typeAnnotation = ParsePrimitiveType(options, ir::PrimitiveType::VOID); + break; default: typeAnnotation = ParseTypeReference(options); break; @@ -2060,6 +2063,10 @@ std::pair ETSParser::GetTypeAnnotationFromToken(TypeAnnota } break; } + case lexer::TokenType::KEYW_VOID: { + typeAnnotation = ParsePrimitiveType(options, ir::PrimitiveType::VOID); + break; + } case lexer::TokenType::KEYW_BOOLEAN: { typeAnnotation = ParsePrimitiveType(options, ir::PrimitiveType::BOOLEAN); break; diff --git a/ets2panda/test/compiler/ets/FunctionType1-expected.txt b/ets2panda/test/compiler/ets/FunctionType1-expected.txt index 4a33f8aaf0..5a66e67010 100644 --- a/ets2panda/test/compiler/ets/FunctionType1-expected.txt +++ b/ets2panda/test/compiler/ets/FunctionType1-expected.txt @@ -539,35 +539,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -575,7 +547,7 @@ }, "end": { "line": 16, - "column": 35 + "column": 34 } } }, @@ -586,7 +558,7 @@ }, "end": { "line": 16, - "column": 35 + "column": 34 } } }, @@ -649,35 +621,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -685,7 +629,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/FunctionType2-expected.txt b/ets2panda/test/compiler/ets/FunctionType2-expected.txt index bc1ed8f6d6..9257b56e38 100644 --- a/ets2panda/test/compiler/ets/FunctionType2-expected.txt +++ b/ets2panda/test/compiler/ets/FunctionType2-expected.txt @@ -447,35 +447,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 48 - }, - "end": { - "line": 18, - "column": 52 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 48 - }, - "end": { - "line": 18, - "column": 54 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -483,7 +455,7 @@ }, "end": { "line": 18, - "column": 54 + "column": 52 } } }, @@ -582,35 +554,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -618,7 +562,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/FunctionType3-expected.txt b/ets2panda/test/compiler/ets/FunctionType3-expected.txt index a88187d5c9..c538de6161 100644 --- a/ets2panda/test/compiler/ets/FunctionType3-expected.txt +++ b/ets2panda/test/compiler/ets/FunctionType3-expected.txt @@ -226,35 +226,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 31 - }, - "end": { - "line": 16, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 31 - }, - "end": { - "line": 16, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -262,7 +234,7 @@ }, "end": { "line": 16, - "column": 36 + "column": 35 } } }, @@ -273,7 +245,7 @@ }, "end": { "line": 16, - "column": 36 + "column": 35 } } }, @@ -422,35 +394,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 39 - }, - "end": { - "line": 18, - "column": 43 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 39 - }, - "end": { - "line": 18, - "column": 45 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -458,7 +402,7 @@ }, "end": { "line": 18, - "column": 45 + "column": 43 } } }, @@ -469,7 +413,7 @@ }, "end": { "line": 18, - "column": 45 + "column": 43 } } }, @@ -597,35 +541,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -633,7 +549,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/FunctionType4-expected.txt b/ets2panda/test/compiler/ets/FunctionType4-expected.txt index 13c0c3fbd0..3f1ee623d9 100644 --- a/ets2panda/test/compiler/ets/FunctionType4-expected.txt +++ b/ets2panda/test/compiler/ets/FunctionType4-expected.txt @@ -790,35 +790,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 18 - }, - "end": { - "line": 30, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 18 - }, - "end": { - "line": 30, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 30, @@ -826,7 +798,7 @@ }, "end": { "line": 30, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/FunctionType6-expected.txt b/ets2panda/test/compiler/ets/FunctionType6-expected.txt index 909ce83c37..8f3f784121 100644 --- a/ets2panda/test/compiler/ets/FunctionType6-expected.txt +++ b/ets2panda/test/compiler/ets/FunctionType6-expected.txt @@ -110,35 +110,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 16 - }, - "end": { - "line": 17, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 16 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -146,7 +118,7 @@ }, "end": { "line": 17, - "column": 22 + "column": 20 } } }, diff --git a/ets2panda/test/compiler/ets/FunctionType7-expected.txt b/ets2panda/test/compiler/ets/FunctionType7-expected.txt index f249b8d201..7da21e6c03 100644 --- a/ets2panda/test/compiler/ets/FunctionType7-expected.txt +++ b/ets2panda/test/compiler/ets/FunctionType7-expected.txt @@ -110,35 +110,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 16 - }, - "end": { - "line": 17, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 16 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -146,7 +118,7 @@ }, "end": { "line": 17, - "column": 22 + "column": 20 } } }, @@ -476,35 +448,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -512,7 +456,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/FunctionType8-expected.txt b/ets2panda/test/compiler/ets/FunctionType8-expected.txt index 2467200881..899a790759 100644 --- a/ets2panda/test/compiler/ets/FunctionType8-expected.txt +++ b/ets2panda/test/compiler/ets/FunctionType8-expected.txt @@ -151,35 +151,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -187,7 +159,7 @@ }, "end": { "line": 18, - "column": 29 + "column": 27 } } }, @@ -393,35 +365,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 27 - }, - "end": { - "line": 22, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 27 - }, - "end": { - "line": 22, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -429,7 +373,7 @@ }, "end": { "line": 22, - "column": 33 + "column": 31 } } }, @@ -440,7 +384,7 @@ }, "end": { "line": 22, - "column": 33 + "column": 31 } } }, @@ -722,35 +666,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 16 - }, - "end": { - "line": 26, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 16 - }, - "end": { - "line": 26, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 26, @@ -758,7 +674,7 @@ }, "end": { "line": 26, - "column": 22 + "column": 20 } } }, @@ -923,35 +839,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 19 - }, - "end": { - "line": 30, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 19 - }, - "end": { - "line": 30, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 30, @@ -959,7 +847,7 @@ }, "end": { "line": 30, - "column": 25 + "column": 23 } } }, @@ -970,7 +858,7 @@ }, "end": { "line": 30, - "column": 25 + "column": 23 } } }, @@ -1264,35 +1152,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 33, - "column": 18 - }, - "end": { - "line": 33, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 33, - "column": 18 - }, - "end": { - "line": 33, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 33, @@ -1300,7 +1160,7 @@ }, "end": { "line": 33, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/FunctionType9-expected.txt b/ets2panda/test/compiler/ets/FunctionType9-expected.txt index e6dafbd1ae..89ae3bf0cf 100644 --- a/ets2panda/test/compiler/ets/FunctionType9-expected.txt +++ b/ets2panda/test/compiler/ets/FunctionType9-expected.txt @@ -110,35 +110,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 16 - }, - "end": { - "line": 18, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 16 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -146,7 +118,7 @@ }, "end": { "line": 18, - "column": 22 + "column": 20 } } }, @@ -283,35 +255,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 27 - }, - "end": { - "line": 22, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 27 - }, - "end": { - "line": 22, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -319,7 +263,7 @@ }, "end": { "line": 22, - "column": 33 + "column": 31 } } }, @@ -330,7 +274,7 @@ }, "end": { "line": 22, - "column": 33 + "column": 31 } } }, @@ -624,35 +568,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 18 - }, - "end": { - "line": 25, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 18 - }, - "end": { - "line": 25, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 25, @@ -660,7 +576,7 @@ }, "end": { "line": 25, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/StructTest1-expected.txt b/ets2panda/test/compiler/ets/StructTest1-expected.txt index 50b26e4766..591b083f38 100644 --- a/ets2panda/test/compiler/ets/StructTest1-expected.txt +++ b/ets2panda/test/compiler/ets/StructTest1-expected.txt @@ -949,35 +949,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 18 - }, - "end": { - "line": 27, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 18 - }, - "end": { - "line": 27, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 27, @@ -985,7 +957,7 @@ }, "end": { "line": 27, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/StructTest2-expected.txt b/ets2panda/test/compiler/ets/StructTest2-expected.txt index 5e9b0511ba..10873cd404 100644 --- a/ets2panda/test/compiler/ets/StructTest2-expected.txt +++ b/ets2panda/test/compiler/ets/StructTest2-expected.txt @@ -1034,35 +1034,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 18 - }, - "end": { - "line": 27, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 18 - }, - "end": { - "line": 27, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 27, @@ -1070,7 +1042,7 @@ }, "end": { "line": 27, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/abstractMethodDeclaredInParentClass-expected.txt b/ets2panda/test/compiler/ets/abstractMethodDeclaredInParentClass-expected.txt index 6410ff6e46..d6f185f73f 100644 --- a/ets2panda/test/compiler/ets/abstractMethodDeclaredInParentClass-expected.txt +++ b/ets2panda/test/compiler/ets/abstractMethodDeclaredInParentClass-expected.txt @@ -205,35 +205,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -241,7 +213,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, @@ -560,35 +532,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 31 - }, - "end": { - "line": 20, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 31 - }, - "end": { - "line": 20, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -596,7 +540,7 @@ }, "end": { "line": 20, - "column": 36 + "column": 35 } } }, @@ -723,35 +667,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 28 - }, - "end": { - "line": 24, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 28 - }, - "end": { - "line": 24, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -759,7 +675,7 @@ }, "end": { "line": 24, - "column": 34 + "column": 32 } } }, @@ -1242,35 +1158,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 34, - "column": 29 - }, - "end": { - "line": 34, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 34, - "column": 29 - }, - "end": { - "line": 34, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 34, @@ -1278,7 +1166,7 @@ }, "end": { "line": 34, - "column": 34 + "column": 33 } } }, @@ -1290,7 +1178,7 @@ }, "end": { "line": 34, - "column": 34 + "column": 33 } } }, @@ -1301,7 +1189,7 @@ }, "end": { "line": 34, - "column": 34 + "column": 33 } } }, @@ -1466,35 +1354,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 38, - "column": 28 - }, - "end": { - "line": 38, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 38, - "column": 28 - }, - "end": { - "line": 38, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 38, @@ -1502,7 +1362,7 @@ }, "end": { "line": 38, - "column": 33 + "column": 32 } } }, @@ -1629,35 +1489,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 39, - "column": 19 - }, - "end": { - "line": 39, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 39, - "column": 19 - }, - "end": { - "line": 39, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 39, @@ -1665,7 +1497,7 @@ }, "end": { "line": 39, - "column": 24 + "column": 23 } } }, @@ -2024,35 +1856,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 45, - "column": 29 - }, - "end": { - "line": 45, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 45, - "column": 29 - }, - "end": { - "line": 45, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 45, @@ -2060,7 +1864,7 @@ }, "end": { "line": 45, - "column": 34 + "column": 33 } } }, @@ -2322,35 +2126,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 51, - "column": 19 - }, - "end": { - "line": 51, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 51, - "column": 19 - }, - "end": { - "line": 51, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 51, @@ -2358,7 +2134,7 @@ }, "end": { "line": 51, - "column": 24 + "column": 23 } } }, @@ -2370,7 +2146,7 @@ }, "end": { "line": 51, - "column": 24 + "column": 23 } } }, @@ -2381,7 +2157,7 @@ }, "end": { "line": 51, - "column": 24 + "column": 23 } } }, @@ -2695,35 +2471,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 55, - "column": 31 - }, - "end": { - "line": 55, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 55, - "column": 31 - }, - "end": { - "line": 55, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 55, @@ -2731,7 +2479,7 @@ }, "end": { "line": 55, - "column": 37 + "column": 35 } } }, diff --git a/ets2panda/test/compiler/ets/abstractNewClassInstanceExpression-expected.txt b/ets2panda/test/compiler/ets/abstractNewClassInstanceExpression-expected.txt index d2a660f61f..6ec840ffe7 100644 --- a/ets2panda/test/compiler/ets/abstractNewClassInstanceExpression-expected.txt +++ b/ets2panda/test/compiler/ets/abstractNewClassInstanceExpression-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 26 + "column": 25 } } }, @@ -583,35 +555,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 25 - }, - "end": { - "line": 26, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 25 - }, - "end": { - "line": 26, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 26, @@ -619,7 +563,7 @@ }, "end": { "line": 26, - "column": 31 + "column": 29 } } }, diff --git a/ets2panda/test/compiler/ets/arrowFunctionCapture-expected.txt b/ets2panda/test/compiler/ets/arrowFunctionCapture-expected.txt index 59ec009526..f5299a0b13 100644 --- a/ets2panda/test/compiler/ets/arrowFunctionCapture-expected.txt +++ b/ets2panda/test/compiler/ets/arrowFunctionCapture-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 17 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 17 + "column": 16 } } }, @@ -245,35 +217,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -281,7 +225,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 23 } } }, @@ -342,35 +286,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 32 - }, - "end": { - "line": 19, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 32 - }, - "end": { - "line": 19, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -378,7 +294,7 @@ }, "end": { "line": 19, - "column": 38 + "column": 36 } } }, @@ -389,7 +305,7 @@ }, "end": { "line": 19, - "column": 38 + "column": 36 } } }, @@ -457,35 +373,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 50 - }, - "end": { - "line": 19, - "column": 54 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 50 - }, - "end": { - "line": 19, - "column": 57 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -493,7 +381,7 @@ }, "end": { "line": 19, - "column": 57 + "column": 54 } } }, diff --git a/ets2panda/test/compiler/ets/boxingConversion1-expected.txt b/ets2panda/test/compiler/ets/boxingConversion1-expected.txt index bf84cbaee1..243da03902 100644 --- a/ets2panda/test/compiler/ets/boxingConversion1-expected.txt +++ b/ets2panda/test/compiler/ets/boxingConversion1-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/boxingConversion2-expected.txt b/ets2panda/test/compiler/ets/boxingConversion2-expected.txt index 910dc2a60e..eb781cd47d 100644 --- a/ets2panda/test/compiler/ets/boxingConversion2-expected.txt +++ b/ets2panda/test/compiler/ets/boxingConversion2-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/boxingConversion3-expected.txt b/ets2panda/test/compiler/ets/boxingConversion3-expected.txt index a018b02b0b..95995a8168 100644 --- a/ets2panda/test/compiler/ets/boxingConversion3-expected.txt +++ b/ets2panda/test/compiler/ets/boxingConversion3-expected.txt @@ -204,35 +204,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 27 - }, - "end": { - "line": 16, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 27 - }, - "end": { - "line": 16, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -240,7 +212,7 @@ }, "end": { "line": 16, - "column": 33 + "column": 31 } } }, @@ -601,35 +573,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -637,7 +581,7 @@ }, "end": { "line": 24, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/boxingConversion4-expected.txt b/ets2panda/test/compiler/ets/boxingConversion4-expected.txt index f102d6aa27..350be7c55e 100644 --- a/ets2panda/test/compiler/ets/boxingConversion4-expected.txt +++ b/ets2panda/test/compiler/ets/boxingConversion4-expected.txt @@ -232,35 +232,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -268,7 +240,7 @@ }, "end": { "line": 16, - "column": 32 + "column": 30 } } }, @@ -367,35 +339,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -403,7 +347,7 @@ }, "end": { "line": 18, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/boxingUnboxingExpressions-expected.txt b/ets2panda/test/compiler/ets/boxingUnboxingExpressions-expected.txt index 8d1bfab396..2d9aac6a3e 100644 --- a/ets2panda/test/compiler/ets/boxingUnboxingExpressions-expected.txt +++ b/ets2panda/test/compiler/ets/boxingUnboxingExpressions-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 17 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 17 + "column": 16 } } }, @@ -2568,35 +2540,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 42, - "column": 35 - }, - "end": { - "line": 42, - "column": 39 - } - } - }, - "loc": { - "start": { - "line": 42, - "column": 35 - }, - "end": { - "line": 42, - "column": 41 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 42, @@ -2604,7 +2548,7 @@ }, "end": { "line": 42, - "column": 41 + "column": 39 } } }, @@ -2773,35 +2717,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 43, - "column": 35 - }, - "end": { - "line": 43, - "column": 39 - } - } - }, - "loc": { - "start": { - "line": 43, - "column": 35 - }, - "end": { - "line": 43, - "column": 41 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 43, @@ -2809,7 +2725,7 @@ }, "end": { "line": 43, - "column": 41 + "column": 39 } } }, @@ -2950,35 +2866,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 44, - "column": 29 - }, - "end": { - "line": 44, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 44, - "column": 29 - }, - "end": { - "line": 44, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 44, @@ -2986,7 +2874,7 @@ }, "end": { "line": 44, - "column": 35 + "column": 33 } } }, @@ -3155,35 +3043,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 45, - "column": 29 - }, - "end": { - "line": 45, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 45, - "column": 29 - }, - "end": { - "line": 45, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 45, @@ -3191,7 +3051,7 @@ }, "end": { "line": 45, - "column": 35 + "column": 33 } } }, @@ -3332,35 +3192,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 46, - "column": 31 - }, - "end": { - "line": 46, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 46, - "column": 31 - }, - "end": { - "line": 46, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 46, @@ -3368,7 +3200,7 @@ }, "end": { "line": 46, - "column": 37 + "column": 35 } } }, @@ -3537,35 +3369,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 47, - "column": 31 - }, - "end": { - "line": 47, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 47, - "column": 31 - }, - "end": { - "line": 47, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 47, @@ -3573,7 +3377,7 @@ }, "end": { "line": 47, - "column": 37 + "column": 35 } } }, @@ -3714,35 +3518,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 48, - "column": 29 - }, - "end": { - "line": 48, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 48, - "column": 29 - }, - "end": { - "line": 48, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 48, @@ -3750,7 +3526,7 @@ }, "end": { "line": 48, - "column": 35 + "column": 33 } } }, @@ -3919,35 +3695,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 49, - "column": 29 - }, - "end": { - "line": 49, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 49, - "column": 29 - }, - "end": { - "line": 49, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 49, @@ -3955,7 +3703,7 @@ }, "end": { "line": 49, - "column": 35 + "column": 33 } } }, @@ -4096,35 +3844,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 50, - "column": 31 - }, - "end": { - "line": 50, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 50, - "column": 31 - }, - "end": { - "line": 50, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 50, @@ -4132,7 +3852,7 @@ }, "end": { "line": 50, - "column": 37 + "column": 35 } } }, @@ -4301,35 +4021,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 51, - "column": 31 - }, - "end": { - "line": 51, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 51, - "column": 31 - }, - "end": { - "line": 51, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 51, @@ -4337,7 +4029,7 @@ }, "end": { "line": 51, - "column": 37 + "column": 35 } } }, @@ -4478,35 +4170,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 52, - "column": 29 - }, - "end": { - "line": 52, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 52, - "column": 29 - }, - "end": { - "line": 52, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 52, @@ -4514,7 +4178,7 @@ }, "end": { "line": 52, - "column": 35 + "column": 33 } } }, @@ -4683,35 +4347,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 53, - "column": 29 - }, - "end": { - "line": 53, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 53, - "column": 29 - }, - "end": { - "line": 53, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 53, @@ -4719,7 +4355,7 @@ }, "end": { "line": 53, - "column": 35 + "column": 33 } } }, @@ -4860,35 +4496,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 54, - "column": 31 - }, - "end": { - "line": 54, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 54, - "column": 31 - }, - "end": { - "line": 54, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 54, @@ -4896,7 +4504,7 @@ }, "end": { "line": 54, - "column": 37 + "column": 35 } } }, @@ -5065,35 +4673,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 55, - "column": 31 - }, - "end": { - "line": 55, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 55, - "column": 31 - }, - "end": { - "line": 55, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 55, @@ -5101,7 +4681,7 @@ }, "end": { "line": 55, - "column": 37 + "column": 35 } } }, @@ -5242,35 +4822,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 56, - "column": 33 - }, - "end": { - "line": 56, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 56, - "column": 33 - }, - "end": { - "line": 56, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 56, @@ -5278,7 +4830,7 @@ }, "end": { "line": 56, - "column": 39 + "column": 37 } } }, @@ -5447,35 +4999,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 57, - "column": 33 - }, - "end": { - "line": 57, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 57, - "column": 33 - }, - "end": { - "line": 57, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 57, @@ -5483,7 +5007,7 @@ }, "end": { "line": 57, - "column": 39 + "column": 37 } } }, @@ -5582,35 +5106,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 59, - "column": 16 - }, - "end": { - "line": 59, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 59, - "column": 16 - }, - "end": { - "line": 59, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 59, @@ -5618,7 +5114,7 @@ }, "end": { "line": 59, - "column": 22 + "column": 20 } } }, diff --git a/ets2panda/test/compiler/ets/catch-soft-keyword-expected.txt b/ets2panda/test/compiler/ets/catch-soft-keyword-expected.txt index 0e009bbbad..c08235ad17 100644 --- a/ets2panda/test/compiler/ets/catch-soft-keyword-expected.txt +++ b/ets2panda/test/compiler/ets/catch-soft-keyword-expected.txt @@ -205,35 +205,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 12 - }, - "end": { - "line": 20, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 12 - }, - "end": { - "line": 20, - "column": 18 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -241,7 +213,7 @@ }, "end": { "line": 20, - "column": 18 + "column": 16 } } }, @@ -571,35 +543,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 17 - }, - "end": { - "line": 23, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 17 - }, - "end": { - "line": 23, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -607,7 +551,7 @@ }, "end": { "line": 23, - "column": 23 + "column": 21 } } }, diff --git a/ets2panda/test/compiler/ets/catchParamScope-expected.txt b/ets2panda/test/compiler/ets/catchParamScope-expected.txt index 76eb7133ca..482075c4b5 100644 --- a/ets2panda/test/compiler/ets/catchParamScope-expected.txt +++ b/ets2panda/test/compiler/ets/catchParamScope-expected.txt @@ -232,35 +232,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 33 - }, - "end": { - "line": 16, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 33 - }, - "end": { - "line": 16, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -268,7 +240,7 @@ }, "end": { "line": 16, - "column": 39 + "column": 37 } } }, @@ -367,35 +339,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -403,7 +347,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, @@ -422,35 +366,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 19 - }, - "end": { - "line": 20, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 19 - }, - "end": { - "line": 20, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -458,7 +374,7 @@ }, "end": { "line": 20, - "column": 25 + "column": 23 } } }, @@ -469,7 +385,7 @@ }, "end": { "line": 20, - "column": 25 + "column": 23 } } }, @@ -495,35 +411,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 30 - }, - "end": { - "line": 20, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 30 - }, - "end": { - "line": 20, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -531,7 +419,7 @@ }, "end": { "line": 20, - "column": 37 + "column": 34 } } }, diff --git a/ets2panda/test/compiler/ets/conversion-w-ASExpr-expected.txt b/ets2panda/test/compiler/ets/conversion-w-ASExpr-expected.txt index 29be34d68b..db7fce781e 100644 --- a/ets2panda/test/compiler/ets/conversion-w-ASExpr-expected.txt +++ b/ets2panda/test/compiler/ets/conversion-w-ASExpr-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/conversion_Double-to-Int_typeerror-expected.txt b/ets2panda/test/compiler/ets/conversion_Double-to-Int_typeerror-expected.txt index b4bf32c633..ed428dd340 100644 --- a/ets2panda/test/compiler/ets/conversion_Double-to-Int_typeerror-expected.txt +++ b/ets2panda/test/compiler/ets/conversion_Double-to-Int_typeerror-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/conversion_Double-to-Int_w_try_stmt_typerror-expected.txt b/ets2panda/test/compiler/ets/conversion_Double-to-Int_w_try_stmt_typerror-expected.txt index 34209cbf2a..8fb5fafeb2 100644 --- a/ets2panda/test/compiler/ets/conversion_Double-to-Int_w_try_stmt_typerror-expected.txt +++ b/ets2panda/test/compiler/ets/conversion_Double-to-Int_w_try_stmt_typerror-expected.txt @@ -594,35 +594,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -630,7 +602,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/conversion_Int-to-Double_typeerror-expected.txt b/ets2panda/test/compiler/ets/conversion_Int-to-Double_typeerror-expected.txt index af949c2706..50e5de56a8 100644 --- a/ets2panda/test/compiler/ets/conversion_Int-to-Double_typeerror-expected.txt +++ b/ets2panda/test/compiler/ets/conversion_Int-to-Double_typeerror-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/conversion_call-context_Int-to-Double_typeerror-expected.txt b/ets2panda/test/compiler/ets/conversion_call-context_Int-to-Double_typeerror-expected.txt index b811e85e80..0bbc7d401b 100644 --- a/ets2panda/test/compiler/ets/conversion_call-context_Int-to-Double_typeerror-expected.txt +++ b/ets2panda/test/compiler/ets/conversion_call-context_Int-to-Double_typeerror-expected.txt @@ -326,35 +326,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -362,7 +334,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/conversion_w_functions-expected.txt b/ets2panda/test/compiler/ets/conversion_w_functions-expected.txt index aa6b186a07..6aa13d2cd9 100644 --- a/ets2panda/test/compiler/ets/conversion_w_functions-expected.txt +++ b/ets2panda/test/compiler/ets/conversion_w_functions-expected.txt @@ -3378,35 +3378,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 76, - "column": 18 - }, - "end": { - "line": 76, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 76, - "column": 18 - }, - "end": { - "line": 76, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 76, @@ -3414,7 +3386,7 @@ }, "end": { "line": 76, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/conversion_w_functions_w_try-stmts-expected.txt b/ets2panda/test/compiler/ets/conversion_w_functions_w_try-stmts-expected.txt index 9e783ed310..2a4e55b60d 100644 --- a/ets2panda/test/compiler/ets/conversion_w_functions_w_try-stmts-expected.txt +++ b/ets2panda/test/compiler/ets/conversion_w_functions_w_try-stmts-expected.txt @@ -469,35 +469,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 80, - "column": 18 - }, - "end": { - "line": 80, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 80, - "column": 18 - }, - "end": { - "line": 80, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 80, @@ -505,7 +477,7 @@ }, "end": { "line": 80, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/enum_as_type_alias-expected.txt b/ets2panda/test/compiler/ets/enum_as_type_alias-expected.txt index c784e43c84..052fbd7faf 100644 --- a/ets2panda/test/compiler/ets/enum_as_type_alias-expected.txt +++ b/ets2panda/test/compiler/ets/enum_as_type_alias-expected.txt @@ -388,35 +388,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -424,7 +396,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/forUpdate-expected.txt b/ets2panda/test/compiler/ets/forUpdate-expected.txt index ac8cf73a20..d5967be06e 100644 --- a/ets2panda/test/compiler/ets/forUpdate-expected.txt +++ b/ets2panda/test/compiler/ets/forUpdate-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -198,7 +170,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/forUpdateCharType-expected.txt b/ets2panda/test/compiler/ets/forUpdateCharType-expected.txt index f7d82fe267..842beaa2d9 100644 --- a/ets2panda/test/compiler/ets/forUpdateCharType-expected.txt +++ b/ets2panda/test/compiler/ets/forUpdateCharType-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/for_of_missing_iterator_type-expected.txt b/ets2panda/test/compiler/ets/for_of_missing_iterator_type-expected.txt index e2347bad08..134fb9bdd5 100644 --- a/ets2panda/test/compiler/ets/for_of_missing_iterator_type-expected.txt +++ b/ets2panda/test/compiler/ets/for_of_missing_iterator_type-expected.txt @@ -159,35 +159,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 16 - }, - "end": { - "line": 20, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 16 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -195,7 +167,7 @@ }, "end": { "line": 20, - "column": 22 + "column": 20 } } }, @@ -829,35 +801,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -865,7 +809,7 @@ }, "end": { "line": 28, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/from-soft-keyword-0-expected.txt b/ets2panda/test/compiler/ets/from-soft-keyword-0-expected.txt index 3bbcd11e33..5ceff9ec7f 100644 --- a/ets2panda/test/compiler/ets/from-soft-keyword-0-expected.txt +++ b/ets2panda/test/compiler/ets/from-soft-keyword-0-expected.txt @@ -311,35 +311,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 13 - }, - "end": { - "line": 23, - "column": 17 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 13 - }, - "end": { - "line": 23, - "column": 19 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -347,7 +319,7 @@ }, "end": { "line": 23, - "column": 19 + "column": 17 } } }, @@ -677,35 +649,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 26, @@ -713,7 +657,7 @@ }, "end": { "line": 26, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/from-soft-keyword-1-expected.txt b/ets2panda/test/compiler/ets/from-soft-keyword-1-expected.txt index b4fdc70d8e..1ca8f28043 100644 --- a/ets2panda/test/compiler/ets/from-soft-keyword-1-expected.txt +++ b/ets2panda/test/compiler/ets/from-soft-keyword-1-expected.txt @@ -261,35 +261,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 27 - }, - "end": { - "line": 18, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 27 - }, - "end": { - "line": 18, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -297,7 +269,7 @@ }, "end": { "line": 18, - "column": 33 + "column": 31 } } }, @@ -396,35 +368,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -432,7 +376,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, @@ -493,35 +437,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 31 - }, - "end": { - "line": 21, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 31 - }, - "end": { - "line": 21, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -529,7 +445,7 @@ }, "end": { "line": 21, - "column": 37 + "column": 35 } } }, @@ -540,7 +456,7 @@ }, "end": { "line": 21, - "column": 37 + "column": 35 } } }, diff --git a/ets2panda/test/compiler/ets/from-soft-keyword-2-expected.txt b/ets2panda/test/compiler/ets/from-soft-keyword-2-expected.txt index c57f16ebaf..c384a09df2 100644 --- a/ets2panda/test/compiler/ets/from-soft-keyword-2-expected.txt +++ b/ets2panda/test/compiler/ets/from-soft-keyword-2-expected.txt @@ -399,35 +399,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -435,7 +407,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/from-soft-keyword-3-expected.txt b/ets2panda/test/compiler/ets/from-soft-keyword-3-expected.txt index 5e31d54078..1f361300c3 100644 --- a/ets2panda/test/compiler/ets/from-soft-keyword-3-expected.txt +++ b/ets2panda/test/compiler/ets/from-soft-keyword-3-expected.txt @@ -376,35 +376,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -412,7 +384,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/functionPointerArray-expected.txt b/ets2panda/test/compiler/ets/functionPointerArray-expected.txt index ad7907de18..dbddfece60 100644 --- a/ets2panda/test/compiler/ets/functionPointerArray-expected.txt +++ b/ets2panda/test/compiler/ets/functionPointerArray-expected.txt @@ -22,35 +22,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -58,7 +30,7 @@ }, "end": { "line": 16, - "column": 29 + "column": 28 } } }, @@ -69,7 +41,7 @@ }, "end": { "line": 16, - "column": 29 + "column": 28 } } }, @@ -245,35 +217,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -281,7 +225,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, @@ -642,35 +586,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -678,7 +594,7 @@ }, "end": { "line": 24, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/functionTypeToObject-expected.txt b/ets2panda/test/compiler/ets/functionTypeToObject-expected.txt index 9ab44f0704..2003cc8a84 100644 --- a/ets2panda/test/compiler/ets/functionTypeToObject-expected.txt +++ b/ets2panda/test/compiler/ets/functionTypeToObject-expected.txt @@ -447,35 +447,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 19 - }, - "end": { - "line": 20, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 19 - }, - "end": { - "line": 20, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -483,7 +455,7 @@ }, "end": { "line": 20, - "column": 25 + "column": 23 } } }, @@ -494,7 +466,7 @@ }, "end": { "line": 20, - "column": 25 + "column": 23 } } }, @@ -644,35 +616,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 34 - }, - "end": { - "line": 21, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 34 - }, - "end": { - "line": 21, - "column": 40 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -680,7 +624,7 @@ }, "end": { "line": 21, - "column": 40 + "column": 38 } } }, @@ -691,7 +635,7 @@ }, "end": { "line": 21, - "column": 40 + "column": 38 } } }, diff --git a/ets2panda/test/compiler/ets/function_subtyping_1-expected.txt b/ets2panda/test/compiler/ets/function_subtyping_1-expected.txt index ca68775f5e..967cf057e1 100644 --- a/ets2panda/test/compiler/ets/function_subtyping_1-expected.txt +++ b/ets2panda/test/compiler/ets/function_subtyping_1-expected.txt @@ -476,35 +476,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -512,7 +484,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/function_subtyping_2-expected.txt b/ets2panda/test/compiler/ets/function_subtyping_2-expected.txt index b49902e036..f0909a6506 100644 --- a/ets2panda/test/compiler/ets/function_subtyping_2-expected.txt +++ b/ets2panda/test/compiler/ets/function_subtyping_2-expected.txt @@ -476,35 +476,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -512,7 +484,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/function_subtyping_3-expected.txt b/ets2panda/test/compiler/ets/function_subtyping_3-expected.txt index 55e50a03bc..130b6d6e28 100644 --- a/ets2panda/test/compiler/ets/function_subtyping_3-expected.txt +++ b/ets2panda/test/compiler/ets/function_subtyping_3-expected.txt @@ -476,35 +476,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -512,7 +484,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_arrayaslist-expected.txt b/ets2panda/test/compiler/ets/generic_arrayaslist-expected.txt index 296c4beeb9..ed829d9f09 100644 --- a/ets2panda/test/compiler/ets/generic_arrayaslist-expected.txt +++ b/ets2panda/test/compiler/ets/generic_arrayaslist-expected.txt @@ -122,35 +122,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 22 - }, - "end": { - "line": 20, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 22 - }, - "end": { - "line": 20, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -158,7 +130,7 @@ }, "end": { "line": 20, - "column": 27 + "column": 26 } } }, @@ -170,7 +142,7 @@ }, "end": { "line": 20, - "column": 27 + "column": 26 } } }, @@ -181,7 +153,7 @@ }, "end": { "line": 20, - "column": 27 + "column": 26 } } }, @@ -436,35 +408,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -472,7 +416,7 @@ }, "end": { "line": 22, - "column": 26 + "column": 25 } } }, @@ -484,7 +428,7 @@ }, "end": { "line": 22, - "column": 26 + "column": 25 } } }, @@ -495,7 +439,7 @@ }, "end": { "line": 22, - "column": 26 + "column": 25 } } }, @@ -3796,35 +3740,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 39, - "column": 49 - }, - "end": { - "line": 39, - "column": 53 - } - } - }, - "loc": { - "start": { - "line": 39, - "column": 49 - }, - "end": { - "line": 39, - "column": 55 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 39, @@ -3832,7 +3748,7 @@ }, "end": { "line": 39, - "column": 55 + "column": 53 } } }, @@ -5157,35 +5073,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 58, - "column": 36 - }, - "end": { - "line": 58, - "column": 40 - } - } - }, - "loc": { - "start": { - "line": 58, - "column": 36 - }, - "end": { - "line": 58, - "column": 42 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 58, @@ -5193,7 +5081,7 @@ }, "end": { "line": 58, - "column": 42 + "column": 40 } } }, @@ -6548,35 +6436,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 79, - "column": 38 - }, - "end": { - "line": 79, - "column": 42 - } - } - }, - "loc": { - "start": { - "line": 79, - "column": 38 - }, - "end": { - "line": 79, - "column": 44 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 79, @@ -6584,7 +6444,7 @@ }, "end": { "line": 79, - "column": 44 + "column": 42 } } }, @@ -8738,35 +8598,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 102, - "column": 37 - }, - "end": { - "line": 102, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 102, - "column": 37 - }, - "end": { - "line": 102, - "column": 43 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 102, @@ -8774,7 +8606,7 @@ }, "end": { "line": 102, - "column": 43 + "column": 41 } } }, @@ -17993,35 +17825,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 203, - "column": 97 - }, - "end": { - "line": 203, - "column": 101 - } - } - }, - "loc": { - "start": { - "line": 203, - "column": 97 - }, - "end": { - "line": 203, - "column": 103 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 203, @@ -18029,7 +17833,7 @@ }, "end": { "line": 203, - "column": 103 + "column": 101 } } }, @@ -20239,35 +20043,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 225, - "column": 99 - }, - "end": { - "line": 225, - "column": 103 - } - } - }, - "loc": { - "start": { - "line": 225, - "column": 99 - }, - "end": { - "line": 225, - "column": 105 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 225, @@ -20275,7 +20051,7 @@ }, "end": { "line": 225, - "column": 105 + "column": 103 } } }, diff --git a/ets2panda/test/compiler/ets/generic_class_getter_setter-expected.txt b/ets2panda/test/compiler/ets/generic_class_getter_setter-expected.txt index aa42a01485..efe229c1d5 100644 --- a/ets2panda/test/compiler/ets/generic_class_getter_setter-expected.txt +++ b/ets2panda/test/compiler/ets/generic_class_getter_setter-expected.txt @@ -332,35 +332,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 27 - }, - "end": { - "line": 18, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 27 - }, - "end": { - "line": 18, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -368,7 +340,7 @@ }, "end": { "line": 18, - "column": 33 + "column": 31 } } }, @@ -711,35 +683,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -747,7 +691,7 @@ }, "end": { "line": 21, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_deadlock-expected.txt b/ets2panda/test/compiler/ets/generic_deadlock-expected.txt index 13ab0857ac..e097618435 100644 --- a/ets2panda/test/compiler/ets/generic_deadlock-expected.txt +++ b/ets2panda/test/compiler/ets/generic_deadlock-expected.txt @@ -915,35 +915,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 18 - }, - "end": { - "line": 25, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 18 - }, - "end": { - "line": 25, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 25, @@ -951,7 +923,7 @@ }, "end": { "line": 25, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_function_call_1-expected.txt b/ets2panda/test/compiler/ets/generic_function_call_1-expected.txt index 3f59e363d5..e649c890a5 100644 --- a/ets2panda/test/compiler/ets/generic_function_call_1-expected.txt +++ b/ets2panda/test/compiler/ets/generic_function_call_1-expected.txt @@ -506,35 +506,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 19 - }, - "end": { - "line": 20, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 19 - }, - "end": { - "line": 20, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -542,7 +514,7 @@ }, "end": { "line": 20, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/generic_function_call_2-expected.txt b/ets2panda/test/compiler/ets/generic_function_call_2-expected.txt index 40b5c23fb5..729713e216 100644 --- a/ets2panda/test/compiler/ets/generic_function_call_2-expected.txt +++ b/ets2panda/test/compiler/ets/generic_function_call_2-expected.txt @@ -643,35 +643,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 19 - }, - "end": { - "line": 21, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 19 - }, - "end": { - "line": 21, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -679,7 +651,7 @@ }, "end": { "line": 21, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/generic_function_call_3-expected.txt b/ets2panda/test/compiler/ets/generic_function_call_3-expected.txt index 9202914ca8..dae3a96db7 100644 --- a/ets2panda/test/compiler/ets/generic_function_call_3-expected.txt +++ b/ets2panda/test/compiler/ets/generic_function_call_3-expected.txt @@ -683,35 +683,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 19 - }, - "end": { - "line": 21, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 19 - }, - "end": { - "line": 21, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -719,7 +691,7 @@ }, "end": { "line": 21, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/generic_function_call_4-expected.txt b/ets2panda/test/compiler/ets/generic_function_call_4-expected.txt index 73ff374fd4..e4431c9770 100644 --- a/ets2panda/test/compiler/ets/generic_function_call_4-expected.txt +++ b/ets2panda/test/compiler/ets/generic_function_call_4-expected.txt @@ -1677,35 +1677,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 18 - }, - "end": { - "line": 29, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 18 - }, - "end": { - "line": 29, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 29, @@ -1713,7 +1685,7 @@ }, "end": { "line": 29, - "column": 24 + "column": 22 } } }, 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 42dbbefc7b..df5c348a72 100644 --- a/ets2panda/test/compiler/ets/generic_function_call_5-expected.txt +++ b/ets2panda/test/compiler/ets/generic_function_call_5-expected.txt @@ -197,35 +197,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 51 - }, - "end": { - "line": 17, - "column": 55 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 51 - }, - "end": { - "line": 17, - "column": 56 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -233,7 +205,7 @@ }, "end": { "line": 17, - "column": 56 + "column": 55 } } }, @@ -244,7 +216,7 @@ }, "end": { "line": 17, - "column": 56 + "column": 55 } } }, @@ -256,7 +228,7 @@ }, "end": { "line": 17, - "column": 56 + "column": 55 } } }, @@ -267,41 +239,13 @@ }, "end": { "line": 17, - "column": 56 + "column": 55 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 60 - }, - "end": { - "line": 17, - "column": 64 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 60 - }, - "end": { - "line": 17, - "column": 71 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -309,7 +253,7 @@ }, "end": { "line": 17, - "column": 71 + "column": 64 } } } @@ -321,7 +265,7 @@ }, "end": { "line": 17, - "column": 71 + "column": 64 } } }, @@ -333,7 +277,7 @@ }, "end": { "line": 17, - "column": 71 + "column": 64 } } }, @@ -344,7 +288,7 @@ }, "end": { "line": 17, - "column": 71 + "column": 64 } } } @@ -948,35 +892,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 53 - }, - "end": { - "line": 24, - "column": 57 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 53 - }, - "end": { - "line": 24, - "column": 58 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -984,7 +900,7 @@ }, "end": { "line": 24, - "column": 58 + "column": 57 } } }, @@ -995,7 +911,7 @@ }, "end": { "line": 24, - "column": 58 + "column": 57 } } }, @@ -1007,7 +923,7 @@ }, "end": { "line": 24, - "column": 58 + "column": 57 } } }, @@ -1018,41 +934,13 @@ }, "end": { "line": 24, - "column": 58 + "column": 57 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 60 - }, - "end": { - "line": 24, - "column": 64 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 60 - }, - "end": { - "line": 24, - "column": 67 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -1060,7 +948,7 @@ }, "end": { "line": 24, - "column": 67 + "column": 64 } } }, diff --git a/ets2panda/test/compiler/ets/generic_function_call_7-expected.txt b/ets2panda/test/compiler/ets/generic_function_call_7-expected.txt index ee92a4e931..7706d9d16d 100644 --- a/ets2panda/test/compiler/ets/generic_function_call_7-expected.txt +++ b/ets2panda/test/compiler/ets/generic_function_call_7-expected.txt @@ -439,35 +439,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -475,7 +447,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_typealias_1-expected.txt b/ets2panda/test/compiler/ets/generic_typealias_1-expected.txt index 8e27fca50e..d9c188072b 100644 --- a/ets2panda/test/compiler/ets/generic_typealias_1-expected.txt +++ b/ets2panda/test/compiler/ets/generic_typealias_1-expected.txt @@ -691,35 +691,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -727,7 +699,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_typealias_2_neg-expected.txt b/ets2panda/test/compiler/ets/generic_typealias_2_neg-expected.txt index b62ce00490..5ea41e878f 100644 --- a/ets2panda/test/compiler/ets/generic_typealias_2_neg-expected.txt +++ b/ets2panda/test/compiler/ets/generic_typealias_2_neg-expected.txt @@ -274,35 +274,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -310,7 +282,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_typealias_3_neg-expected.txt b/ets2panda/test/compiler/ets/generic_typealias_3_neg-expected.txt index b02e59012d..b867e8eff9 100644 --- a/ets2panda/test/compiler/ets/generic_typealias_3_neg-expected.txt +++ b/ets2panda/test/compiler/ets/generic_typealias_3_neg-expected.txt @@ -231,35 +231,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -267,7 +239,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_typealias_4_neg-expected.txt b/ets2panda/test/compiler/ets/generic_typealias_4_neg-expected.txt index 9be51ba288..d45b98d699 100644 --- a/ets2panda/test/compiler/ets/generic_typealias_4_neg-expected.txt +++ b/ets2panda/test/compiler/ets/generic_typealias_4_neg-expected.txt @@ -274,35 +274,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -310,7 +282,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_typealias_5_neg-expected.txt b/ets2panda/test/compiler/ets/generic_typealias_5_neg-expected.txt index 3d97f85066..0f0cea59cf 100644 --- a/ets2panda/test/compiler/ets/generic_typealias_5_neg-expected.txt +++ b/ets2panda/test/compiler/ets/generic_typealias_5_neg-expected.txt @@ -744,35 +744,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -780,7 +752,7 @@ }, "end": { "line": 21, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_typealias_6-expected.txt b/ets2panda/test/compiler/ets/generic_typealias_6-expected.txt index 116b3cb483..956de2330f 100644 --- a/ets2panda/test/compiler/ets/generic_typealias_6-expected.txt +++ b/ets2panda/test/compiler/ets/generic_typealias_6-expected.txt @@ -607,35 +607,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -643,7 +615,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_typealias_7_neg-expected.txt b/ets2panda/test/compiler/ets/generic_typealias_7_neg-expected.txt index cb253be2b7..ac7857c8a3 100644 --- a/ets2panda/test/compiler/ets/generic_typealias_7_neg-expected.txt +++ b/ets2panda/test/compiler/ets/generic_typealias_7_neg-expected.txt @@ -274,35 +274,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -310,7 +282,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_typealias_8-expected.txt b/ets2panda/test/compiler/ets/generic_typealias_8-expected.txt index c91e3d2dd9..4a416ed51f 100644 --- a/ets2panda/test/compiler/ets/generic_typealias_8-expected.txt +++ b/ets2panda/test/compiler/ets/generic_typealias_8-expected.txt @@ -411,35 +411,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -447,7 +419,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_typealias_9-expected.txt b/ets2panda/test/compiler/ets/generic_typealias_9-expected.txt index 12338275bc..425f798ad6 100644 --- a/ets2panda/test/compiler/ets/generic_typealias_9-expected.txt +++ b/ets2panda/test/compiler/ets/generic_typealias_9-expected.txt @@ -330,35 +330,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -366,7 +338,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_variance_2-expected.txt b/ets2panda/test/compiler/ets/generic_variance_2-expected.txt index 227f565f38..27623d6e6a 100644 --- a/ets2panda/test/compiler/ets/generic_variance_2-expected.txt +++ b/ets2panda/test/compiler/ets/generic_variance_2-expected.txt @@ -838,35 +838,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -874,7 +846,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_variance_3-expected.txt b/ets2panda/test/compiler/ets/generic_variance_3-expected.txt index 3bb1aa6f55..21dc3ae14a 100644 --- a/ets2panda/test/compiler/ets/generic_variance_3-expected.txt +++ b/ets2panda/test/compiler/ets/generic_variance_3-expected.txt @@ -838,35 +838,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -874,7 +846,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_variance_4-expected.txt b/ets2panda/test/compiler/ets/generic_variance_4-expected.txt index a3be0edfd5..caf7a12935 100644 --- a/ets2panda/test/compiler/ets/generic_variance_4-expected.txt +++ b/ets2panda/test/compiler/ets/generic_variance_4-expected.txt @@ -798,35 +798,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -834,7 +806,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generic_variance_5-expected.txt b/ets2panda/test/compiler/ets/generic_variance_5-expected.txt index 07709a6558..39a4fb3d22 100644 --- a/ets2panda/test/compiler/ets/generic_variance_5-expected.txt +++ b/ets2panda/test/compiler/ets/generic_variance_5-expected.txt @@ -798,35 +798,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -834,7 +806,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generics_class_recursive_type_1-expected.txt b/ets2panda/test/compiler/ets/generics_class_recursive_type_1-expected.txt index 8c18f48d2d..743d0838fa 100644 --- a/ets2panda/test/compiler/ets/generics_class_recursive_type_1-expected.txt +++ b/ets2panda/test/compiler/ets/generics_class_recursive_type_1-expected.txt @@ -1917,35 +1917,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 39, - "column": 22 - }, - "end": { - "line": 39, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 39, - "column": 22 - }, - "end": { - "line": 39, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 39, @@ -1953,7 +1925,7 @@ }, "end": { "line": 39, - "column": 27 + "column": 26 } } }, @@ -1965,7 +1937,7 @@ }, "end": { "line": 39, - "column": 27 + "column": 26 } } }, @@ -1976,7 +1948,7 @@ }, "end": { "line": 39, - "column": 27 + "column": 26 } } }, @@ -2231,35 +2203,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 41, - "column": 21 - }, - "end": { - "line": 41, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 41, - "column": 21 - }, - "end": { - "line": 41, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 41, @@ -2267,7 +2211,7 @@ }, "end": { "line": 41, - "column": 26 + "column": 25 } } }, @@ -2279,7 +2223,7 @@ }, "end": { "line": 41, - "column": 26 + "column": 25 } } }, @@ -2290,7 +2234,7 @@ }, "end": { "line": 41, - "column": 26 + "column": 25 } } }, @@ -6084,35 +6028,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 61, - "column": 13 - }, - "end": { - "line": 61, - "column": 17 - } - } - }, - "loc": { - "start": { - "line": 61, - "column": 13 - }, - "end": { - "line": 61, - "column": 18 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 61, @@ -6120,7 +6036,7 @@ }, "end": { "line": 61, - "column": 18 + "column": 17 } } }, diff --git a/ets2panda/test/compiler/ets/generics_implicit_lambda1-expected.txt b/ets2panda/test/compiler/ets/generics_implicit_lambda1-expected.txt index 7fc151e937..1a4800f273 100644 --- a/ets2panda/test/compiler/ets/generics_implicit_lambda1-expected.txt +++ b/ets2panda/test/compiler/ets/generics_implicit_lambda1-expected.txt @@ -159,35 +159,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 49 - }, - "end": { - "line": 22, - "column": 53 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 49 - }, - "end": { - "line": 22, - "column": 54 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -195,7 +167,7 @@ }, "end": { "line": 22, - "column": 54 + "column": 53 } } }, @@ -206,7 +178,7 @@ }, "end": { "line": 22, - "column": 54 + "column": 53 } } }, @@ -218,7 +190,7 @@ }, "end": { "line": 22, - "column": 54 + "column": 53 } } }, @@ -229,7 +201,7 @@ }, "end": { "line": 22, - "column": 54 + "column": 53 } } } @@ -650,35 +622,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 52 - }, - "end": { - "line": 28, - "column": 56 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 52 - }, - "end": { - "line": 28, - "column": 57 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -686,7 +630,7 @@ }, "end": { "line": 28, - "column": 57 + "column": 56 } } }, @@ -697,7 +641,7 @@ }, "end": { "line": 28, - "column": 57 + "column": 56 } } }, @@ -709,7 +653,7 @@ }, "end": { "line": 28, - "column": 57 + "column": 56 } } }, @@ -720,7 +664,7 @@ }, "end": { "line": 28, - "column": 57 + "column": 56 } } } diff --git a/ets2panda/test/compiler/ets/generics_instantiation_1-expected.txt b/ets2panda/test/compiler/ets/generics_instantiation_1-expected.txt index 826c0e80a2..fa0eef0c28 100644 --- a/ets2panda/test/compiler/ets/generics_instantiation_1-expected.txt +++ b/ets2panda/test/compiler/ets/generics_instantiation_1-expected.txt @@ -628,35 +628,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 33 - }, - "end": { - "line": 24, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 33 - }, - "end": { - "line": 24, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -664,7 +636,7 @@ }, "end": { "line": 24, - "column": 39 + "column": 37 } } }, @@ -1073,35 +1045,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 21 - }, - "end": { - "line": 27, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 21 - }, - "end": { - "line": 27, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 27, @@ -1109,7 +1053,7 @@ }, "end": { "line": 27, - "column": 27 + "column": 25 } } }, diff --git a/ets2panda/test/compiler/ets/generics_instantiation_2-expected.txt b/ets2panda/test/compiler/ets/generics_instantiation_2-expected.txt index de5ede9edc..fbbd051673 100644 --- a/ets2panda/test/compiler/ets/generics_instantiation_2-expected.txt +++ b/ets2panda/test/compiler/ets/generics_instantiation_2-expected.txt @@ -1509,35 +1509,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 34, - "column": 31 - }, - "end": { - "line": 34, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 34, - "column": 31 - }, - "end": { - "line": 34, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 34, @@ -1545,7 +1517,7 @@ }, "end": { "line": 34, - "column": 37 + "column": 35 } } }, diff --git a/ets2panda/test/compiler/ets/generics_instantiation_3-expected.txt b/ets2panda/test/compiler/ets/generics_instantiation_3-expected.txt index 7e2cc15cd5..757b511447 100644 --- a/ets2panda/test/compiler/ets/generics_instantiation_3-expected.txt +++ b/ets2panda/test/compiler/ets/generics_instantiation_3-expected.txt @@ -222,35 +222,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -258,7 +230,7 @@ }, "end": { "line": 17, - "column": 29 + "column": 27 } } }, diff --git a/ets2panda/test/compiler/ets/generics_instantiation_4-expected.txt b/ets2panda/test/compiler/ets/generics_instantiation_4-expected.txt index adac48e1f2..3f86acf50d 100644 --- a/ets2panda/test/compiler/ets/generics_instantiation_4-expected.txt +++ b/ets2panda/test/compiler/ets/generics_instantiation_4-expected.txt @@ -2420,35 +2420,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 44, - "column": 29 - }, - "end": { - "line": 44, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 44, - "column": 29 - }, - "end": { - "line": 44, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 44, @@ -2456,7 +2428,7 @@ }, "end": { "line": 44, - "column": 35 + "column": 33 } } }, diff --git a/ets2panda/test/compiler/ets/generics_interface_bounds_1-expected.txt b/ets2panda/test/compiler/ets/generics_interface_bounds_1-expected.txt index 618aaf0ee7..366732cf5e 100644 --- a/ets2panda/test/compiler/ets/generics_interface_bounds_1-expected.txt +++ b/ets2panda/test/compiler/ets/generics_interface_bounds_1-expected.txt @@ -122,35 +122,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 17 - }, - "end": { - "line": 17, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 17 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -158,7 +130,7 @@ }, "end": { "line": 17, - "column": 22 + "column": 21 } } }, @@ -170,7 +142,7 @@ }, "end": { "line": 17, - "column": 22 + "column": 21 } } }, @@ -181,7 +153,7 @@ }, "end": { "line": 17, - "column": 22 + "column": 21 } } }, @@ -564,35 +536,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 12 - }, - "end": { - "line": 23, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 12 - }, - "end": { - "line": 23, - "column": 18 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -600,7 +544,7 @@ }, "end": { "line": 23, - "column": 18 + "column": 16 } } }, diff --git a/ets2panda/test/compiler/ets/generics_primitive_type_param_1-expected.txt b/ets2panda/test/compiler/ets/generics_primitive_type_param_1-expected.txt index beeda0916c..617fe539c2 100644 --- a/ets2panda/test/compiler/ets/generics_primitive_type_param_1-expected.txt +++ b/ets2panda/test/compiler/ets/generics_primitive_type_param_1-expected.txt @@ -524,35 +524,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -560,7 +532,7 @@ }, "end": { "line": 21, - "column": 30 + "column": 28 } } }, @@ -659,35 +631,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 18 - }, - "end": { - "line": 23, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 18 - }, - "end": { - "line": 23, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -695,7 +639,7 @@ }, "end": { "line": 23, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generics_primitive_type_param_neg_1-expected.txt b/ets2panda/test/compiler/ets/generics_primitive_type_param_neg_1-expected.txt index 6fac876a48..2ba95b46d8 100644 --- a/ets2panda/test/compiler/ets/generics_primitive_type_param_neg_1-expected.txt +++ b/ets2panda/test/compiler/ets/generics_primitive_type_param_neg_1-expected.txt @@ -419,35 +419,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -455,7 +427,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/generics_primitive_type_param_neg_2-expected.txt b/ets2panda/test/compiler/ets/generics_primitive_type_param_neg_2-expected.txt index cb01550c5c..f7ef7e3ec7 100644 --- a/ets2panda/test/compiler/ets/generics_primitive_type_param_neg_2-expected.txt +++ b/ets2panda/test/compiler/ets/generics_primitive_type_param_neg_2-expected.txt @@ -556,35 +556,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -592,7 +564,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/identifierReference10-expected.txt b/ets2panda/test/compiler/ets/identifierReference10-expected.txt index ac3b7839e9..aba0da5897 100644 --- a/ets2panda/test/compiler/ets/identifierReference10-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference10-expected.txt @@ -400,35 +400,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -436,7 +408,7 @@ }, "end": { "line": 23, - "column": 16 + "column": 14 } } }, diff --git a/ets2panda/test/compiler/ets/identifierReference11-expected.txt b/ets2panda/test/compiler/ets/identifierReference11-expected.txt index f0d6012410..1365fa17d6 100644 --- a/ets2panda/test/compiler/ets/identifierReference11-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference11-expected.txt @@ -268,35 +268,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -304,7 +276,7 @@ }, "end": { "line": 21, - "column": 16 + "column": 14 } } }, diff --git a/ets2panda/test/compiler/ets/identifierReference12-expected.txt b/ets2panda/test/compiler/ets/identifierReference12-expected.txt index c41ed2bceb..8491cf6b45 100644 --- a/ets2panda/test/compiler/ets/identifierReference12-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference12-expected.txt @@ -400,35 +400,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -436,7 +408,7 @@ }, "end": { "line": 23, - "column": 16 + "column": 14 } } }, diff --git a/ets2panda/test/compiler/ets/identifierReference13-expected.txt b/ets2panda/test/compiler/ets/identifierReference13-expected.txt index b9a14ad2ff..e79b13c7ad 100644 --- a/ets2panda/test/compiler/ets/identifierReference13-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference13-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 10 - }, - "end": { - "line": 17, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 10 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 16 + "column": 14 } } }, @@ -472,35 +444,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -508,7 +452,7 @@ }, "end": { "line": 23, - "column": 16 + "column": 14 } } }, diff --git a/ets2panda/test/compiler/ets/identifierReference14-expected.txt b/ets2panda/test/compiler/ets/identifierReference14-expected.txt index eac46b8ad2..f1ea709d8e 100644 --- a/ets2panda/test/compiler/ets/identifierReference14-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference14-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 10 - }, - "end": { - "line": 22, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 10 - }, - "end": { - "line": 22, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -104,7 +76,7 @@ }, "end": { "line": 22, - "column": 16 + "column": 14 } } }, @@ -463,35 +435,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 24 - }, - "end": { - "line": 28, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 24 - }, - "end": { - "line": 28, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -499,7 +443,7 @@ }, "end": { "line": 28, - "column": 30 + "column": 28 } } }, @@ -598,35 +542,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 10 - }, - "end": { - "line": 32, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 10 - }, - "end": { - "line": 32, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 32, @@ -634,7 +550,7 @@ }, "end": { "line": 32, - "column": 16 + "column": 14 } } }, @@ -1065,35 +981,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -1101,7 +989,7 @@ }, "end": { "line": 17, - "column": 29 + "column": 27 } } }, diff --git a/ets2panda/test/compiler/ets/identifierReference2-expected.txt b/ets2panda/test/compiler/ets/identifierReference2-expected.txt index 7136118c6d..e533c263b4 100644 --- a/ets2panda/test/compiler/ets/identifierReference2-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference2-expected.txt @@ -299,35 +299,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 27 - }, - "end": { - "line": 16, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 27 - }, - "end": { - "line": 16, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -335,7 +307,7 @@ }, "end": { "line": 16, - "column": 33 + "column": 31 } } }, @@ -346,7 +318,7 @@ }, "end": { "line": 16, - "column": 33 + "column": 31 } } }, diff --git a/ets2panda/test/compiler/ets/identifierReference3-expected.txt b/ets2panda/test/compiler/ets/identifierReference3-expected.txt index a3d2d178bc..14afe7479d 100644 --- a/ets2panda/test/compiler/ets/identifierReference3-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference3-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 10 - }, - "end": { - "line": 19, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 10 - }, - "end": { - "line": 19, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -104,7 +76,7 @@ }, "end": { "line": 19, - "column": 16 + "column": 14 } } }, diff --git a/ets2panda/test/compiler/ets/identifierReference4-expected.txt b/ets2panda/test/compiler/ets/identifierReference4-expected.txt index a1c5b3b57d..8dc988a332 100644 --- a/ets2panda/test/compiler/ets/identifierReference4-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference4-expected.txt @@ -322,35 +322,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -358,7 +330,7 @@ }, "end": { "line": 23, - "column": 16 + "column": 14 } } }, diff --git a/ets2panda/test/compiler/ets/identifierReference5-expected.txt b/ets2panda/test/compiler/ets/identifierReference5-expected.txt index ebaa3df039..ab93cc2a3c 100644 --- a/ets2panda/test/compiler/ets/identifierReference5-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference5-expected.txt @@ -154,35 +154,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -190,7 +162,7 @@ }, "end": { "line": 22, - "column": 23 + "column": 22 } } }, @@ -201,7 +173,7 @@ }, "end": { "line": 22, - "column": 23 + "column": 22 } } }, @@ -214,7 +186,7 @@ }, "end": { "line": 22, - "column": 23 + "column": 22 } } }, @@ -441,35 +413,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 10 - }, - "end": { - "line": 26, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 10 - }, - "end": { - "line": 26, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 26, @@ -477,7 +421,7 @@ }, "end": { "line": 26, - "column": 16 + "column": 14 } } }, @@ -661,35 +605,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 17 - }, - "end": { - "line": 30, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 17 - }, - "end": { - "line": 30, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 30, @@ -697,7 +613,7 @@ }, "end": { "line": 30, - "column": 23 + "column": 21 } } }, @@ -1155,35 +1071,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -1191,7 +1079,7 @@ }, "end": { "line": 16, - "column": 29 + "column": 27 } } }, diff --git a/ets2panda/test/compiler/ets/identifierReference8-expected.txt b/ets2panda/test/compiler/ets/identifierReference8-expected.txt index 83755755a3..e024f14005 100644 --- a/ets2panda/test/compiler/ets/identifierReference8-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference8-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 10 - }, - "end": { - "line": 19, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 10 - }, - "end": { - "line": 19, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -104,7 +76,7 @@ }, "end": { "line": 19, - "column": 16 + "column": 14 } } }, @@ -203,35 +175,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -239,7 +183,7 @@ }, "end": { "line": 23, - "column": 16 + "column": 14 } } }, diff --git a/ets2panda/test/compiler/ets/identifierReference9-expected.txt b/ets2panda/test/compiler/ets/identifierReference9-expected.txt index 353fdd49ca..9821c82b36 100644 --- a/ets2panda/test/compiler/ets/identifierReference9-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference9-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 10 - }, - "end": { - "line": 19, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 10 - }, - "end": { - "line": 19, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -104,7 +76,7 @@ }, "end": { "line": 19, - "column": 16 + "column": 14 } } }, @@ -203,35 +175,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -239,7 +183,7 @@ }, "end": { "line": 23, - "column": 16 + "column": 14 } } }, diff --git a/ets2panda/test/compiler/ets/implicit-conversion-expected.txt b/ets2panda/test/compiler/ets/implicit-conversion-expected.txt index c45fd0e9db..43583c7c2a 100644 --- a/ets2panda/test/compiler/ets/implicit-conversion-expected.txt +++ b/ets2panda/test/compiler/ets/implicit-conversion-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/import_tests/asyncfun_lambda_lib-expected.txt b/ets2panda/test/compiler/ets/import_tests/asyncfun_lambda_lib-expected.txt index 18e7fbe5a7..301cf86972 100644 --- a/ets2panda/test/compiler/ets/import_tests/asyncfun_lambda_lib-expected.txt +++ b/ets2panda/test/compiler/ets/import_tests/asyncfun_lambda_lib-expected.txt @@ -788,35 +788,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 33 - }, - "end": { - "line": 18, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 33 - }, - "end": { - "line": 18, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -824,7 +796,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 37 } } }, @@ -835,7 +807,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 37 } } }, @@ -847,7 +819,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 37 } } }, @@ -858,41 +830,13 @@ }, "end": { "line": 18, - "column": 38 + "column": 37 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 40 - }, - "end": { - "line": 18, - "column": 44 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 40 - }, - "end": { - "line": 18, - "column": 46 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -900,7 +844,7 @@ }, "end": { "line": 18, - "column": 46 + "column": 44 } } }, @@ -1162,35 +1106,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 30 - }, - "end": { - "line": 19, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 30 - }, - "end": { - "line": 19, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -1198,7 +1114,7 @@ }, "end": { "line": 19, - "column": 36 + "column": 34 } } }, @@ -1209,7 +1125,7 @@ }, "end": { "line": 19, - "column": 36 + "column": 34 } } }, diff --git a/ets2panda/test/compiler/ets/import_tests/asyncfunc_lambda_main-expected.txt b/ets2panda/test/compiler/ets/import_tests/asyncfunc_lambda_main-expected.txt index 42f9175b8e..63b1873b22 100644 --- a/ets2panda/test/compiler/ets/import_tests/asyncfunc_lambda_main-expected.txt +++ b/ets2panda/test/compiler/ets/import_tests/asyncfunc_lambda_main-expected.txt @@ -450,35 +450,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -486,7 +458,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, @@ -1132,35 +1104,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 20 - }, - "end": { - "line": 30, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 20 - }, - "end": { - "line": 30, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 30, @@ -1168,7 +1112,7 @@ }, "end": { "line": 30, - "column": 27 + "column": 24 } } }, diff --git a/ets2panda/test/compiler/ets/interfaceMethodNotOverridden-expected.txt b/ets2panda/test/compiler/ets/interfaceMethodNotOverridden-expected.txt index 5ffb88ab4a..2fa070f0f3 100644 --- a/ets2panda/test/compiler/ets/interfaceMethodNotOverridden-expected.txt +++ b/ets2panda/test/compiler/ets/interfaceMethodNotOverridden-expected.txt @@ -52,35 +52,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 17 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -88,7 +60,7 @@ }, "end": { "line": 17, - "column": 17 + "column": 16 } } }, @@ -100,7 +72,7 @@ }, "end": { "line": 17, - "column": 17 + "column": 16 } } }, @@ -111,7 +83,7 @@ }, "end": { "line": 17, - "column": 17 + "column": 16 } } }, @@ -331,35 +303,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 25 - }, - "end": { - "line": 21, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 25 - }, - "end": { - "line": 21, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -367,7 +311,7 @@ }, "end": { "line": 21, - "column": 31 + "column": 29 } } }, diff --git a/ets2panda/test/compiler/ets/invalidCallInstruction-expected.txt b/ets2panda/test/compiler/ets/invalidCallInstruction-expected.txt index 5a6ea0bffa..881273d21b 100644 --- a/ets2panda/test/compiler/ets/invalidCallInstruction-expected.txt +++ b/ets2panda/test/compiler/ets/invalidCallInstruction-expected.txt @@ -1117,35 +1117,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 35, - "column": 17 - }, - "end": { - "line": 35, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 35, - "column": 17 - }, - "end": { - "line": 35, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 35, @@ -1153,7 +1125,7 @@ }, "end": { "line": 35, - "column": 23 + "column": 21 } } }, @@ -1164,7 +1136,7 @@ }, "end": { "line": 35, - "column": 23 + "column": 21 } } }, @@ -1190,35 +1162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 35, - "column": 29 - }, - "end": { - "line": 35, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 35, - "column": 29 - }, - "end": { - "line": 35, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 35, @@ -1226,7 +1170,7 @@ }, "end": { "line": 35, - "column": 36 + "column": 33 } } }, diff --git a/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromClass-expected.txt b/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromClass-expected.txt index 33cb453b9b..ec301c1952 100644 --- a/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromClass-expected.txt +++ b/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromClass-expected.txt @@ -1016,35 +1016,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 32, @@ -1052,7 +1024,7 @@ }, "end": { "line": 32, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromInterface-expected.txt b/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromInterface-expected.txt index e6a9aa7fd9..d248ed025a 100644 --- a/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromInterface-expected.txt +++ b/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromInterface-expected.txt @@ -939,35 +939,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 32, @@ -975,7 +947,7 @@ }, "end": { "line": 32, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/invalidInheritance1-expected.txt b/ets2panda/test/compiler/ets/invalidInheritance1-expected.txt index 035dd5dd21..6612b6701b 100644 --- a/ets2panda/test/compiler/ets/invalidInheritance1-expected.txt +++ b/ets2panda/test/compiler/ets/invalidInheritance1-expected.txt @@ -350,35 +350,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 16 - }, - "end": { - "line": 21, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 16 - }, - "end": { - "line": 21, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -386,7 +358,7 @@ }, "end": { "line": 21, - "column": 22 + "column": 20 } } }, diff --git a/ets2panda/test/compiler/ets/invalidInheritance3-expected.txt b/ets2panda/test/compiler/ets/invalidInheritance3-expected.txt index bb1005989a..f3a397503a 100644 --- a/ets2panda/test/compiler/ets/invalidInheritance3-expected.txt +++ b/ets2panda/test/compiler/ets/invalidInheritance3-expected.txt @@ -132,35 +132,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -168,7 +140,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 32 } } }, @@ -179,7 +151,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 32 } } }, @@ -192,7 +164,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 32 } } }, diff --git a/ets2panda/test/compiler/ets/invalidInheritanceFromClass-expected.txt b/ets2panda/test/compiler/ets/invalidInheritanceFromClass-expected.txt index 13e1ac543f..b0ef26a98c 100644 --- a/ets2panda/test/compiler/ets/invalidInheritanceFromClass-expected.txt +++ b/ets2panda/test/compiler/ets/invalidInheritanceFromClass-expected.txt @@ -839,35 +839,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 18 - }, - "end": { - "line": 29, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 18 - }, - "end": { - "line": 29, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 29, @@ -875,7 +847,7 @@ }, "end": { "line": 29, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/invalidInheritanceFromInterface-expected.txt b/ets2panda/test/compiler/ets/invalidInheritanceFromInterface-expected.txt index e91b4302b3..9e9c1c964e 100644 --- a/ets2panda/test/compiler/ets/invalidInheritanceFromInterface-expected.txt +++ b/ets2panda/test/compiler/ets/invalidInheritanceFromInterface-expected.txt @@ -762,35 +762,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 18 - }, - "end": { - "line": 29, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 18 - }, - "end": { - "line": 29, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 29, @@ -798,7 +770,7 @@ }, "end": { "line": 29, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/invalidInheritanceFromInterfaceStaticMethod-expected.txt b/ets2panda/test/compiler/ets/invalidInheritanceFromInterfaceStaticMethod-expected.txt index c5e6ef8650..aadbca07d2 100644 --- a/ets2panda/test/compiler/ets/invalidInheritanceFromInterfaceStaticMethod-expected.txt +++ b/ets2panda/test/compiler/ets/invalidInheritanceFromInterfaceStaticMethod-expected.txt @@ -764,35 +764,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 18 - }, - "end": { - "line": 29, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 18 - }, - "end": { - "line": 29, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 29, @@ -800,7 +772,7 @@ }, "end": { "line": 29, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext1-expected.txt b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext1-expected.txt index e5000ca2bf..c94d58895a 100644 --- a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext1-expected.txt +++ b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext1-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 30 + "column": 28 } } }, @@ -203,35 +175,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -239,7 +183,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 36 } } }, @@ -408,35 +352,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 31 - }, - "end": { - "line": 20, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 31 - }, - "end": { - "line": 20, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -444,7 +360,7 @@ }, "end": { "line": 20, - "column": 37 + "column": 35 } } }, diff --git a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext2-expected.txt b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext2-expected.txt index ea3316db26..17f54da223 100644 --- a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext2-expected.txt +++ b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext2-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 30 + "column": 28 } } }, @@ -203,35 +175,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -239,7 +183,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 36 } } }, @@ -408,35 +352,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 31 - }, - "end": { - "line": 20, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 31 - }, - "end": { - "line": 20, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -444,7 +360,7 @@ }, "end": { "line": 20, - "column": 37 + "column": 35 } } }, diff --git a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext3-expected.txt b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext3-expected.txt index 71aed74035..bba617a050 100644 --- a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext3-expected.txt +++ b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext3-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 30 + "column": 28 } } }, @@ -203,35 +175,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -239,7 +183,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 36 } } }, @@ -408,35 +352,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 31 - }, - "end": { - "line": 20, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 31 - }, - "end": { - "line": 20, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -444,7 +360,7 @@ }, "end": { "line": 20, - "column": 37 + "column": 35 } } }, diff --git a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext4-expected.txt b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext4-expected.txt index 6a39955b55..bf951e79da 100644 --- a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext4-expected.txt +++ b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext4-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 30 + "column": 28 } } }, @@ -203,35 +175,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -239,7 +183,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 36 } } }, @@ -475,35 +419,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -511,7 +427,7 @@ }, "end": { "line": 22, - "column": 31 + "column": 29 } } }, diff --git a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext5-expected.txt b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext5-expected.txt index b552140602..c5809fe428 100644 --- a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext5-expected.txt +++ b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext5-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 30 + "column": 28 } } }, @@ -203,35 +175,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -239,7 +183,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 36 } } }, @@ -515,35 +459,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -551,7 +467,7 @@ }, "end": { "line": 22, - "column": 31 + "column": 29 } } }, diff --git a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext6-expected.txt b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext6-expected.txt index a038226fee..5a0f9e5837 100644 --- a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext6-expected.txt +++ b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext6-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 30 + "column": 28 } } }, @@ -203,35 +175,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -239,7 +183,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 36 } } }, @@ -515,35 +459,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -551,7 +467,7 @@ }, "end": { "line": 22, - "column": 31 + "column": 29 } } }, diff --git a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext7-expected.txt b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext7-expected.txt index 76d81db4cf..69a7dcee3d 100644 --- a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext7-expected.txt +++ b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext7-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 30 + "column": 28 } } }, @@ -203,35 +175,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -239,7 +183,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 36 } } }, @@ -515,35 +459,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -551,7 +467,7 @@ }, "end": { "line": 22, - "column": 31 + "column": 29 } } }, diff --git a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext8-expected.txt b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext8-expected.txt index de53553744..aad6f38d22 100644 --- a/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext8-expected.txt +++ b/ets2panda/test/compiler/ets/invalidMemberExpressionFromStaticContext8-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 30 + "column": 28 } } }, @@ -203,35 +175,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -239,7 +183,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 36 } } }, @@ -515,35 +459,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -551,7 +467,7 @@ }, "end": { "line": 22, - "column": 31 + "column": 29 } } }, diff --git a/ets2panda/test/compiler/ets/invalidPrivateAccess1-expected.txt b/ets2panda/test/compiler/ets/invalidPrivateAccess1-expected.txt index f902846d03..327677bd8f 100644 --- a/ets2panda/test/compiler/ets/invalidPrivateAccess1-expected.txt +++ b/ets2panda/test/compiler/ets/invalidPrivateAccess1-expected.txt @@ -425,35 +425,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -461,7 +433,7 @@ }, "end": { "line": 21, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/invalidPrivateAccess2-expected.txt b/ets2panda/test/compiler/ets/invalidPrivateAccess2-expected.txt index 37596af9b0..cc9be67f4a 100644 --- a/ets2panda/test/compiler/ets/invalidPrivateAccess2-expected.txt +++ b/ets2panda/test/compiler/ets/invalidPrivateAccess2-expected.txt @@ -448,35 +448,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -484,7 +456,7 @@ }, "end": { "line": 24, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/invalidPrivateAccess3-expected.txt b/ets2panda/test/compiler/ets/invalidPrivateAccess3-expected.txt index 7a5181e8f8..37bbc972cc 100644 --- a/ets2panda/test/compiler/ets/invalidPrivateAccess3-expected.txt +++ b/ets2panda/test/compiler/ets/invalidPrivateAccess3-expected.txt @@ -310,35 +310,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 20 - }, - "end": { - "line": 23, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 20 - }, - "end": { - "line": 23, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -346,7 +318,7 @@ }, "end": { "line": 23, - "column": 26 + "column": 24 } } }, @@ -475,35 +447,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 25 - }, - "end": { - "line": 27, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 25 - }, - "end": { - "line": 27, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 27, @@ -511,7 +455,7 @@ }, "end": { "line": 27, - "column": 31 + "column": 29 } } }, @@ -761,35 +705,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 32, @@ -797,7 +713,7 @@ }, "end": { "line": 32, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/invalidProtectedAccess1-expected.txt b/ets2panda/test/compiler/ets/invalidProtectedAccess1-expected.txt index 013fcfafc4..a31539a925 100644 --- a/ets2panda/test/compiler/ets/invalidProtectedAccess1-expected.txt +++ b/ets2panda/test/compiler/ets/invalidProtectedAccess1-expected.txt @@ -425,35 +425,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -461,7 +433,7 @@ }, "end": { "line": 21, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/invalidProtectedAccess2-expected.txt b/ets2panda/test/compiler/ets/invalidProtectedAccess2-expected.txt index e7356eb49a..6b70de3ff2 100644 --- a/ets2panda/test/compiler/ets/invalidProtectedAccess2-expected.txt +++ b/ets2panda/test/compiler/ets/invalidProtectedAccess2-expected.txt @@ -448,35 +448,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -484,7 +456,7 @@ }, "end": { "line": 24, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/invalidProtectedAccess3-expected.txt b/ets2panda/test/compiler/ets/invalidProtectedAccess3-expected.txt index fa41a9e7db..d231f2fd3f 100644 --- a/ets2panda/test/compiler/ets/invalidProtectedAccess3-expected.txt +++ b/ets2panda/test/compiler/ets/invalidProtectedAccess3-expected.txt @@ -310,35 +310,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 22 - }, - "end": { - "line": 23, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 22 - }, - "end": { - "line": 23, - "column": 28 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -346,7 +318,7 @@ }, "end": { "line": 23, - "column": 28 + "column": 26 } } }, @@ -475,35 +447,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 26 - }, - "end": { - "line": 27, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 26 - }, - "end": { - "line": 27, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 27, @@ -511,7 +455,7 @@ }, "end": { "line": 27, - "column": 32 + "column": 30 } } }, @@ -761,35 +705,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 32, @@ -797,7 +713,7 @@ }, "end": { "line": 32, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/lambdaExpressionWithoutBlockStatementDifferentType-expected.txt b/ets2panda/test/compiler/ets/lambdaExpressionWithoutBlockStatementDifferentType-expected.txt index d7fafa4654..2ed997b652 100644 --- a/ets2panda/test/compiler/ets/lambdaExpressionWithoutBlockStatementDifferentType-expected.txt +++ b/ets2panda/test/compiler/ets/lambdaExpressionWithoutBlockStatementDifferentType-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/lambdaExpressionWithoutBlockStatementDifferentTypeInfunction-expected.txt b/ets2panda/test/compiler/ets/lambdaExpressionWithoutBlockStatementDifferentTypeInfunction-expected.txt index c35a6a6a7b..53e4a799de 100644 --- a/ets2panda/test/compiler/ets/lambdaExpressionWithoutBlockStatementDifferentTypeInfunction-expected.txt +++ b/ets2panda/test/compiler/ets/lambdaExpressionWithoutBlockStatementDifferentTypeInfunction-expected.txt @@ -325,35 +325,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -361,7 +333,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/lambdaFunction1-expected.txt b/ets2panda/test/compiler/ets/lambdaFunction1-expected.txt index 61642d4c3b..b0e0a3e555 100644 --- a/ets2panda/test/compiler/ets/lambdaFunction1-expected.txt +++ b/ets2panda/test/compiler/ets/lambdaFunction1-expected.txt @@ -1559,35 +1559,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 39, - "column": 18 - }, - "end": { - "line": 39, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 39, - "column": 18 - }, - "end": { - "line": 39, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 39, @@ -1595,7 +1567,7 @@ }, "end": { "line": 39, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/lambdaFunction3-expected.txt b/ets2panda/test/compiler/ets/lambdaFunction3-expected.txt index 1e358988d2..9f7bf13260 100644 --- a/ets2panda/test/compiler/ets/lambdaFunction3-expected.txt +++ b/ets2panda/test/compiler/ets/lambdaFunction3-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 17 - }, - "end": { - "line": 16, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 17 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 23 + "column": 21 } } }, @@ -345,35 +317,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -381,7 +325,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 36 } } }, @@ -392,7 +336,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 36 } } }, @@ -460,35 +404,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 49 - }, - "end": { - "line": 18, - "column": 53 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 49 - }, - "end": { - "line": 18, - "column": 56 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -496,7 +412,7 @@ }, "end": { "line": 18, - "column": 56 + "column": 53 } } }, diff --git a/ets2panda/test/compiler/ets/lambdaFunction4-expected.txt b/ets2panda/test/compiler/ets/lambdaFunction4-expected.txt index 581964183a..5b92c309d0 100644 --- a/ets2panda/test/compiler/ets/lambdaFunction4-expected.txt +++ b/ets2panda/test/compiler/ets/lambdaFunction4-expected.txt @@ -140,35 +140,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 25 - }, - "end": { - "line": 19, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 25 - }, - "end": { - "line": 19, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -176,7 +148,7 @@ }, "end": { "line": 19, - "column": 32 + "column": 29 } } }, @@ -298,35 +270,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 14 - }, - "end": { - "line": 19, - "column": 18 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 14 - }, - "end": { - "line": 19, - "column": 20 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -334,7 +278,7 @@ }, "end": { "line": 19, - "column": 20 + "column": 18 } } }, @@ -345,7 +289,7 @@ }, "end": { "line": 19, - "column": 20 + "column": 18 } } }, diff --git a/ets2panda/test/compiler/ets/lambdaFunction5-expected.txt b/ets2panda/test/compiler/ets/lambdaFunction5-expected.txt index b82ab2b932..6c0c8a9c37 100644 --- a/ets2panda/test/compiler/ets/lambdaFunction5-expected.txt +++ b/ets2panda/test/compiler/ets/lambdaFunction5-expected.txt @@ -1232,35 +1232,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 32, @@ -1268,7 +1240,7 @@ }, "end": { "line": 32, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type-expected.txt b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type-expected.txt index 1fa2395cb8..1bf9ff1ba3 100644 --- a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type-expected.txt +++ b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type-expected.txt @@ -265,35 +265,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -301,7 +273,7 @@ }, "end": { "line": 18, - "column": 32 + "column": 30 } } }, @@ -312,7 +284,7 @@ }, "end": { "line": 18, - "column": 32 + "column": 30 } } }, diff --git a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_lambda1-expected.txt b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_lambda1-expected.txt index 9aef2f59fa..20a12a04a5 100644 --- a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_lambda1-expected.txt +++ b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_lambda1-expected.txt @@ -327,35 +327,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -363,7 +335,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 36 } } }, @@ -374,7 +346,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 36 } } }, @@ -385,7 +357,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 36 } } }, diff --git a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_lambda_expression-expected.txt b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_lambda_expression-expected.txt index fea46aa2f9..f2b0e8782a 100644 --- a/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_lambda_expression-expected.txt +++ b/ets2panda/test/compiler/ets/lambda_infer_type/lambda_infer_type_return_lambda_expression-expected.txt @@ -461,35 +461,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 28 - }, - "end": { - "line": 23, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 28 - }, - "end": { - "line": 23, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -497,7 +469,7 @@ }, "end": { "line": 23, - "column": 34 + "column": 32 } } }, @@ -508,7 +480,7 @@ }, "end": { "line": 23, - "column": 34 + "column": 32 } } }, @@ -519,7 +491,7 @@ }, "end": { "line": 23, - "column": 34 + "column": 32 } } }, diff --git a/ets2panda/test/compiler/ets/lambda_unresolved_ref_1-expected.txt b/ets2panda/test/compiler/ets/lambda_unresolved_ref_1-expected.txt index 8588d0e5bb..1d193fa51d 100644 --- a/ets2panda/test/compiler/ets/lambda_unresolved_ref_1-expected.txt +++ b/ets2panda/test/compiler/ets/lambda_unresolved_ref_1-expected.txt @@ -76,35 +76,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 26 - }, - "end": { - "line": 17, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 26 - }, - "end": { - "line": 17, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -112,7 +84,7 @@ }, "end": { "line": 17, - "column": 31 + "column": 30 } } }, @@ -123,7 +95,7 @@ }, "end": { "line": 17, - "column": 31 + "column": 30 } } }, @@ -135,7 +107,7 @@ }, "end": { "line": 17, - "column": 31 + "column": 30 } } }, @@ -146,41 +118,13 @@ }, "end": { "line": 17, - "column": 31 + "column": 30 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 33 - }, - "end": { - "line": 17, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 33 - }, - "end": { - "line": 17, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -188,7 +132,7 @@ }, "end": { "line": 17, - "column": 39 + "column": 37 } } }, @@ -207,35 +151,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 25 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 25 - }, - "end": { - "line": 18, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -243,7 +159,7 @@ }, "end": { "line": 18, - "column": 31 + "column": 29 } } }, @@ -254,7 +170,7 @@ }, "end": { "line": 18, - "column": 31 + "column": 29 } } }, @@ -280,35 +196,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 36 - }, - "end": { - "line": 18, - "column": 40 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 36 - }, - "end": { - "line": 18, - "column": 43 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -316,7 +204,7 @@ }, "end": { "line": 18, - "column": 43 + "column": 40 } } }, @@ -989,35 +877,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 30 - }, - "end": { - "line": 23, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 30 - }, - "end": { - "line": 23, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -1025,7 +885,7 @@ }, "end": { "line": 23, - "column": 36 + "column": 34 } } }, @@ -1044,35 +904,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 20 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 20 - }, - "end": { - "line": 24, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -1080,7 +912,7 @@ }, "end": { "line": 24, - "column": 26 + "column": 24 } } }, @@ -1091,7 +923,7 @@ }, "end": { "line": 24, - "column": 26 + "column": 24 } } }, @@ -1117,35 +949,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 31 - }, - "end": { - "line": 24, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 31 - }, - "end": { - "line": 24, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -1153,7 +957,7 @@ }, "end": { "line": 24, - "column": 38 + "column": 35 } } }, @@ -1641,35 +1445,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 31 - }, - "end": { - "line": 30, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 31 - }, - "end": { - "line": 30, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 30, @@ -1677,7 +1453,7 @@ }, "end": { "line": 30, - "column": 37 + "column": 35 } } }, @@ -1696,35 +1472,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 20 - }, - "end": { - "line": 31, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 20 - }, - "end": { - "line": 31, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 31, @@ -1732,7 +1480,7 @@ }, "end": { "line": 31, - "column": 26 + "column": 24 } } }, @@ -1743,7 +1491,7 @@ }, "end": { "line": 31, - "column": 26 + "column": 24 } } }, @@ -1769,35 +1517,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 31 - }, - "end": { - "line": 31, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 31 - }, - "end": { - "line": 31, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 31, @@ -1805,7 +1525,7 @@ }, "end": { "line": 31, - "column": 38 + "column": 35 } } }, @@ -2268,35 +1988,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 39, - "column": 17 - }, - "end": { - "line": 39, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 39, - "column": 17 - }, - "end": { - "line": 39, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 39, @@ -2304,7 +1996,7 @@ }, "end": { "line": 39, - "column": 23 + "column": 21 } } }, @@ -2506,35 +2198,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 41, - "column": 27 - }, - "end": { - "line": 41, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 41, - "column": 27 - }, - "end": { - "line": 41, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 41, @@ -2542,7 +2206,7 @@ }, "end": { "line": 41, - "column": 33 + "column": 31 } } }, @@ -2553,7 +2217,7 @@ }, "end": { "line": 41, - "column": 33 + "column": 31 } } }, @@ -2621,35 +2285,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 41, - "column": 46 - }, - "end": { - "line": 41, - "column": 50 - } - } - }, - "loc": { - "start": { - "line": 41, - "column": 46 - }, - "end": { - "line": 41, - "column": 53 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 41, @@ -2657,7 +2293,7 @@ }, "end": { "line": 41, - "column": 53 + "column": 50 } } }, @@ -3381,35 +3017,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 52, - "column": 27 - }, - "end": { - "line": 52, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 52, - "column": 27 - }, - "end": { - "line": 52, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 52, @@ -3417,7 +3025,7 @@ }, "end": { "line": 52, - "column": 33 + "column": 31 } } }, @@ -3428,7 +3036,7 @@ }, "end": { "line": 52, - "column": 33 + "column": 31 } } }, @@ -3496,35 +3104,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 52, - "column": 46 - }, - "end": { - "line": 52, - "column": 50 - } - } - }, - "loc": { - "start": { - "line": 52, - "column": 46 - }, - "end": { - "line": 52, - "column": 53 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 52, @@ -3532,7 +3112,7 @@ }, "end": { "line": 52, - "column": 53 + "column": 50 } } }, diff --git a/ets2panda/test/compiler/ets/launch_expression-expected.txt b/ets2panda/test/compiler/ets/launch_expression-expected.txt index cd6f543d26..2bb47fb7c0 100644 --- a/ets2panda/test/compiler/ets/launch_expression-expected.txt +++ b/ets2panda/test/compiler/ets/launch_expression-expected.txt @@ -901,35 +901,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 47 - }, - "end": { - "line": 21, - "column": 51 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 47 - }, - "end": { - "line": 21, - "column": 53 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -937,7 +909,7 @@ }, "end": { "line": 21, - "column": 53 + "column": 51 } } }, diff --git a/ets2panda/test/compiler/ets/loopWithinLambda-expected.txt b/ets2panda/test/compiler/ets/loopWithinLambda-expected.txt index 520b7c45cc..379d7e6ced 100644 --- a/ets2panda/test/compiler/ets/loopWithinLambda-expected.txt +++ b/ets2panda/test/compiler/ets/loopWithinLambda-expected.txt @@ -64,43 +64,15 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 17, - "column": 5 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, "column": 24 }, "end": { - "line": 17, - "column": 5 + "line": 16, + "column": 28 } } }, @@ -110,8 +82,8 @@ "column": 12 }, "end": { - "line": 17, - "column": 5 + "line": 16, + "column": 28 } } }, diff --git a/ets2panda/test/compiler/ets/manyLocalsParamRegUsage-expected.txt b/ets2panda/test/compiler/ets/manyLocalsParamRegUsage-expected.txt index 9c8d5790d2..4ce29d8036 100644 --- a/ets2panda/test/compiler/ets/manyLocalsParamRegUsage-expected.txt +++ b/ets2panda/test/compiler/ets/manyLocalsParamRegUsage-expected.txt @@ -31096,35 +31096,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 277, - "column": 18 - }, - "end": { - "line": 277, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 277, - "column": 18 - }, - "end": { - "line": 277, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 277, @@ -31132,7 +31104,7 @@ }, "end": { "line": 277, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/memberExprInLambda-expected.txt b/ets2panda/test/compiler/ets/memberExprInLambda-expected.txt index 5ffa599cc2..63f199135e 100644 --- a/ets2panda/test/compiler/ets/memberExprInLambda-expected.txt +++ b/ets2panda/test/compiler/ets/memberExprInLambda-expected.txt @@ -22,43 +22,15 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 28 - }, - "end": { - "line": 16, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 28 - }, - "end": { - "line": 18, - "column": 9 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, "column": 28 }, "end": { - "line": 18, - "column": 9 + "line": 16, + "column": 32 } } }, @@ -68,8 +40,8 @@ "column": 22 }, "end": { - "line": 18, - "column": 9 + "line": 16, + "column": 32 } } }, @@ -245,35 +217,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 39 - }, - "end": { - "line": 18, - "column": 43 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 39 - }, - "end": { - "line": 18, - "column": 45 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -281,7 +225,7 @@ }, "end": { "line": 18, - "column": 45 + "column": 43 } } }, diff --git a/ets2panda/test/compiler/ets/memberExpressionFromStaticContext-expected.txt b/ets2panda/test/compiler/ets/memberExpressionFromStaticContext-expected.txt index 235443a3f3..ecf979a735 100644 --- a/ets2panda/test/compiler/ets/memberExpressionFromStaticContext-expected.txt +++ b/ets2panda/test/compiler/ets/memberExpressionFromStaticContext-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, @@ -203,35 +175,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -239,7 +183,7 @@ }, "end": { "line": 18, - "column": 38 + "column": 36 } } }, @@ -408,35 +352,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 31 - }, - "end": { - "line": 20, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 31 - }, - "end": { - "line": 20, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -444,7 +360,7 @@ }, "end": { "line": 20, - "column": 37 + "column": 35 } } }, @@ -827,35 +743,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 18 - }, - "end": { - "line": 27, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 18 - }, - "end": { - "line": 27, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 27, @@ -863,7 +751,7 @@ }, "end": { "line": 27, - "column": 24 + "column": 22 } } }, @@ -962,35 +850,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 32 - }, - "end": { - "line": 28, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 32 - }, - "end": { - "line": 28, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -998,7 +858,7 @@ }, "end": { "line": 28, - "column": 38 + "column": 36 } } }, @@ -1167,35 +1027,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 31 - }, - "end": { - "line": 30, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 31 - }, - "end": { - "line": 30, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 30, @@ -1203,7 +1035,7 @@ }, "end": { "line": 30, - "column": 37 + "column": 35 } } }, @@ -1871,35 +1703,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 41, - "column": 18 - }, - "end": { - "line": 41, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 41, - "column": 18 - }, - "end": { - "line": 41, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 41, @@ -1907,7 +1711,7 @@ }, "end": { "line": 41, - "column": 24 + "column": 22 } } }, @@ -2006,35 +1810,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 42, - "column": 32 - }, - "end": { - "line": 42, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 42, - "column": 32 - }, - "end": { - "line": 42, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 42, @@ -2042,7 +1818,7 @@ }, "end": { "line": 42, - "column": 38 + "column": 36 } } }, @@ -2211,35 +1987,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 44, - "column": 31 - }, - "end": { - "line": 44, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 44, - "column": 31 - }, - "end": { - "line": 44, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 44, @@ -2247,7 +1995,7 @@ }, "end": { "line": 44, - "column": 37 + "column": 35 } } }, diff --git a/ets2panda/test/compiler/ets/methodOverrideCovariantReturnType-expected.txt b/ets2panda/test/compiler/ets/methodOverrideCovariantReturnType-expected.txt index 36610c08a0..864d2c9683 100644 --- a/ets2panda/test/compiler/ets/methodOverrideCovariantReturnType-expected.txt +++ b/ets2panda/test/compiler/ets/methodOverrideCovariantReturnType-expected.txt @@ -310,35 +310,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 12 - }, - "end": { - "line": 21, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 12 - }, - "end": { - "line": 21, - "column": 17 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -346,7 +318,7 @@ }, "end": { "line": 21, - "column": 17 + "column": 16 } } }, @@ -358,7 +330,7 @@ }, "end": { "line": 21, - "column": 17 + "column": 16 } } }, @@ -369,7 +341,7 @@ }, "end": { "line": 21, - "column": 17 + "column": 16 } } }, @@ -749,35 +721,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 21 - }, - "end": { - "line": 28, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 21 - }, - "end": { - "line": 28, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -785,7 +729,7 @@ }, "end": { "line": 28, - "column": 27 + "column": 25 } } }, diff --git a/ets2panda/test/compiler/ets/methodOverrideDifferentSignature-expected.txt b/ets2panda/test/compiler/ets/methodOverrideDifferentSignature-expected.txt index 87cc2b20e2..368e2ab824 100644 --- a/ets2panda/test/compiler/ets/methodOverrideDifferentSignature-expected.txt +++ b/ets2panda/test/compiler/ets/methodOverrideDifferentSignature-expected.txt @@ -52,35 +52,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 17 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -88,7 +60,7 @@ }, "end": { "line": 17, - "column": 17 + "column": 16 } } }, @@ -100,7 +72,7 @@ }, "end": { "line": 17, - "column": 17 + "column": 16 } } }, @@ -111,7 +83,7 @@ }, "end": { "line": 17, - "column": 17 + "column": 16 } } }, @@ -289,35 +261,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -325,7 +269,7 @@ }, "end": { "line": 21, - "column": 26 + "column": 25 } } }, @@ -424,35 +368,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 21 - }, - "end": { - "line": 24, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 21 - }, - "end": { - "line": 24, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -460,7 +376,7 @@ }, "end": { "line": 24, - "column": 26 + "column": 25 } } }, @@ -575,35 +491,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 27 - }, - "end": { - "line": 25, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 27 - }, - "end": { - "line": 25, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 25, @@ -611,7 +499,7 @@ }, "end": { "line": 25, - "column": 32 + "column": 31 } } }, @@ -738,35 +626,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 21 - }, - "end": { - "line": 26, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 21 - }, - "end": { - "line": 26, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 26, @@ -774,7 +634,7 @@ }, "end": { "line": 26, - "column": 26 + "column": 25 } } }, @@ -1063,35 +923,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 21 - }, - "end": { - "line": 32, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 21 - }, - "end": { - "line": 32, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 32, @@ -1099,7 +931,7 @@ }, "end": { "line": 32, - "column": 27 + "column": 25 } } }, @@ -1228,35 +1060,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 35, - "column": 27 - }, - "end": { - "line": 35, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 35, - "column": 27 - }, - "end": { - "line": 35, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 35, @@ -1264,7 +1068,7 @@ }, "end": { "line": 35, - "column": 33 + "column": 31 } } }, diff --git a/ets2panda/test/compiler/ets/methodOverrideWithoutModifier-expected.txt b/ets2panda/test/compiler/ets/methodOverrideWithoutModifier-expected.txt index ee9fd7f3da..1ebdcf5cf1 100644 --- a/ets2panda/test/compiler/ets/methodOverrideWithoutModifier-expected.txt +++ b/ets2panda/test/compiler/ets/methodOverrideWithoutModifier-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 25 + "column": 23 } } }, @@ -380,35 +352,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 19 - }, - "end": { - "line": 23, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 19 - }, - "end": { - "line": 23, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -416,7 +360,7 @@ }, "end": { "line": 23, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/mostSpecificMethod1-expected.txt b/ets2panda/test/compiler/ets/mostSpecificMethod1-expected.txt index 092cdcfa48..f7536c676d 100644 --- a/ets2panda/test/compiler/ets/mostSpecificMethod1-expected.txt +++ b/ets2panda/test/compiler/ets/mostSpecificMethod1-expected.txt @@ -438,35 +438,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 33 - }, - "end": { - "line": 18, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 33 - }, - "end": { - "line": 18, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -474,7 +446,7 @@ }, "end": { "line": 18, - "column": 39 + "column": 37 } } }, @@ -700,35 +672,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 33 - }, - "end": { - "line": 19, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 33 - }, - "end": { - "line": 19, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -736,7 +680,7 @@ }, "end": { "line": 19, - "column": 39 + "column": 37 } } }, @@ -848,35 +792,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 19 - }, - "end": { - "line": 21, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 19 - }, - "end": { - "line": 21, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -884,7 +800,7 @@ }, "end": { "line": 21, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/mostSpecificMethod2-expected.txt b/ets2panda/test/compiler/ets/mostSpecificMethod2-expected.txt index a20cd28451..f03bd4f954 100644 --- a/ets2panda/test/compiler/ets/mostSpecificMethod2-expected.txt +++ b/ets2panda/test/compiler/ets/mostSpecificMethod2-expected.txt @@ -344,35 +344,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 35 - }, - "end": { - "line": 19, - "column": 39 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 35 - }, - "end": { - "line": 19, - "column": 41 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -380,7 +352,7 @@ }, "end": { "line": 19, - "column": 41 + "column": 39 } } }, @@ -795,35 +767,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 35 - }, - "end": { - "line": 23, - "column": 39 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 35 - }, - "end": { - "line": 23, - "column": 41 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -831,7 +775,7 @@ }, "end": { "line": 23, - "column": 41 + "column": 39 } } }, @@ -1161,35 +1105,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 19 - }, - "end": { - "line": 26, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 19 - }, - "end": { - "line": 26, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 26, @@ -1197,7 +1113,7 @@ }, "end": { "line": 26, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/multipleMethodOverride-expected.txt b/ets2panda/test/compiler/ets/multipleMethodOverride-expected.txt index f4a594d5c5..bd23a6c98a 100644 --- a/ets2panda/test/compiler/ets/multipleMethodOverride-expected.txt +++ b/ets2panda/test/compiler/ets/multipleMethodOverride-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 20 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 20 - }, - "end": { - "line": 17, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 26 + "column": 24 } } }, @@ -380,35 +352,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 28 - }, - "end": { - "line": 23, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 28 - }, - "end": { - "line": 23, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -416,7 +360,7 @@ }, "end": { "line": 23, - "column": 33 + "column": 32 } } }, @@ -869,35 +813,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 34, - "column": 28 - }, - "end": { - "line": 34, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 34, - "column": 28 - }, - "end": { - "line": 34, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 34, @@ -905,7 +821,7 @@ }, "end": { "line": 34, - "column": 34 + "column": 32 } } }, diff --git a/ets2panda/test/compiler/ets/n_assignGenericWithNullableTypeParamToNonNullable-expected.txt b/ets2panda/test/compiler/ets/n_assignGenericWithNullableTypeParamToNonNullable-expected.txt index dec6c6ee6e..1aa61f5ddf 100644 --- a/ets2panda/test/compiler/ets/n_assignGenericWithNullableTypeParamToNonNullable-expected.txt +++ b/ets2panda/test/compiler/ets/n_assignGenericWithNullableTypeParamToNonNullable-expected.txt @@ -479,35 +479,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -515,7 +487,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/n_ensureNotNullArgNotNullable-expected.txt b/ets2panda/test/compiler/ets/n_ensureNotNullArgNotNullable-expected.txt index 7f8f049fe2..6c42a8caf1 100644 --- a/ets2panda/test/compiler/ets/n_ensureNotNullArgNotNullable-expected.txt +++ b/ets2panda/test/compiler/ets/n_ensureNotNullArgNotNullable-expected.txt @@ -301,35 +301,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 25 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 25 - }, - "end": { - "line": 18, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -337,7 +309,7 @@ }, "end": { "line": 18, - "column": 31 + "column": 29 } } }, @@ -478,35 +450,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -514,7 +458,7 @@ }, "end": { "line": 22, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/n_ensureNotNullLocalNotNullable-expected.txt b/ets2panda/test/compiler/ets/n_ensureNotNullLocalNotNullable-expected.txt index 3ea5aa4464..4e7827bd27 100644 --- a/ets2panda/test/compiler/ets/n_ensureNotNullLocalNotNullable-expected.txt +++ b/ets2panda/test/compiler/ets/n_ensureNotNullLocalNotNullable-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/n_ensureNotNullReturnNotNullable-expected.txt b/ets2panda/test/compiler/ets/n_ensureNotNullReturnNotNullable-expected.txt index 513c38713c..9c94e68e70 100644 --- a/ets2panda/test/compiler/ets/n_ensureNotNullReturnNotNullable-expected.txt +++ b/ets2panda/test/compiler/ets/n_ensureNotNullReturnNotNullable-expected.txt @@ -366,35 +366,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 19 - }, - "end": { - "line": 20, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 19 - }, - "end": { - "line": 20, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -402,7 +374,7 @@ }, "end": { "line": 20, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/n_nullableTypeInArgNotRef-expected.txt b/ets2panda/test/compiler/ets/n_nullableTypeInArgNotRef-expected.txt index 7308dc875b..9efdd3cdf7 100644 --- a/ets2panda/test/compiler/ets/n_nullableTypeInArgNotRef-expected.txt +++ b/ets2panda/test/compiler/ets/n_nullableTypeInArgNotRef-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/n_nullableTypeInReturnNotRef-expected.txt b/ets2panda/test/compiler/ets/n_nullableTypeInReturnNotRef-expected.txt index bbdcfc18e7..e56fa0d5d8 100644 --- a/ets2panda/test/compiler/ets/n_nullableTypeInReturnNotRef-expected.txt +++ b/ets2panda/test/compiler/ets/n_nullableTypeInReturnNotRef-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/n_nullableTypeNotRef-expected.txt b/ets2panda/test/compiler/ets/n_nullableTypeNotRef-expected.txt index 4227351dbd..102146cea0 100644 --- a/ets2panda/test/compiler/ets/n_nullableTypeNotRef-expected.txt +++ b/ets2panda/test/compiler/ets/n_nullableTypeNotRef-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/non-const-lambda-with-scopes-expected.txt b/ets2panda/test/compiler/ets/non-const-lambda-with-scopes-expected.txt index 805ca37c91..545a47975d 100644 --- a/ets2panda/test/compiler/ets/non-const-lambda-with-scopes-expected.txt +++ b/ets2panda/test/compiler/ets/non-const-lambda-with-scopes-expected.txt @@ -234,35 +234,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -270,7 +242,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, @@ -281,7 +253,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/null_coalescing_generic_1-expected.txt b/ets2panda/test/compiler/ets/null_coalescing_generic_1-expected.txt index ec75f9dc3f..29c67ef01a 100644 --- a/ets2panda/test/compiler/ets/null_coalescing_generic_1-expected.txt +++ b/ets2panda/test/compiler/ets/null_coalescing_generic_1-expected.txt @@ -983,35 +983,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 39 - }, - "end": { - "line": 24, - "column": 43 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 39 - }, - "end": { - "line": 24, - "column": 45 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -1019,7 +991,7 @@ }, "end": { "line": 24, - "column": 45 + "column": 43 } } }, diff --git a/ets2panda/test/compiler/ets/nullableTuple-expected.txt b/ets2panda/test/compiler/ets/nullableTuple-expected.txt index eedfa67002..6f17f98734 100644 --- a/ets2panda/test/compiler/ets/nullableTuple-expected.txt +++ b/ets2panda/test/compiler/ets/nullableTuple-expected.txt @@ -385,35 +385,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -421,7 +393,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/overload_with_generics-expected.txt b/ets2panda/test/compiler/ets/overload_with_generics-expected.txt index 8b5703c149..fdf5fa4af6 100644 --- a/ets2panda/test/compiler/ets/overload_with_generics-expected.txt +++ b/ets2panda/test/compiler/ets/overload_with_generics-expected.txt @@ -138,35 +138,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 37 - }, - "end": { - "line": 17, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 37 - }, - "end": { - "line": 17, - "column": 43 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -174,7 +146,7 @@ }, "end": { "line": 17, - "column": 43 + "column": 41 } } }, @@ -443,35 +415,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 52 - }, - "end": { - "line": 18, - "column": 56 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 52 - }, - "end": { - "line": 18, - "column": 58 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -479,7 +423,7 @@ }, "end": { "line": 18, - "column": 58 + "column": 56 } } }, diff --git a/ets2panda/test/compiler/ets/override-expected.txt b/ets2panda/test/compiler/ets/override-expected.txt index ea0b9f42c7..5d9f9166d9 100644 --- a/ets2panda/test/compiler/ets/override-expected.txt +++ b/ets2panda/test/compiler/ets/override-expected.txt @@ -1648,35 +1648,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 18 - }, - "end": { - "line": 30, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 18 - }, - "end": { - "line": 30, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 30, @@ -1684,7 +1656,7 @@ }, "end": { "line": 30, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/override11-expected.txt b/ets2panda/test/compiler/ets/override11-expected.txt index fce7b048ca..c8a4a3eced 100644 --- a/ets2panda/test/compiler/ets/override11-expected.txt +++ b/ets2panda/test/compiler/ets/override11-expected.txt @@ -564,35 +564,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -600,7 +572,7 @@ }, "end": { "line": 21, - "column": 30 + "column": 28 } } }, diff --git a/ets2panda/test/compiler/ets/override18-expected.txt b/ets2panda/test/compiler/ets/override18-expected.txt index a3d01a0fb6..7a632e825f 100644 --- a/ets2panda/test/compiler/ets/override18-expected.txt +++ b/ets2panda/test/compiler/ets/override18-expected.txt @@ -698,35 +698,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -734,7 +706,7 @@ }, "end": { "line": 28, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/override19-expected.txt b/ets2panda/test/compiler/ets/override19-expected.txt index c84d605809..8de54e6fc9 100644 --- a/ets2panda/test/compiler/ets/override19-expected.txt +++ b/ets2panda/test/compiler/ets/override19-expected.txt @@ -774,35 +774,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -810,7 +782,7 @@ }, "end": { "line": 28, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/override7-expected.txt b/ets2panda/test/compiler/ets/override7-expected.txt index 07454f6cbc..23688d8c44 100644 --- a/ets2panda/test/compiler/ets/override7-expected.txt +++ b/ets2panda/test/compiler/ets/override7-expected.txt @@ -52,35 +52,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 9 - }, - "end": { - "line": 17, - "column": 13 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 9 - }, - "end": { - "line": 17, - "column": 14 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -88,7 +60,7 @@ }, "end": { "line": 17, - "column": 14 + "column": 13 } } }, @@ -100,7 +72,7 @@ }, "end": { "line": 17, - "column": 14 + "column": 13 } } }, @@ -111,7 +83,7 @@ }, "end": { "line": 17, - "column": 14 + "column": 13 } } }, diff --git a/ets2panda/test/compiler/ets/parenthesizedType-expected.txt b/ets2panda/test/compiler/ets/parenthesizedType-expected.txt index 53c7ea8516..79462f9582 100644 --- a/ets2panda/test/compiler/ets/parenthesizedType-expected.txt +++ b/ets2panda/test/compiler/ets/parenthesizedType-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/privateMethodOverride-expected.txt b/ets2panda/test/compiler/ets/privateMethodOverride-expected.txt index 1deee57fdc..a8ef1eed4d 100644 --- a/ets2panda/test/compiler/ets/privateMethodOverride-expected.txt +++ b/ets2panda/test/compiler/ets/privateMethodOverride-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 20 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 20 - }, - "end": { - "line": 17, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 26 + "column": 24 } } }, @@ -380,35 +352,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 28 - }, - "end": { - "line": 22, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 28 - }, - "end": { - "line": 22, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -416,7 +360,7 @@ }, "end": { "line": 22, - "column": 34 + "column": 32 } } }, diff --git a/ets2panda/test/compiler/ets/referenceEqualityNotCastable_n-expected.txt b/ets2panda/test/compiler/ets/referenceEqualityNotCastable_n-expected.txt index 43de9aa528..a0a3db302e 100644 --- a/ets2panda/test/compiler/ets/referenceEqualityNotCastable_n-expected.txt +++ b/ets2panda/test/compiler/ets/referenceEqualityNotCastable_n-expected.txt @@ -436,35 +436,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -472,7 +444,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/referenceEqualityNotReference_n-expected.txt b/ets2panda/test/compiler/ets/referenceEqualityNotReference_n-expected.txt index b3de43ef5a..1420913164 100644 --- a/ets2panda/test/compiler/ets/referenceEqualityNotReference_n-expected.txt +++ b/ets2panda/test/compiler/ets/referenceEqualityNotReference_n-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/rethrowingCheck1-expected.txt b/ets2panda/test/compiler/ets/rethrowingCheck1-expected.txt index 97d9b27bee..86a5b570f9 100644 --- a/ets2panda/test/compiler/ets/rethrowingCheck1-expected.txt +++ b/ets2panda/test/compiler/ets/rethrowingCheck1-expected.txt @@ -349,35 +349,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 23 - }, - "end": { - "line": 20, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 23 - }, - "end": { - "line": 20, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -385,7 +357,7 @@ }, "end": { "line": 20, - "column": 34 + "column": 27 } } } @@ -397,7 +369,7 @@ }, "end": { "line": 20, - "column": 34 + "column": 27 } } }, @@ -409,7 +381,7 @@ }, "end": { "line": 20, - "column": 34 + "column": 27 } } }, @@ -420,7 +392,7 @@ }, "end": { "line": 20, - "column": 34 + "column": 27 } } } diff --git a/ets2panda/test/compiler/ets/rethrowingCheck2-expected.txt b/ets2panda/test/compiler/ets/rethrowingCheck2-expected.txt index 9911d705dc..a49a77a89a 100644 --- a/ets2panda/test/compiler/ets/rethrowingCheck2-expected.txt +++ b/ets2panda/test/compiler/ets/rethrowingCheck2-expected.txt @@ -349,35 +349,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 23 - }, - "end": { - "line": 20, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 23 - }, - "end": { - "line": 20, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -385,7 +357,7 @@ }, "end": { "line": 20, - "column": 34 + "column": 27 } } } @@ -397,7 +369,7 @@ }, "end": { "line": 20, - "column": 34 + "column": 27 } } }, @@ -409,7 +381,7 @@ }, "end": { "line": 20, - "column": 34 + "column": 27 } } }, @@ -420,7 +392,7 @@ }, "end": { "line": 20, - "column": 34 + "column": 27 } } } diff --git a/ets2panda/test/compiler/ets/rethrowingCheck3-expected.txt b/ets2panda/test/compiler/ets/rethrowingCheck3-expected.txt index aaaecc2584..290cdd30e0 100644 --- a/ets2panda/test/compiler/ets/rethrowingCheck3-expected.txt +++ b/ets2panda/test/compiler/ets/rethrowingCheck3-expected.txt @@ -486,35 +486,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 23 - }, - "end": { - "line": 22, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 23 - }, - "end": { - "line": 22, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -522,7 +494,7 @@ }, "end": { "line": 22, - "column": 34 + "column": 27 } } } @@ -534,7 +506,7 @@ }, "end": { "line": 22, - "column": 34 + "column": 27 } } }, @@ -546,7 +518,7 @@ }, "end": { "line": 22, - "column": 34 + "column": 27 } } }, @@ -557,7 +529,7 @@ }, "end": { "line": 22, - "column": 34 + "column": 27 } } } diff --git a/ets2panda/test/compiler/ets/rethrowingCheck4-expected.txt b/ets2panda/test/compiler/ets/rethrowingCheck4-expected.txt index afc253df98..5a6ce7d33d 100644 --- a/ets2panda/test/compiler/ets/rethrowingCheck4-expected.txt +++ b/ets2panda/test/compiler/ets/rethrowingCheck4-expected.txt @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 34 + "column": 27 } } } @@ -218,7 +190,7 @@ }, "end": { "line": 16, - "column": 34 + "column": 27 } } }, @@ -230,7 +202,7 @@ }, "end": { "line": 16, - "column": 34 + "column": 27 } } }, @@ -241,7 +213,7 @@ }, "end": { "line": 16, - "column": 34 + "column": 27 } } } @@ -573,35 +545,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 23 - }, - "end": { - "line": 24, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 23 - }, - "end": { - "line": 24, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -609,7 +553,7 @@ }, "end": { "line": 24, - "column": 34 + "column": 27 } } } @@ -621,7 +565,7 @@ }, "end": { "line": 24, - "column": 34 + "column": 27 } } }, @@ -633,7 +577,7 @@ }, "end": { "line": 24, - "column": 34 + "column": 27 } } }, @@ -644,7 +588,7 @@ }, "end": { "line": 24, - "column": 34 + "column": 27 } } } diff --git a/ets2panda/test/compiler/ets/rethrowingCheck5-expected.txt b/ets2panda/test/compiler/ets/rethrowingCheck5-expected.txt index 49ce2879b6..8e2efb7703 100644 --- a/ets2panda/test/compiler/ets/rethrowingCheck5-expected.txt +++ b/ets2panda/test/compiler/ets/rethrowingCheck5-expected.txt @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 34 + "column": 27 } } } @@ -218,7 +190,7 @@ }, "end": { "line": 16, - "column": 34 + "column": 27 } } }, @@ -230,7 +202,7 @@ }, "end": { "line": 16, - "column": 34 + "column": 27 } } }, @@ -241,7 +213,7 @@ }, "end": { "line": 16, - "column": 34 + "column": 27 } } } @@ -752,35 +724,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 23 - }, - "end": { - "line": 28, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 23 - }, - "end": { - "line": 28, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -788,7 +732,7 @@ }, "end": { "line": 28, - "column": 34 + "column": 27 } } } @@ -800,7 +744,7 @@ }, "end": { "line": 28, - "column": 34 + "column": 27 } } }, @@ -812,7 +756,7 @@ }, "end": { "line": 28, - "column": 34 + "column": 27 } } }, @@ -823,7 +767,7 @@ }, "end": { "line": 28, - "column": 34 + "column": 27 } } } diff --git a/ets2panda/test/compiler/ets/rethrowingConstructorCheck1-expected.txt b/ets2panda/test/compiler/ets/rethrowingConstructorCheck1-expected.txt index 5182f5da7a..ce862a7ffb 100644 --- a/ets2panda/test/compiler/ets/rethrowingConstructorCheck1-expected.txt +++ b/ets2panda/test/compiler/ets/rethrowingConstructorCheck1-expected.txt @@ -76,35 +76,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -112,7 +84,7 @@ }, "end": { "line": 17, - "column": 35 + "column": 28 } } } @@ -124,7 +96,7 @@ }, "end": { "line": 17, - "column": 35 + "column": 28 } } }, @@ -136,7 +108,7 @@ }, "end": { "line": 17, - "column": 35 + "column": 28 } } }, @@ -147,7 +119,7 @@ }, "end": { "line": 17, - "column": 35 + "column": 28 } } } @@ -386,35 +358,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -422,7 +366,7 @@ }, "end": { "line": 20, - "column": 37 + "column": 30 } } }, @@ -522,35 +466,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -558,7 +474,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/rethrowingConstructorCheck2-expected.txt b/ets2panda/test/compiler/ets/rethrowingConstructorCheck2-expected.txt index 3fc32efe47..47a35c73a5 100644 --- a/ets2panda/test/compiler/ets/rethrowingConstructorCheck2-expected.txt +++ b/ets2panda/test/compiler/ets/rethrowingConstructorCheck2-expected.txt @@ -76,35 +76,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -112,7 +84,7 @@ }, "end": { "line": 17, - "column": 35 + "column": 28 } } } @@ -124,7 +96,7 @@ }, "end": { "line": 17, - "column": 35 + "column": 28 } } }, @@ -136,7 +108,7 @@ }, "end": { "line": 17, - "column": 35 + "column": 28 } } }, @@ -147,7 +119,7 @@ }, "end": { "line": 17, - "column": 35 + "column": 28 } } } @@ -386,35 +358,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -422,7 +366,7 @@ }, "end": { "line": 20, - "column": 37 + "column": 30 } } }, @@ -522,35 +466,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -558,7 +474,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/rethrowingConstructorCheck3-expected.txt b/ets2panda/test/compiler/ets/rethrowingConstructorCheck3-expected.txt index ba9a7eb04d..a634a58ce8 100644 --- a/ets2panda/test/compiler/ets/rethrowingConstructorCheck3-expected.txt +++ b/ets2panda/test/compiler/ets/rethrowingConstructorCheck3-expected.txt @@ -76,35 +76,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -112,7 +84,7 @@ }, "end": { "line": 17, - "column": 35 + "column": 28 } } } @@ -124,7 +96,7 @@ }, "end": { "line": 17, - "column": 35 + "column": 28 } } }, @@ -136,7 +108,7 @@ }, "end": { "line": 17, - "column": 35 + "column": 28 } } }, @@ -147,7 +119,7 @@ }, "end": { "line": 17, - "column": 35 + "column": 28 } } } @@ -386,35 +358,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -422,7 +366,7 @@ }, "end": { "line": 20, - "column": 37 + "column": 30 } } }, @@ -522,35 +466,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -558,7 +474,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/rethrowingFunctionCheck1-expected.txt b/ets2panda/test/compiler/ets/rethrowingFunctionCheck1-expected.txt index 0b5a41b6b2..d262f89bdd 100644 --- a/ets2panda/test/compiler/ets/rethrowingFunctionCheck1-expected.txt +++ b/ets2panda/test/compiler/ets/rethrowingFunctionCheck1-expected.txt @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 32 - }, - "end": { - "line": 16, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 32 - }, - "end": { - "line": 16, - "column": 43 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } } @@ -218,7 +190,7 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } }, @@ -230,7 +202,7 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } }, @@ -241,41 +213,13 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 46 - }, - "end": { - "line": 16, - "column": 50 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 46 - }, - "end": { - "line": 16, - "column": 59 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -283,7 +227,7 @@ }, "end": { "line": 16, - "column": 59 + "column": 50 } } }, @@ -383,35 +327,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 40 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -419,7 +335,7 @@ }, "end": { "line": 18, - "column": 40 + "column": 33 } } }, @@ -519,35 +435,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -555,7 +443,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/rethrowingFunctionCheck2-expected.txt b/ets2panda/test/compiler/ets/rethrowingFunctionCheck2-expected.txt index 3de2324123..df58330bd0 100644 --- a/ets2panda/test/compiler/ets/rethrowingFunctionCheck2-expected.txt +++ b/ets2panda/test/compiler/ets/rethrowingFunctionCheck2-expected.txt @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 32 - }, - "end": { - "line": 16, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 32 - }, - "end": { - "line": 16, - "column": 43 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } } @@ -218,7 +190,7 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } }, @@ -230,7 +202,7 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } }, @@ -241,41 +213,13 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 46 - }, - "end": { - "line": 16, - "column": 50 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 46 - }, - "end": { - "line": 16, - "column": 59 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -283,7 +227,7 @@ }, "end": { "line": 16, - "column": 59 + "column": 50 } } }, @@ -383,35 +327,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 40 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -419,7 +335,7 @@ }, "end": { "line": 18, - "column": 40 + "column": 33 } } }, @@ -519,35 +435,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -555,7 +443,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/rethrowingFunctionCheck3-expected.txt b/ets2panda/test/compiler/ets/rethrowingFunctionCheck3-expected.txt index 0ba38e9c45..0d0c29ab58 100644 --- a/ets2panda/test/compiler/ets/rethrowingFunctionCheck3-expected.txt +++ b/ets2panda/test/compiler/ets/rethrowingFunctionCheck3-expected.txt @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 32 - }, - "end": { - "line": 16, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 32 - }, - "end": { - "line": 16, - "column": 43 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } } @@ -218,7 +190,7 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } }, @@ -230,7 +202,7 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } }, @@ -241,41 +213,13 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 46 - }, - "end": { - "line": 16, - "column": 50 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 46 - }, - "end": { - "line": 16, - "column": 59 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -283,7 +227,7 @@ }, "end": { "line": 16, - "column": 59 + "column": 50 } } }, @@ -383,35 +327,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 40 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -419,7 +335,7 @@ }, "end": { "line": 18, - "column": 40 + "column": 33 } } }, @@ -519,35 +435,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -555,7 +443,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/rethrowingMethodCheck1-expected.txt b/ets2panda/test/compiler/ets/rethrowingMethodCheck1-expected.txt index 17c45c9a59..c714e1824d 100644 --- a/ets2panda/test/compiler/ets/rethrowingMethodCheck1-expected.txt +++ b/ets2panda/test/compiler/ets/rethrowingMethodCheck1-expected.txt @@ -76,35 +76,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -112,7 +84,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 27 } } } @@ -124,7 +96,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 27 } } }, @@ -136,7 +108,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 27 } } }, @@ -147,41 +119,13 @@ }, "end": { "line": 17, - "column": 34 + "column": 27 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 37 - }, - "end": { - "line": 17, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 37 - }, - "end": { - "line": 17, - "column": 50 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -189,7 +133,7 @@ }, "end": { "line": 17, - "column": 50 + "column": 41 } } }, @@ -520,35 +464,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -556,7 +472,7 @@ }, "end": { "line": 20, - "column": 37 + "column": 30 } } }, @@ -656,35 +572,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -692,7 +580,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/rethrowingMethodCheck2-expected.txt b/ets2panda/test/compiler/ets/rethrowingMethodCheck2-expected.txt index 71d276a37d..870bdb61a6 100644 --- a/ets2panda/test/compiler/ets/rethrowingMethodCheck2-expected.txt +++ b/ets2panda/test/compiler/ets/rethrowingMethodCheck2-expected.txt @@ -76,35 +76,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -112,7 +84,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 27 } } } @@ -124,7 +96,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 27 } } }, @@ -136,7 +108,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 27 } } }, @@ -147,41 +119,13 @@ }, "end": { "line": 17, - "column": 34 + "column": 27 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 37 - }, - "end": { - "line": 17, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 37 - }, - "end": { - "line": 17, - "column": 50 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -189,7 +133,7 @@ }, "end": { "line": 17, - "column": 50 + "column": 41 } } }, @@ -520,35 +464,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -556,7 +472,7 @@ }, "end": { "line": 20, - "column": 37 + "column": 30 } } }, @@ -656,35 +572,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -692,7 +580,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/rethrowingMethodCheck3-expected.txt b/ets2panda/test/compiler/ets/rethrowingMethodCheck3-expected.txt index c555782cc1..4e6788abc0 100644 --- a/ets2panda/test/compiler/ets/rethrowingMethodCheck3-expected.txt +++ b/ets2panda/test/compiler/ets/rethrowingMethodCheck3-expected.txt @@ -76,35 +76,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -112,7 +84,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 27 } } } @@ -124,7 +96,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 27 } } }, @@ -136,7 +108,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 27 } } }, @@ -147,41 +119,13 @@ }, "end": { "line": 17, - "column": 34 + "column": 27 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 37 - }, - "end": { - "line": 17, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 37 - }, - "end": { - "line": 17, - "column": 50 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -189,7 +133,7 @@ }, "end": { "line": 17, - "column": 50 + "column": 41 } } }, @@ -520,35 +464,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -556,7 +472,7 @@ }, "end": { "line": 20, - "column": 37 + "column": 30 } } }, @@ -656,35 +572,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -692,7 +580,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/return_missing_argument-expected.txt b/ets2panda/test/compiler/ets/return_missing_argument-expected.txt index c1f2ba3172..4f04d2781b 100644 --- a/ets2panda/test/compiler/ets/return_missing_argument-expected.txt +++ b/ets2panda/test/compiler/ets/return_missing_argument-expected.txt @@ -355,35 +355,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -391,7 +363,7 @@ }, "end": { "line": 21, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/setArrayLength1-expected.txt b/ets2panda/test/compiler/ets/setArrayLength1-expected.txt index df6abda8ad..00ab3e2661 100644 --- a/ets2panda/test/compiler/ets/setArrayLength1-expected.txt +++ b/ets2panda/test/compiler/ets/setArrayLength1-expected.txt @@ -418,35 +418,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -454,7 +426,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/setArrayLength2-expected.txt b/ets2panda/test/compiler/ets/setArrayLength2-expected.txt index 318aa2a263..c1e777fff0 100644 --- a/ets2panda/test/compiler/ets/setArrayLength2-expected.txt +++ b/ets2panda/test/compiler/ets/setArrayLength2-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/setArrayLength3-expected.txt b/ets2panda/test/compiler/ets/setArrayLength3-expected.txt index b5b23584d5..ca0839dbc9 100644 --- a/ets2panda/test/compiler/ets/setArrayLength3-expected.txt +++ b/ets2panda/test/compiler/ets/setArrayLength3-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/switchStatementCorrectConversion-expected.txt b/ets2panda/test/compiler/ets/switchStatementCorrectConversion-expected.txt index f5a81fbd19..e45fe1d03d 100644 --- a/ets2panda/test/compiler/ets/switchStatementCorrectConversion-expected.txt +++ b/ets2panda/test/compiler/ets/switchStatementCorrectConversion-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 17 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 17 + "column": 16 } } }, diff --git a/ets2panda/test/compiler/ets/switchStatementWrongBoxing-expected.txt b/ets2panda/test/compiler/ets/switchStatementWrongBoxing-expected.txt index f893cf2cf9..d6a5b59f35 100644 --- a/ets2panda/test/compiler/ets/switchStatementWrongBoxing-expected.txt +++ b/ets2panda/test/compiler/ets/switchStatementWrongBoxing-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 17 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 17 + "column": 16 } } }, diff --git a/ets2panda/test/compiler/ets/throwInCatchClause1-expected.txt b/ets2panda/test/compiler/ets/throwInCatchClause1-expected.txt index fe84199b44..0a7f3ca08a 100644 --- a/ets2panda/test/compiler/ets/throwInCatchClause1-expected.txt +++ b/ets2panda/test/compiler/ets/throwInCatchClause1-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 22 - }, - "end": { - "line": 16, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 22 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 28 + "column": 26 } } }, diff --git a/ets2panda/test/compiler/ets/throwInCatchClause2-expected.txt b/ets2panda/test/compiler/ets/throwInCatchClause2-expected.txt index 6e15c36e97..8387dc2094 100644 --- a/ets2panda/test/compiler/ets/throwInCatchClause2-expected.txt +++ b/ets2panda/test/compiler/ets/throwInCatchClause2-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 22 - }, - "end": { - "line": 16, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 22 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 28 + "column": 26 } } }, diff --git a/ets2panda/test/compiler/ets/throwInCatchClause3-expected.txt b/ets2panda/test/compiler/ets/throwInCatchClause3-expected.txt index 290f684c71..7fe1a942ec 100644 --- a/ets2panda/test/compiler/ets/throwInCatchClause3-expected.txt +++ b/ets2panda/test/compiler/ets/throwInCatchClause3-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 22 - }, - "end": { - "line": 16, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 22 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 28 + "column": 26 } } }, diff --git a/ets2panda/test/compiler/ets/throwInFinallyBlock-expected.txt b/ets2panda/test/compiler/ets/throwInFinallyBlock-expected.txt index 5844924919..2a45d1d0ba 100644 --- a/ets2panda/test/compiler/ets/throwInFinallyBlock-expected.txt +++ b/ets2panda/test/compiler/ets/throwInFinallyBlock-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/throwInFinallyBlock1-expected.txt b/ets2panda/test/compiler/ets/throwInFinallyBlock1-expected.txt index 87863e0ede..65c952ed77 100644 --- a/ets2panda/test/compiler/ets/throwInFinallyBlock1-expected.txt +++ b/ets2panda/test/compiler/ets/throwInFinallyBlock1-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/throwInFinallyBlock2-expected.txt b/ets2panda/test/compiler/ets/throwInFinallyBlock2-expected.txt index ece4949884..5ec434063b 100644 --- a/ets2panda/test/compiler/ets/throwInFinallyBlock2-expected.txt +++ b/ets2panda/test/compiler/ets/throwInFinallyBlock2-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/throwInRethrowingFunction-expected.txt b/ets2panda/test/compiler/ets/throwInRethrowingFunction-expected.txt index 357c335845..74da48242d 100644 --- a/ets2panda/test/compiler/ets/throwInRethrowingFunction-expected.txt +++ b/ets2panda/test/compiler/ets/throwInRethrowingFunction-expected.txt @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 32 - }, - "end": { - "line": 16, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 32 - }, - "end": { - "line": 16, - "column": 43 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } } @@ -218,7 +190,7 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } }, @@ -230,7 +202,7 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } }, @@ -241,41 +213,13 @@ }, "end": { "line": 16, - "column": 43 + "column": 36 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 46 - }, - "end": { - "line": 16, - "column": 50 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 46 - }, - "end": { - "line": 16, - "column": 59 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -283,7 +227,7 @@ }, "end": { "line": 16, - "column": 59 + "column": 50 } } }, diff --git a/ets2panda/test/compiler/ets/throwInRethrowingFunction2-expected.txt b/ets2panda/test/compiler/ets/throwInRethrowingFunction2-expected.txt index 392812d426..0be83ab771 100644 --- a/ets2panda/test/compiler/ets/throwInRethrowingFunction2-expected.txt +++ b/ets2panda/test/compiler/ets/throwInRethrowingFunction2-expected.txt @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 34 - }, - "end": { - "line": 16, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 34 - }, - "end": { - "line": 16, - "column": 45 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 45 + "column": 38 } } } @@ -218,7 +190,7 @@ }, "end": { "line": 16, - "column": 45 + "column": 38 } } }, @@ -230,7 +202,7 @@ }, "end": { "line": 16, - "column": 45 + "column": 38 } } }, @@ -241,7 +213,7 @@ }, "end": { "line": 16, - "column": 45 + "column": 38 } } } diff --git a/ets2panda/test/compiler/ets/throwInThrowingFunction-expected.txt b/ets2panda/test/compiler/ets/throwInThrowingFunction-expected.txt index f84d9a6e84..44ba1f65ec 100644 --- a/ets2panda/test/compiler/ets/throwInThrowingFunction-expected.txt +++ b/ets2panda/test/compiler/ets/throwInThrowingFunction-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 37 + "column": 30 } } }, diff --git a/ets2panda/test/compiler/ets/throwInTryStatement-expected.txt b/ets2panda/test/compiler/ets/throwInTryStatement-expected.txt index 5dee768bca..5be3175f2f 100644 --- a/ets2panda/test/compiler/ets/throwInTryStatement-expected.txt +++ b/ets2panda/test/compiler/ets/throwInTryStatement-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/throwWithoutTryCatch-expected.txt b/ets2panda/test/compiler/ets/throwWithoutTryCatch-expected.txt index 3d916950b5..e8897685d2 100644 --- a/ets2panda/test/compiler/ets/throwWithoutTryCatch-expected.txt +++ b/ets2panda/test/compiler/ets/throwWithoutTryCatch-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/throwingConstructorCheck1-expected.txt b/ets2panda/test/compiler/ets/throwingConstructorCheck1-expected.txt index f03d10b766..0ea7b524b7 100644 --- a/ets2panda/test/compiler/ets/throwingConstructorCheck1-expected.txt +++ b/ets2panda/test/compiler/ets/throwingConstructorCheck1-expected.txt @@ -301,35 +301,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -337,7 +309,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/throwingConstructorCheck2-expected.txt b/ets2panda/test/compiler/ets/throwingConstructorCheck2-expected.txt index f0c6ef0b95..319eca7bd1 100644 --- a/ets2panda/test/compiler/ets/throwingConstructorCheck2-expected.txt +++ b/ets2panda/test/compiler/ets/throwingConstructorCheck2-expected.txt @@ -301,35 +301,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -337,7 +309,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/throwingFunctionAsParameter1-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionAsParameter1-expected.txt index 46bd51fe79..ac0ee15676 100644 --- a/ets2panda/test/compiler/ets/throwingFunctionAsParameter1-expected.txt +++ b/ets2panda/test/compiler/ets/throwingFunctionAsParameter1-expected.txt @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 37 - }, - "end": { - "line": 16, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 37 - }, - "end": { - "line": 16, - "column": 48 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 48 + "column": 41 } } } @@ -218,7 +190,7 @@ }, "end": { "line": 16, - "column": 48 + "column": 41 } } }, @@ -230,7 +202,7 @@ }, "end": { "line": 16, - "column": 48 + "column": 41 } } }, @@ -241,41 +213,13 @@ }, "end": { "line": 16, - "column": 48 + "column": 41 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 51 - }, - "end": { - "line": 16, - "column": 55 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 51 - }, - "end": { - "line": 16, - "column": 64 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -283,7 +227,7 @@ }, "end": { "line": 16, - "column": 64 + "column": 55 } } }, @@ -435,35 +379,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 38 - }, - "end": { - "line": 20, - "column": 42 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 38 - }, - "end": { - "line": 20, - "column": 49 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -471,7 +387,7 @@ }, "end": { "line": 20, - "column": 49 + "column": 42 } } } @@ -483,7 +399,7 @@ }, "end": { "line": 20, - "column": 49 + "column": 42 } } }, @@ -495,7 +411,7 @@ }, "end": { "line": 20, - "column": 49 + "column": 42 } } }, @@ -506,41 +422,13 @@ }, "end": { "line": 20, - "column": 49 + "column": 42 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 52 - }, - "end": { - "line": 20, - "column": 56 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 52 - }, - "end": { - "line": 20, - "column": 58 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -548,7 +436,7 @@ }, "end": { "line": 20, - "column": 58 + "column": 56 } } }, diff --git a/ets2panda/test/compiler/ets/throwingFunctionAsParameter2-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionAsParameter2-expected.txt index 530cca0f11..d1ec297ae9 100644 --- a/ets2panda/test/compiler/ets/throwingFunctionAsParameter2-expected.txt +++ b/ets2panda/test/compiler/ets/throwingFunctionAsParameter2-expected.txt @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 38 - }, - "end": { - "line": 16, - "column": 42 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 38 - }, - "end": { - "line": 16, - "column": 49 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 49 + "column": 42 } } } @@ -218,7 +190,7 @@ }, "end": { "line": 16, - "column": 49 + "column": 42 } } }, @@ -230,7 +202,7 @@ }, "end": { "line": 16, - "column": 49 + "column": 42 } } }, @@ -241,41 +213,13 @@ }, "end": { "line": 16, - "column": 49 + "column": 42 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 52 - }, - "end": { - "line": 16, - "column": 56 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 52 - }, - "end": { - "line": 16, - "column": 58 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -283,7 +227,7 @@ }, "end": { "line": 16, - "column": 58 + "column": 56 } } }, diff --git a/ets2panda/test/compiler/ets/throwingFunctionCheck1-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionCheck1-expected.txt index ec00b6e667..5909a76bf2 100644 --- a/ets2panda/test/compiler/ets/throwingFunctionCheck1-expected.txt +++ b/ets2panda/test/compiler/ets/throwingFunctionCheck1-expected.txt @@ -235,35 +235,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -271,7 +243,7 @@ }, "end": { "line": 16, - "column": 37 + "column": 30 } } }, diff --git a/ets2panda/test/compiler/ets/throwingFunctionCheck2-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionCheck2-expected.txt index b021724c4c..b92ba66ca1 100644 --- a/ets2panda/test/compiler/ets/throwingFunctionCheck2-expected.txt +++ b/ets2panda/test/compiler/ets/throwingFunctionCheck2-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 37 + "column": 30 } } }, @@ -298,35 +270,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -334,7 +278,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/throwingFunctionCheck3-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionCheck3-expected.txt index 3a20bd23e4..951c758e5b 100644 --- a/ets2panda/test/compiler/ets/throwingFunctionCheck3-expected.txt +++ b/ets2panda/test/compiler/ets/throwingFunctionCheck3-expected.txt @@ -163,35 +163,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -199,7 +171,7 @@ }, "end": { "line": 18, - "column": 25 + "column": 23 } } }, @@ -436,35 +408,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 26 - }, - "end": { - "line": 21, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 26 - }, - "end": { - "line": 21, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -472,7 +416,7 @@ }, "end": { "line": 21, - "column": 37 + "column": 30 } } }, @@ -859,35 +803,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 18 - }, - "end": { - "line": 29, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 18 - }, - "end": { - "line": 29, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 29, @@ -895,7 +811,7 @@ }, "end": { "line": 29, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/throwingFunctionCheck4-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionCheck4-expected.txt index 1a6d0916fa..7acb74c3d2 100644 --- a/ets2panda/test/compiler/ets/throwingFunctionCheck4-expected.txt +++ b/ets2panda/test/compiler/ets/throwingFunctionCheck4-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 37 + "column": 30 } } }, @@ -367,35 +339,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -403,7 +347,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/throwingFunctionCheck5-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionCheck5-expected.txt index 5ee1cbf0ce..5c30274410 100644 --- a/ets2panda/test/compiler/ets/throwingFunctionCheck5-expected.txt +++ b/ets2panda/test/compiler/ets/throwingFunctionCheck5-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 37 + "column": 30 } } }, @@ -367,35 +339,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -403,7 +347,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/throwingFunctionCheck6-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionCheck6-expected.txt index b4ef010fdc..37826bef35 100644 --- a/ets2panda/test/compiler/ets/throwingFunctionCheck6-expected.txt +++ b/ets2panda/test/compiler/ets/throwingFunctionCheck6-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 17 - }, - "end": { - "line": 21, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 17 - }, - "end": { - "line": 21, - "column": 28 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -104,7 +76,7 @@ }, "end": { "line": 21, - "column": 28 + "column": 21 } } }, @@ -504,35 +476,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -540,7 +484,7 @@ }, "end": { "line": 16, - "column": 37 + "column": 30 } } }, @@ -709,35 +653,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 26, @@ -745,7 +661,7 @@ }, "end": { "line": 26, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/throwingFunctionType1-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionType1-expected.txt index f718f3201c..8b43ed99ef 100644 --- a/ets2panda/test/compiler/ets/throwingFunctionType1-expected.txt +++ b/ets2panda/test/compiler/ets/throwingFunctionType1-expected.txt @@ -22,35 +22,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -58,7 +30,7 @@ }, "end": { "line": 16, - "column": 35 + "column": 28 } } } @@ -70,7 +42,7 @@ }, "end": { "line": 16, - "column": 35 + "column": 28 } } }, @@ -246,35 +218,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -282,7 +226,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, @@ -360,35 +304,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 26 - }, - "end": { - "line": 19, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 26 - }, - "end": { - "line": 19, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -396,7 +312,7 @@ }, "end": { "line": 19, - "column": 33 + "column": 30 } } }, diff --git a/ets2panda/test/compiler/ets/throwingFunctionType2-expected.txt b/ets2panda/test/compiler/ets/throwingFunctionType2-expected.txt index ce9c188d83..02dc5c60cf 100644 --- a/ets2panda/test/compiler/ets/throwingFunctionType2-expected.txt +++ b/ets2panda/test/compiler/ets/throwingFunctionType2-expected.txt @@ -22,35 +22,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -58,7 +30,7 @@ }, "end": { "line": 16, - "column": 35 + "column": 28 } } } @@ -70,7 +42,7 @@ }, "end": { "line": 16, - "column": 35 + "column": 28 } } }, @@ -246,35 +218,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -282,7 +226,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, @@ -360,35 +304,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 26 - }, - "end": { - "line": 19, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 26 - }, - "end": { - "line": 19, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -396,7 +312,7 @@ }, "end": { "line": 19, - "column": 33 + "column": 30 } } }, diff --git a/ets2panda/test/compiler/ets/throwingMethodCheck1-expected.txt b/ets2panda/test/compiler/ets/throwingMethodCheck1-expected.txt index fecebb4537..afd11f0499 100644 --- a/ets2panda/test/compiler/ets/throwingMethodCheck1-expected.txt +++ b/ets2panda/test/compiler/ets/throwingMethodCheck1-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 17 - }, - "end": { - "line": 17, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 17 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 28 + "column": 21 } } }, @@ -504,35 +476,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -540,7 +484,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/throwingMethodCheck2-expected.txt b/ets2panda/test/compiler/ets/throwingMethodCheck2-expected.txt index 1908013778..6928e531d7 100644 --- a/ets2panda/test/compiler/ets/throwingMethodCheck2-expected.txt +++ b/ets2panda/test/compiler/ets/throwingMethodCheck2-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 17 - }, - "end": { - "line": 17, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 17 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 28 + "column": 21 } } }, @@ -504,35 +476,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -540,7 +484,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tryCatchErrorFlow-expected.txt b/ets2panda/test/compiler/ets/tryCatchErrorFlow-expected.txt index 28e07c4b0f..7484d7638f 100644 --- a/ets2panda/test/compiler/ets/tryCatchErrorFlow-expected.txt +++ b/ets2panda/test/compiler/ets/tryCatchErrorFlow-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tryCatchErrorIncorrectParamType-expected.txt b/ets2panda/test/compiler/ets/tryCatchErrorIncorrectParamType-expected.txt index c712b18652..aa79e4f856 100644 --- a/ets2panda/test/compiler/ets/tryCatchErrorIncorrectParamType-expected.txt +++ b/ets2panda/test/compiler/ets/tryCatchErrorIncorrectParamType-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tryCatchErrorMissingParamType-expected.txt b/ets2panda/test/compiler/ets/tryCatchErrorMissingParamType-expected.txt index f683fe867d..24c1a1ccf6 100644 --- a/ets2panda/test/compiler/ets/tryCatchErrorMissingParamType-expected.txt +++ b/ets2panda/test/compiler/ets/tryCatchErrorMissingParamType-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tryCatchFlow-expected.txt b/ets2panda/test/compiler/ets/tryCatchFlow-expected.txt index 683edb16ab..ba40f9c934 100644 --- a/ets2panda/test/compiler/ets/tryCatchFlow-expected.txt +++ b/ets2panda/test/compiler/ets/tryCatchFlow-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tryCatchIncorrectParamType-expected.txt b/ets2panda/test/compiler/ets/tryCatchIncorrectParamType-expected.txt index 435bd1ee06..a56345052c 100644 --- a/ets2panda/test/compiler/ets/tryCatchIncorrectParamType-expected.txt +++ b/ets2panda/test/compiler/ets/tryCatchIncorrectParamType-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tryCatchMissingParamType-expected.txt b/ets2panda/test/compiler/ets/tryCatchMissingParamType-expected.txt index 78765b552a..dbcceae603 100644 --- a/ets2panda/test/compiler/ets/tryCatchMissingParamType-expected.txt +++ b/ets2panda/test/compiler/ets/tryCatchMissingParamType-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tryDefaultCatches-expected.txt b/ets2panda/test/compiler/ets/tryDefaultCatches-expected.txt index 4bc13bc815..c1449726a7 100644 --- a/ets2panda/test/compiler/ets/tryDefaultCatches-expected.txt +++ b/ets2panda/test/compiler/ets/tryDefaultCatches-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_1-expected.txt b/ets2panda/test/compiler/ets/tuple_types_1-expected.txt index e2ca72f175..dae35f393b 100644 --- a/ets2panda/test/compiler/ets/tuple_types_1-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_1-expected.txt @@ -1297,35 +1297,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 18 - }, - "end": { - "line": 27, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 18 - }, - "end": { - "line": 27, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 27, @@ -1333,7 +1305,7 @@ }, "end": { "line": 27, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_10_neg-expected.txt b/ets2panda/test/compiler/ets/tuple_types_10_neg-expected.txt index 7f3a1736aa..510b0a58e1 100644 --- a/ets2panda/test/compiler/ets/tuple_types_10_neg-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_10_neg-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -198,7 +170,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_11_neg-expected.txt b/ets2panda/test/compiler/ets/tuple_types_11_neg-expected.txt index 999b175e3a..d73ef6b2bf 100644 --- a/ets2panda/test/compiler/ets/tuple_types_11_neg-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_11_neg-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -198,7 +170,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_12-expected.txt b/ets2panda/test/compiler/ets/tuple_types_12-expected.txt index 19124a264b..9f6b0f07de 100644 --- a/ets2panda/test/compiler/ets/tuple_types_12-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_12-expected.txt @@ -762,35 +762,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -798,7 +770,7 @@ }, "end": { "line": 21, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_14-expected.txt b/ets2panda/test/compiler/ets/tuple_types_14-expected.txt index fa310986d8..a6eabf66f6 100644 --- a/ets2panda/test/compiler/ets/tuple_types_14-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_14-expected.txt @@ -258,35 +258,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -294,7 +266,7 @@ }, "end": { "line": 18, - "column": 23 + "column": 21 } } }, @@ -816,35 +788,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -852,7 +796,7 @@ }, "end": { "line": 24, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_15-expected.txt b/ets2panda/test/compiler/ets/tuple_types_15-expected.txt index 754f6acb25..ae5660de8c 100644 --- a/ets2panda/test/compiler/ets/tuple_types_15-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_15-expected.txt @@ -666,35 +666,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 18 - }, - "end": { - "line": 23, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 18 - }, - "end": { - "line": 23, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -702,7 +674,7 @@ }, "end": { "line": 23, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_16-expected.txt b/ets2panda/test/compiler/ets/tuple_types_16-expected.txt index ed97776aec..97d11121c9 100644 --- a/ets2panda/test/compiler/ets/tuple_types_16-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_16-expected.txt @@ -92,43 +92,15 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 33 - }, - "end": { - "line": 16, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 33 - }, - "end": { - "line": 17, - "column": 5 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, "column": 33 }, "end": { - "line": 17, - "column": 5 + "line": 16, + "column": 37 } } }, @@ -138,8 +110,8 @@ "column": 14 }, "end": { - "line": 17, - "column": 5 + "line": 16, + "column": 37 } } }, @@ -175,35 +147,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 20 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 20 - }, - "end": { - "line": 17, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -211,7 +155,7 @@ }, "end": { "line": 17, - "column": 25 + "column": 24 } } }, @@ -222,7 +166,7 @@ }, "end": { "line": 17, - "column": 25 + "column": 24 } } }, @@ -691,35 +635,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -727,7 +643,7 @@ }, "end": { "line": 21, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_17-expected.txt b/ets2panda/test/compiler/ets/tuple_types_17-expected.txt index 3e7201ee14..d2b37e1b11 100644 --- a/ets2panda/test/compiler/ets/tuple_types_17-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_17-expected.txt @@ -316,35 +316,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -352,7 +324,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_18-expected.txt b/ets2panda/test/compiler/ets/tuple_types_18-expected.txt index 936ee6de90..f958079b2d 100644 --- a/ets2panda/test/compiler/ets/tuple_types_18-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_18-expected.txt @@ -358,35 +358,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -394,7 +366,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_2_neg-expected.txt b/ets2panda/test/compiler/ets/tuple_types_2_neg-expected.txt index b32a3a2104..d4d6044506 100644 --- a/ets2panda/test/compiler/ets/tuple_types_2_neg-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_2_neg-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -198,7 +170,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_3_neg-expected.txt b/ets2panda/test/compiler/ets/tuple_types_3_neg-expected.txt index cca4b7497d..8618e5e3ec 100644 --- a/ets2panda/test/compiler/ets/tuple_types_3_neg-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_3_neg-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -198,7 +170,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_4_neg-expected.txt b/ets2panda/test/compiler/ets/tuple_types_4_neg-expected.txt index db9deb2371..27731bd1cd 100644 --- a/ets2panda/test/compiler/ets/tuple_types_4_neg-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_4_neg-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -198,7 +170,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_5_neg-expected.txt b/ets2panda/test/compiler/ets/tuple_types_5_neg-expected.txt index c17eebbf4d..421b533acb 100644 --- a/ets2panda/test/compiler/ets/tuple_types_5_neg-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_5_neg-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -198,7 +170,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_6_neg-expected.txt b/ets2panda/test/compiler/ets/tuple_types_6_neg-expected.txt index 01342b3043..2939326cc6 100644 --- a/ets2panda/test/compiler/ets/tuple_types_6_neg-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_6_neg-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -198,7 +170,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_7-expected.txt b/ets2panda/test/compiler/ets/tuple_types_7-expected.txt index 1793aff685..5bc97ab97c 100644 --- a/ets2panda/test/compiler/ets/tuple_types_7-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_7-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -198,7 +170,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_8-expected.txt b/ets2panda/test/compiler/ets/tuple_types_8-expected.txt index 5443c594f1..faf1a223b8 100644 --- a/ets2panda/test/compiler/ets/tuple_types_8-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_8-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -198,7 +170,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/tuple_types_9_neg-expected.txt b/ets2panda/test/compiler/ets/tuple_types_9_neg-expected.txt index 959d61e101..d929cbbc51 100644 --- a/ets2panda/test/compiler/ets/tuple_types_9_neg-expected.txt +++ b/ets2panda/test/compiler/ets/tuple_types_9_neg-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -198,7 +170,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/union_types_5-expected.txt b/ets2panda/test/compiler/ets/union_types_5-expected.txt index 3a041975ac..718a439e68 100644 --- a/ets2panda/test/compiler/ets/union_types_5-expected.txt +++ b/ets2panda/test/compiler/ets/union_types_5-expected.txt @@ -2278,35 +2278,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 46, - "column": 18 - }, - "end": { - "line": 46, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 46, - "column": 18 - }, - "end": { - "line": 46, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 46, @@ -2314,7 +2286,7 @@ }, "end": { "line": 46, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/compiler/ets/validate_signatures_throw_type_error-expected.txt b/ets2panda/test/compiler/ets/validate_signatures_throw_type_error-expected.txt index ae620a89c8..2a10202db1 100644 --- a/ets2panda/test/compiler/ets/validate_signatures_throw_type_error-expected.txt +++ b/ets2panda/test/compiler/ets/validate_signatures_throw_type_error-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/validate_signatures_throw_type_error_more_param-expected.txt b/ets2panda/test/compiler/ets/validate_signatures_throw_type_error_more_param-expected.txt index 1b7c879893..a7d72663d6 100644 --- a/ets2panda/test/compiler/ets/validate_signatures_throw_type_error_more_param-expected.txt +++ b/ets2panda/test/compiler/ets/validate_signatures_throw_type_error_more_param-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/compiler/ets/voidTypeInBinaryOperation-expected.txt b/ets2panda/test/compiler/ets/voidTypeInBinaryOperation-expected.txt index b434ae012c..f72919bbac 100644 --- a/ets2panda/test/compiler/ets/voidTypeInBinaryOperation-expected.txt +++ b/ets2panda/test/compiler/ets/voidTypeInBinaryOperation-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 25 + "column": 23 } } }, @@ -297,35 +269,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -333,7 +277,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, @@ -494,4 +438,4 @@ } } } -TypeError: An expression of type 'void' cannot be tested for truthiness [voidTypeInBinaryOperation.ets:20:19] +TypeError: Bad operand type, the types of the operands must be of possible condition type. [voidTypeInBinaryOperation.ets:20:10] diff --git a/ets2panda/test/parser/ets/AccessBinaryTrees-expected.txt b/ets2panda/test/parser/ets/AccessBinaryTrees-expected.txt index 050b311439..0f884e5274 100644 --- a/ets2panda/test/parser/ets/AccessBinaryTrees-expected.txt +++ b/ets2panda/test/parser/ets/AccessBinaryTrees-expected.txt @@ -2465,35 +2465,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 51, - "column": 17 - }, - "end": { - "line": 51, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 51, - "column": 17 - }, - "end": { - "line": 51, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 51, @@ -2501,7 +2473,7 @@ }, "end": { "line": 51, - "column": 23 + "column": 21 } } }, @@ -4946,35 +4918,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 79, - "column": 18 - }, - "end": { - "line": 79, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 79, - "column": 18 - }, - "end": { - "line": 79, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 79, @@ -4982,7 +4926,7 @@ }, "end": { "line": 79, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/AccessFannkuch-expected.txt b/ets2panda/test/parser/ets/AccessFannkuch-expected.txt index bf878c72fa..8f73d986b7 100644 --- a/ets2panda/test/parser/ets/AccessFannkuch-expected.txt +++ b/ets2panda/test/parser/ets/AccessFannkuch-expected.txt @@ -4825,35 +4825,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 84, - "column": 19 - }, - "end": { - "line": 84, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 84, - "column": 19 - }, - "end": { - "line": 84, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 84, @@ -4861,7 +4833,7 @@ }, "end": { "line": 84, - "column": 25 + "column": 23 } } }, @@ -5346,35 +5318,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 90, - "column": 18 - }, - "end": { - "line": 90, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 90, - "column": 18 - }, - "end": { - "line": 90, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 90, @@ -5382,7 +5326,7 @@ }, "end": { "line": 90, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/AccessNBody-expected.txt b/ets2panda/test/parser/ets/AccessNBody-expected.txt index 068b84444b..02f26f4471 100644 --- a/ets2panda/test/parser/ets/AccessNBody-expected.txt +++ b/ets2panda/test/parser/ets/AccessNBody-expected.txt @@ -4078,35 +4078,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 64, - "column": 36 - }, - "end": { - "line": 64, - "column": 40 - } - } - }, - "loc": { - "start": { - "line": 64, - "column": 36 - }, - "end": { - "line": 64, - "column": 42 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 64, @@ -4114,7 +4086,7 @@ }, "end": { "line": 64, - "column": 42 + "column": 40 } } }, @@ -13606,35 +13578,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 140, - "column": 20 - }, - "end": { - "line": 140, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 140, - "column": 20 - }, - "end": { - "line": 140, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 140, @@ -13642,7 +13586,7 @@ }, "end": { "line": 140, - "column": 26 + "column": 24 } } }, @@ -15407,35 +15351,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 156, - "column": 18 - }, - "end": { - "line": 156, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 156, - "column": 18 - }, - "end": { - "line": 156, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 156, @@ -15443,7 +15359,7 @@ }, "end": { "line": 156, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/AccessNSieve-expected.txt b/ets2panda/test/parser/ets/AccessNSieve-expected.txt index e9379ad0e6..7638c0a7f0 100644 --- a/ets2panda/test/parser/ets/AccessNSieve-expected.txt +++ b/ets2panda/test/parser/ets/AccessNSieve-expected.txt @@ -319,35 +319,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -355,7 +327,7 @@ }, "end": { "line": 22, - "column": 25 + "column": 23 } } }, @@ -2591,35 +2563,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 53, - "column": 17 - }, - "end": { - "line": 53, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 53, - "column": 17 - }, - "end": { - "line": 53, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 53, @@ -2627,7 +2571,7 @@ }, "end": { "line": 53, - "column": 23 + "column": 21 } } }, @@ -3176,35 +3120,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 59, - "column": 18 - }, - "end": { - "line": 59, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 59, - "column": 18 - }, - "end": { - "line": 59, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 59, @@ -3212,7 +3128,7 @@ }, "end": { "line": 59, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/Bitops3BitBitsInByte-expected.txt b/ets2panda/test/parser/ets/Bitops3BitBitsInByte-expected.txt index a298f24c52..f4aad7a971 100644 --- a/ets2panda/test/parser/ets/Bitops3BitBitsInByte-expected.txt +++ b/ets2panda/test/parser/ets/Bitops3BitBitsInByte-expected.txt @@ -1074,35 +1074,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 17 - }, - "end": { - "line": 30, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 17 - }, - "end": { - "line": 30, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 30, @@ -1110,7 +1082,7 @@ }, "end": { "line": 30, - "column": 23 + "column": 21 } } }, @@ -2133,35 +2105,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 41, - "column": 18 - }, - "end": { - "line": 41, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 41, - "column": 18 - }, - "end": { - "line": 41, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 41, @@ -2169,7 +2113,7 @@ }, "end": { "line": 41, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/BitopsBitsInByte-expected.txt b/ets2panda/test/parser/ets/BitopsBitsInByte-expected.txt index dd67845c62..215124ba27 100644 --- a/ets2panda/test/parser/ets/BitopsBitsInByte-expected.txt +++ b/ets2panda/test/parser/ets/BitopsBitsInByte-expected.txt @@ -848,35 +848,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 33, - "column": 17 - }, - "end": { - "line": 33, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 33, - "column": 17 - }, - "end": { - "line": 33, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 33, @@ -884,7 +856,7 @@ }, "end": { "line": 33, - "column": 23 + "column": 21 } } }, @@ -1907,35 +1879,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 44, - "column": 18 - }, - "end": { - "line": 44, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 44, - "column": 18 - }, - "end": { - "line": 44, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 44, @@ -1943,7 +1887,7 @@ }, "end": { "line": 44, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/BitopsBitwiseAnd-expected.txt b/ets2panda/test/parser/ets/BitopsBitwiseAnd-expected.txt index d9d3f5b4cc..d4747bb310 100644 --- a/ets2panda/test/parser/ets/BitopsBitwiseAnd-expected.txt +++ b/ets2panda/test/parser/ets/BitopsBitwiseAnd-expected.txt @@ -194,35 +194,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 17 - }, - "end": { - "line": 20, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 17 - }, - "end": { - "line": 20, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -230,7 +202,7 @@ }, "end": { "line": 20, - "column": 23 + "column": 21 } } }, @@ -1020,35 +992,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 18 - }, - "end": { - "line": 30, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 18 - }, - "end": { - "line": 30, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 30, @@ -1056,7 +1000,7 @@ }, "end": { "line": 30, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/BitopsNSieveBits-expected.txt b/ets2panda/test/parser/ets/BitopsNSieveBits-expected.txt index 6e174ce74b..bd39afb2f6 100644 --- a/ets2panda/test/parser/ets/BitopsNSieveBits-expected.txt +++ b/ets2panda/test/parser/ets/BitopsNSieveBits-expected.txt @@ -205,35 +205,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 52 - }, - "end": { - "line": 17, - "column": 56 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 52 - }, - "end": { - "line": 17, - "column": 58 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -241,7 +213,7 @@ }, "end": { "line": 17, - "column": 58 + "column": 56 } } }, @@ -2388,35 +2360,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 46, - "column": 17 - }, - "end": { - "line": 46, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 46, - "column": 17 - }, - "end": { - "line": 46, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 46, @@ -2424,7 +2368,7 @@ }, "end": { "line": 46, - "column": 23 + "column": 21 } } }, @@ -3434,35 +3378,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 57, - "column": 18 - }, - "end": { - "line": 57, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 57, - "column": 18 - }, - "end": { - "line": 57, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 57, @@ -3470,7 +3386,7 @@ }, "end": { "line": 57, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/Boolean_bitwise-expected.txt b/ets2panda/test/parser/ets/Boolean_bitwise-expected.txt index fc46c2282b..069cc6d9a4 100644 --- a/ets2panda/test/parser/ets/Boolean_bitwise-expected.txt +++ b/ets2panda/test/parser/ets/Boolean_bitwise-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/ControlFlowRecursive-expected.txt b/ets2panda/test/parser/ets/ControlFlowRecursive-expected.txt index 5a053da53e..17ec672e2d 100644 --- a/ets2panda/test/parser/ets/ControlFlowRecursive-expected.txt +++ b/ets2panda/test/parser/ets/ControlFlowRecursive-expected.txt @@ -2308,35 +2308,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 45, - "column": 24 - }, - "end": { - "line": 45, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 45, - "column": 24 - }, - "end": { - "line": 45, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 45, @@ -2344,7 +2316,7 @@ }, "end": { "line": 45, - "column": 30 + "column": 28 } } }, @@ -3647,35 +3619,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 57, - "column": 18 - }, - "end": { - "line": 57, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 57, - "column": 18 - }, - "end": { - "line": 57, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 57, @@ -3683,7 +3627,7 @@ }, "end": { "line": 57, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/Dollar_dollar_2-expected.txt b/ets2panda/test/parser/ets/Dollar_dollar_2-expected.txt index 43188a188a..340e758cc9 100644 --- a/ets2panda/test/parser/ets/Dollar_dollar_2-expected.txt +++ b/ets2panda/test/parser/ets/Dollar_dollar_2-expected.txt @@ -437,35 +437,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 55 - }, - "end": { - "line": 20, - "column": 59 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 55 - }, - "end": { - "line": 20, - "column": 61 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -473,7 +445,7 @@ }, "end": { "line": 20, - "column": 61 + "column": 59 } } }, @@ -572,35 +544,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 12 - }, - "end": { - "line": 21, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 12 - }, - "end": { - "line": 21, - "column": 18 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -608,7 +552,7 @@ }, "end": { "line": 21, - "column": 18 + "column": 16 } } }, diff --git a/ets2panda/test/parser/ets/FunctionType-expected.txt b/ets2panda/test/parser/ets/FunctionType-expected.txt index dc021dada9..a657be116c 100644 --- a/ets2panda/test/parser/ets/FunctionType-expected.txt +++ b/ets2panda/test/parser/ets/FunctionType-expected.txt @@ -132,35 +132,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 27 - }, - "end": { - "line": 24, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 27 - }, - "end": { - "line": 24, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -168,7 +140,7 @@ }, "end": { "line": 24, - "column": 32 + "column": 31 } } }, @@ -179,7 +151,7 @@ }, "end": { "line": 24, - "column": 32 + "column": 31 } } }, @@ -192,7 +164,7 @@ }, "end": { "line": 24, - "column": 32 + "column": 31 } } }, @@ -732,35 +704,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 24 - }, - "end": { - "line": 19, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 24 - }, - "end": { - "line": 19, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -768,7 +712,7 @@ }, "end": { "line": 19, - "column": 29 + "column": 28 } } }, @@ -779,7 +723,7 @@ }, "end": { "line": 19, - "column": 29 + "column": 28 } } }, @@ -791,7 +735,7 @@ }, "end": { "line": 19, - "column": 29 + "column": 28 } } }, @@ -802,7 +746,7 @@ }, "end": { "line": 19, - "column": 29 + "column": 28 } } } diff --git a/ets2panda/test/parser/ets/FunctionalTypeAsTypeArgument-expected.txt b/ets2panda/test/parser/ets/FunctionalTypeAsTypeArgument-expected.txt index d9ec76360b..fbbb1f55f0 100644 --- a/ets2panda/test/parser/ets/FunctionalTypeAsTypeArgument-expected.txt +++ b/ets2panda/test/parser/ets/FunctionalTypeAsTypeArgument-expected.txt @@ -231,35 +231,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 42 - }, - "end": { - "line": 16, - "column": 46 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 42 - }, - "end": { - "line": 16, - "column": 47 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -267,7 +239,7 @@ }, "end": { "line": 16, - "column": 47 + "column": 46 } } }, @@ -278,7 +250,7 @@ }, "end": { "line": 16, - "column": 47 + "column": 46 } } } diff --git a/ets2panda/test/parser/ets/InterfacePrivateMethod-expected.txt b/ets2panda/test/parser/ets/InterfacePrivateMethod-expected.txt index 9512108956..999094778c 100644 --- a/ets2panda/test/parser/ets/InterfacePrivateMethod-expected.txt +++ b/ets2panda/test/parser/ets/InterfacePrivateMethod-expected.txt @@ -927,35 +927,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -963,7 +935,7 @@ }, "end": { "line": 28, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/MathCordic-expected.txt b/ets2panda/test/parser/ets/MathCordic-expected.txt index 56e1b88322..600f5588e2 100644 --- a/ets2panda/test/parser/ets/MathCordic-expected.txt +++ b/ets2panda/test/parser/ets/MathCordic-expected.txt @@ -4688,35 +4688,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 70, - "column": 20 - }, - "end": { - "line": 70, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 70, - "column": 20 - }, - "end": { - "line": 70, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 70, @@ -4724,7 +4696,7 @@ }, "end": { "line": 70, - "column": 26 + "column": 24 } } }, @@ -5401,35 +5373,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 78, - "column": 18 - }, - "end": { - "line": 78, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 78, - "column": 18 - }, - "end": { - "line": 78, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 78, @@ -5437,7 +5381,7 @@ }, "end": { "line": 78, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/MathPartialSums-expected.txt b/ets2panda/test/parser/ets/MathPartialSums-expected.txt index 23eb4fa475..5203c78f1f 100644 --- a/ets2panda/test/parser/ets/MathPartialSums-expected.txt +++ b/ets2panda/test/parser/ets/MathPartialSums-expected.txt @@ -3862,35 +3862,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 72, - "column": 24 - }, - "end": { - "line": 72, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 72, - "column": 24 - }, - "end": { - "line": 72, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 72, @@ -3898,7 +3870,7 @@ }, "end": { "line": 72, - "column": 30 + "column": 28 } } }, @@ -4953,35 +4925,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 83, - "column": 18 - }, - "end": { - "line": 83, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 83, - "column": 18 - }, - "end": { - "line": 83, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 83, @@ -4989,7 +4933,7 @@ }, "end": { "line": 83, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/MathSpectralNorm-expected.txt b/ets2panda/test/parser/ets/MathSpectralNorm-expected.txt index 2c9560bd20..a5e9ad2148 100644 --- a/ets2panda/test/parser/ets/MathSpectralNorm-expected.txt +++ b/ets2panda/test/parser/ets/MathSpectralNorm-expected.txt @@ -624,35 +624,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 50 - }, - "end": { - "line": 21, - "column": 54 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 50 - }, - "end": { - "line": 21, - "column": 56 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -660,7 +632,7 @@ }, "end": { "line": 21, - "column": 56 + "column": 54 } } }, @@ -1625,35 +1597,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 51 - }, - "end": { - "line": 31, - "column": 55 - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 51 - }, - "end": { - "line": 31, - "column": 57 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 31, @@ -1661,7 +1605,7 @@ }, "end": { "line": 31, - "column": 57 + "column": 55 } } }, @@ -2680,35 +2624,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 41, - "column": 65 - }, - "end": { - "line": 41, - "column": 69 - } - } - }, - "loc": { - "start": { - "line": 41, - "column": 65 - }, - "end": { - "line": 41, - "column": 71 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 41, @@ -2716,7 +2632,7 @@ }, "end": { "line": 41, - "column": 71 + "column": 69 } } }, @@ -5179,35 +5095,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 80, - "column": 17 - }, - "end": { - "line": 80, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 80, - "column": 17 - }, - "end": { - "line": 80, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 80, @@ -5215,7 +5103,7 @@ }, "end": { "line": 80, - "column": 23 + "column": 21 } } }, @@ -6079,35 +5967,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 91, - "column": 18 - }, - "end": { - "line": 91, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 91, - "column": 18 - }, - "end": { - "line": 91, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 91, @@ -6115,7 +5975,7 @@ }, "end": { "line": 91, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/Morph3d-expected.txt b/ets2panda/test/parser/ets/Morph3d-expected.txt index e5929d51a2..c9daaacefa 100644 --- a/ets2panda/test/parser/ets/Morph3d-expected.txt +++ b/ets2panda/test/parser/ets/Morph3d-expected.txt @@ -328,35 +328,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 19 - }, - "end": { - "line": 24, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 19 - }, - "end": { - "line": 24, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -364,7 +336,7 @@ }, "end": { "line": 24, - "column": 25 + "column": 23 } } }, @@ -1142,35 +1114,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 29 - }, - "end": { - "line": 32, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 29 - }, - "end": { - "line": 32, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 32, @@ -1178,7 +1122,7 @@ }, "end": { "line": 32, - "column": 35 + "column": 33 } } }, @@ -2439,35 +2383,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 43, - "column": 17 - }, - "end": { - "line": 43, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 43, - "column": 17 - }, - "end": { - "line": 43, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 43, @@ -2475,7 +2391,7 @@ }, "end": { "line": 43, - "column": 23 + "column": 21 } } }, @@ -3905,35 +3821,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 60, - "column": 18 - }, - "end": { - "line": 60, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 60, - "column": 18 - }, - "end": { - "line": 60, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 60, @@ -3941,7 +3829,7 @@ }, "end": { "line": 60, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/StringBase64-expected.txt b/ets2panda/test/parser/ets/StringBase64-expected.txt index c47c0dce32..8c46d0b051 100644 --- a/ets2panda/test/parser/ets/StringBase64-expected.txt +++ b/ets2panda/test/parser/ets/StringBase64-expected.txt @@ -9471,35 +9471,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 72, - "column": 20 - }, - "end": { - "line": 72, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 72, - "column": 20 - }, - "end": { - "line": 72, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 72, @@ -9507,7 +9479,7 @@ }, "end": { "line": 72, - "column": 26 + "column": 24 } } }, @@ -11029,35 +11001,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 88, - "column": 18 - }, - "end": { - "line": 88, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 88, - "column": 18 - }, - "end": { - "line": 88, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 88, @@ -11065,7 +11009,7 @@ }, "end": { "line": 88, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/access_modifier_2-expected.txt b/ets2panda/test/parser/ets/access_modifier_2-expected.txt index 4ac6fb77d9..b7f4f5a19f 100644 --- a/ets2panda/test/parser/ets/access_modifier_2-expected.txt +++ b/ets2panda/test/parser/ets/access_modifier_2-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 25 - }, - "end": { - "line": 17, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 25 - }, - "end": { - "line": 17, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 31 + "column": 29 } } }, diff --git a/ets2panda/test/parser/ets/accessor_call-expected.txt b/ets2panda/test/parser/ets/accessor_call-expected.txt index 9411c8d2ef..2b34601e61 100644 --- a/ets2panda/test/parser/ets/accessor_call-expected.txt +++ b/ets2panda/test/parser/ets/accessor_call-expected.txt @@ -434,35 +434,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -470,7 +442,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/accessor_void-expected.txt b/ets2panda/test/parser/ets/accessor_void-expected.txt index e05bd5637e..08b8eef39f 100644 --- a/ets2panda/test/parser/ets/accessor_void-expected.txt +++ b/ets2panda/test/parser/ets/accessor_void-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 14 - }, - "end": { - "line": 17, - "column": 18 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 14 - }, - "end": { - "line": 17, - "column": 20 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 20 + "column": 18 } } }, diff --git a/ets2panda/test/parser/ets/ambiguous_call_1-expected.txt b/ets2panda/test/parser/ets/ambiguous_call_1-expected.txt index 1484280686..257ca1c953 100644 --- a/ets2panda/test/parser/ets/ambiguous_call_1-expected.txt +++ b/ets2panda/test/parser/ets/ambiguous_call_1-expected.txt @@ -564,35 +564,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -600,7 +572,7 @@ }, "end": { "line": 16, - "column": 30 + "column": 28 } } }, @@ -757,35 +729,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -793,7 +737,7 @@ }, "end": { "line": 17, - "column": 30 + "column": 28 } } }, @@ -905,35 +849,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -941,7 +857,7 @@ }, "end": { "line": 22, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/ambiguous_call_2-expected.txt b/ets2panda/test/parser/ets/ambiguous_call_2-expected.txt index d6d64da7f5..cef0a143bc 100644 --- a/ets2panda/test/parser/ets/ambiguous_call_2-expected.txt +++ b/ets2panda/test/parser/ets/ambiguous_call_2-expected.txt @@ -965,35 +965,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 43 - }, - "end": { - "line": 16, - "column": 47 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 43 - }, - "end": { - "line": 16, - "column": 49 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -1001,7 +973,7 @@ }, "end": { "line": 16, - "column": 49 + "column": 47 } } }, @@ -1268,35 +1240,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 43 - }, - "end": { - "line": 17, - "column": 47 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 43 - }, - "end": { - "line": 17, - "column": 49 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -1304,7 +1248,7 @@ }, "end": { "line": 17, - "column": 49 + "column": 47 } } }, @@ -1583,35 +1527,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 43 - }, - "end": { - "line": 18, - "column": 47 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 43 - }, - "end": { - "line": 18, - "column": 49 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -1619,7 +1535,7 @@ }, "end": { "line": 18, - "column": 49 + "column": 47 } } }, @@ -1731,35 +1647,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 19 - }, - "end": { - "line": 26, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 19 - }, - "end": { - "line": 26, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 26, @@ -1767,7 +1655,7 @@ }, "end": { "line": 26, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/ambiguous_call_3-expected.txt b/ets2panda/test/parser/ets/ambiguous_call_3-expected.txt index b037238447..fad63e69cf 100644 --- a/ets2panda/test/parser/ets/ambiguous_call_3-expected.txt +++ b/ets2panda/test/parser/ets/ambiguous_call_3-expected.txt @@ -644,35 +644,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -680,7 +652,7 @@ }, "end": { "line": 16, - "column": 30 + "column": 28 } } }, @@ -837,35 +809,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -873,7 +817,7 @@ }, "end": { "line": 17, - "column": 29 + "column": 27 } } }, @@ -985,35 +929,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -1021,7 +937,7 @@ }, "end": { "line": 22, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/anonymous_class-expected.txt b/ets2panda/test/parser/ets/anonymous_class-expected.txt index efcfb803c8..50ae27c56d 100644 --- a/ets2panda/test/parser/ets/anonymous_class-expected.txt +++ b/ets2panda/test/parser/ets/anonymous_class-expected.txt @@ -251,35 +251,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 23 - }, - "end": { - "line": 19, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 23 - }, - "end": { - "line": 19, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -287,7 +259,7 @@ }, "end": { "line": 19, - "column": 29 + "column": 27 } } }, diff --git a/ets2panda/test/parser/ets/array-expected.txt b/ets2panda/test/parser/ets/array-expected.txt index 3a3d657a17..1d9580dc49 100644 --- a/ets2panda/test/parser/ets/array-expected.txt +++ b/ets2panda/test/parser/ets/array-expected.txt @@ -568,35 +568,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 31 - }, - "end": { - "line": 19, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 31 - }, - "end": { - "line": 19, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -604,7 +576,7 @@ }, "end": { "line": 19, - "column": 37 + "column": 35 } } }, @@ -703,35 +675,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 17 - }, - "end": { - "line": 21, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 17 - }, - "end": { - "line": 21, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -739,7 +683,7 @@ }, "end": { "line": 21, - "column": 23 + "column": 21 } } }, @@ -940,35 +884,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 18 - }, - "end": { - "line": 25, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 18 - }, - "end": { - "line": 25, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 25, @@ -976,7 +892,7 @@ }, "end": { "line": 25, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/arrayHoldingNullValue-expected.txt b/ets2panda/test/parser/ets/arrayHoldingNullValue-expected.txt index 5f4c36f800..136ff16206 100644 --- a/ets2panda/test/parser/ets/arrayHoldingNullValue-expected.txt +++ b/ets2panda/test/parser/ets/arrayHoldingNullValue-expected.txt @@ -629,35 +629,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -665,7 +637,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/array_creation_expression-expected.txt b/ets2panda/test/parser/ets/array_creation_expression-expected.txt index 1215149030..6e0ab76f0c 100644 --- a/ets2panda/test/parser/ets/array_creation_expression-expected.txt +++ b/ets2panda/test/parser/ets/array_creation_expression-expected.txt @@ -999,35 +999,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 18 - }, - "end": { - "line": 31, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 18 - }, - "end": { - "line": 31, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 31, @@ -1035,7 +1007,7 @@ }, "end": { "line": 31, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/array_expression_implicit_cast_assignment-expected.txt b/ets2panda/test/parser/ets/array_expression_implicit_cast_assignment-expected.txt index 8f90225009..853ed01ea2 100644 --- a/ets2panda/test/parser/ets/array_expression_implicit_cast_assignment-expected.txt +++ b/ets2panda/test/parser/ets/array_expression_implicit_cast_assignment-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 17 - }, - "end": { - "line": 16, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 17 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 23 + "column": 21 } } }, diff --git a/ets2panda/test/parser/ets/array_new-expected.txt b/ets2panda/test/parser/ets/array_new-expected.txt index f67a81d376..f2d8cc4e41 100644 --- a/ets2panda/test/parser/ets/array_new-expected.txt +++ b/ets2panda/test/parser/ets/array_new-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 17 - }, - "end": { - "line": 16, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 17 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 23 + "column": 21 } } }, diff --git a/ets2panda/test/parser/ets/array_new_failed-expected.txt b/ets2panda/test/parser/ets/array_new_failed-expected.txt index 9d3ca1198d..15425cd708 100644 --- a/ets2panda/test/parser/ets/array_new_failed-expected.txt +++ b/ets2panda/test/parser/ets/array_new_failed-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 17 - }, - "end": { - "line": 16, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 17 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 23 + "column": 21 } } }, diff --git a/ets2panda/test/parser/ets/array_type-expected.txt b/ets2panda/test/parser/ets/array_type-expected.txt index d86b75cade..9eda7bda03 100644 --- a/ets2panda/test/parser/ets/array_type-expected.txt +++ b/ets2panda/test/parser/ets/array_type-expected.txt @@ -454,35 +454,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 34 - }, - "end": { - "line": 21, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 34 - }, - "end": { - "line": 21, - "column": 40 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -490,7 +462,7 @@ }, "end": { "line": 21, - "column": 40 + "column": 38 } } }, diff --git a/ets2panda/test/parser/ets/assert-expected.txt b/ets2panda/test/parser/ets/assert-expected.txt index 62ea594235..99761adc60 100644 --- a/ets2panda/test/parser/ets/assert-expected.txt +++ b/ets2panda/test/parser/ets/assert-expected.txt @@ -250,35 +250,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 20 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 20 - }, - "end": { - "line": 19, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -286,7 +258,7 @@ }, "end": { "line": 19, - "column": 26 + "column": 24 } } }, diff --git a/ets2panda/test/parser/ets/assign-expected.txt b/ets2panda/test/parser/ets/assign-expected.txt index 1ee8a063a2..f4961fc403 100644 --- a/ets2panda/test/parser/ets/assign-expected.txt +++ b/ets2panda/test/parser/ets/assign-expected.txt @@ -319,35 +319,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -355,7 +327,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/assign-func-expected.txt b/ets2panda/test/parser/ets/assign-func-expected.txt index 9acaaa71d7..691b092973 100644 --- a/ets2panda/test/parser/ets/assign-func-expected.txt +++ b/ets2panda/test/parser/ets/assign-func-expected.txt @@ -76,35 +76,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -112,7 +84,7 @@ }, "end": { "line": 17, - "column": 32 + "column": 31 } } }, @@ -123,7 +95,7 @@ }, "end": { "line": 17, - "column": 32 + "column": 31 } } }, @@ -135,7 +107,7 @@ }, "end": { "line": 17, - "column": 32 + "column": 31 } } }, @@ -146,7 +118,7 @@ }, "end": { "line": 17, - "column": 32 + "column": 31 } } } @@ -313,35 +285,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 29 - }, - "end": { - "line": 21, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 29 - }, - "end": { - "line": 21, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -349,7 +293,7 @@ }, "end": { "line": 21, - "column": 34 + "column": 33 } } }, @@ -360,7 +304,7 @@ }, "end": { "line": 21, - "column": 34 + "column": 33 } } }, @@ -373,7 +317,7 @@ }, "end": { "line": 21, - "column": 34 + "column": 33 } } } diff --git a/ets2panda/test/parser/ets/assignments-expected.txt b/ets2panda/test/parser/ets/assignments-expected.txt index a23e936e22..84ae73b583 100644 --- a/ets2panda/test/parser/ets/assignments-expected.txt +++ b/ets2panda/test/parser/ets/assignments-expected.txt @@ -306,35 +306,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -342,7 +314,7 @@ }, "end": { "line": 21, - "column": 27 + "column": 25 } } }, diff --git a/ets2panda/test/parser/ets/async_overload-expected.txt b/ets2panda/test/parser/ets/async_overload-expected.txt index 6ac9016e64..a613f34702 100644 --- a/ets2panda/test/parser/ets/async_overload-expected.txt +++ b/ets2panda/test/parser/ets/async_overload-expected.txt @@ -1623,35 +1623,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 33, - "column": 18 - }, - "end": { - "line": 33, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 33, - "column": 18 - }, - "end": { - "line": 33, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 33, @@ -1659,7 +1631,7 @@ }, "end": { "line": 33, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/async_with_lambda-expected.txt b/ets2panda/test/parser/ets/async_with_lambda-expected.txt index f9fdfc7136..13a2fc945b 100644 --- a/ets2panda/test/parser/ets/async_with_lambda-expected.txt +++ b/ets2panda/test/parser/ets/async_with_lambda-expected.txt @@ -450,35 +450,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 23 - }, - "end": { - "line": 20, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 23 - }, - "end": { - "line": 20, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -486,7 +458,7 @@ }, "end": { "line": 20, - "column": 29 + "column": 27 } } }, @@ -497,7 +469,7 @@ }, "end": { "line": 20, - "column": 29 + "column": 27 } } }, @@ -523,35 +495,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 34 - }, - "end": { - "line": 20, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 34 - }, - "end": { - "line": 20, - "column": 41 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -559,7 +503,7 @@ }, "end": { "line": 20, - "column": 41 + "column": 38 } } }, @@ -1719,35 +1663,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 34, - "column": 65 - }, - "end": { - "line": 34, - "column": 69 - } - } - }, - "loc": { - "start": { - "line": 34, - "column": 65 - }, - "end": { - "line": 34, - "column": 70 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 34, @@ -1755,7 +1671,7 @@ }, "end": { "line": 34, - "column": 70 + "column": 69 } } }, @@ -1766,7 +1682,7 @@ }, "end": { "line": 34, - "column": 70 + "column": 69 } } }, @@ -1778,7 +1694,7 @@ }, "end": { "line": 34, - "column": 70 + "column": 69 } } }, @@ -1789,41 +1705,13 @@ }, "end": { "line": 34, - "column": 70 + "column": 69 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 34, - "column": 72 - }, - "end": { - "line": 34, - "column": 76 - } - } - }, - "loc": { - "start": { - "line": 34, - "column": 72 - }, - "end": { - "line": 34, - "column": 79 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 34, @@ -1831,7 +1719,7 @@ }, "end": { "line": 34, - "column": 79 + "column": 76 } } }, diff --git a/ets2panda/test/parser/ets/await_keyword-expected.txt b/ets2panda/test/parser/ets/await_keyword-expected.txt index b9e70d8bf5..c8559d4e7e 100644 --- a/ets2panda/test/parser/ets/await_keyword-expected.txt +++ b/ets2panda/test/parser/ets/await_keyword-expected.txt @@ -1654,35 +1654,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 17 - }, - "end": { - "line": 28, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 17 - }, - "end": { - "line": 28, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -1690,7 +1662,7 @@ }, "end": { "line": 28, - "column": 23 + "column": 21 } } }, @@ -2136,35 +2108,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 33, - "column": 30 - }, - "end": { - "line": 33, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 33, - "column": 30 - }, - "end": { - "line": 33, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 33, @@ -2172,7 +2116,7 @@ }, "end": { "line": 33, - "column": 37 + "column": 34 } } }, @@ -2588,35 +2532,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 33, - "column": 19 - }, - "end": { - "line": 33, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 33, - "column": 19 - }, - "end": { - "line": 33, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 33, @@ -2624,7 +2540,7 @@ }, "end": { "line": 33, - "column": 25 + "column": 23 } } }, @@ -2635,7 +2551,7 @@ }, "end": { "line": 33, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/boolean_cond-expected.txt b/ets2panda/test/parser/ets/boolean_cond-expected.txt index c5e7a59543..a534335ef3 100644 --- a/ets2panda/test/parser/ets/boolean_cond-expected.txt +++ b/ets2panda/test/parser/ets/boolean_cond-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/boolean_default-expected.txt b/ets2panda/test/parser/ets/boolean_default-expected.txt index b1317a2f77..8bb900f742 100644 --- a/ets2panda/test/parser/ets/boolean_default-expected.txt +++ b/ets2panda/test/parser/ets/boolean_default-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/break-expected.txt b/ets2panda/test/parser/ets/break-expected.txt index de23f03f7f..fa59f207e9 100644 --- a/ets2panda/test/parser/ets/break-expected.txt +++ b/ets2panda/test/parser/ets/break-expected.txt @@ -324,35 +324,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -360,7 +332,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/calling_superclass_methods-expected.txt b/ets2panda/test/parser/ets/calling_superclass_methods-expected.txt index 7e17bb5889..8145663cfb 100644 --- a/ets2panda/test/parser/ets/calling_superclass_methods-expected.txt +++ b/ets2panda/test/parser/ets/calling_superclass_methods-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 20 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 20 - }, - "end": { - "line": 19, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -104,7 +76,7 @@ }, "end": { "line": 19, - "column": 26 + "column": 24 } } }, diff --git a/ets2panda/test/parser/ets/calls-expected.txt b/ets2panda/test/parser/ets/calls-expected.txt index 58b7b64497..3e541366b0 100644 --- a/ets2panda/test/parser/ets/calls-expected.txt +++ b/ets2panda/test/parser/ets/calls-expected.txt @@ -604,35 +604,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -640,7 +612,7 @@ }, "end": { "line": 24, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/cast_expressions-expected.txt b/ets2panda/test/parser/ets/cast_expressions-expected.txt index ce3c9ff7fb..fa131d8fae 100644 --- a/ets2panda/test/parser/ets/cast_expressions-expected.txt +++ b/ets2panda/test/parser/ets/cast_expressions-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 29 + "column": 27 } } }, @@ -2024,35 +1996,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 46, - "column": 24 - }, - "end": { - "line": 46, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 46, - "column": 24 - }, - "end": { - "line": 46, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 46, @@ -2060,7 +2004,7 @@ }, "end": { "line": 46, - "column": 30 + "column": 28 } } }, @@ -3801,35 +3745,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 75, - "column": 23 - }, - "end": { - "line": 75, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 75, - "column": 23 - }, - "end": { - "line": 75, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 75, @@ -3837,7 +3753,7 @@ }, "end": { "line": 75, - "column": 29 + "column": 27 } } }, @@ -5578,35 +5494,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 104, - "column": 22 - }, - "end": { - "line": 104, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 104, - "column": 22 - }, - "end": { - "line": 104, - "column": 28 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 104, @@ -5614,7 +5502,7 @@ }, "end": { "line": 104, - "column": 28 + "column": 26 } } }, @@ -7270,35 +7158,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 132, - "column": 23 - }, - "end": { - "line": 132, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 132, - "column": 23 - }, - "end": { - "line": 132, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 132, @@ -7306,7 +7166,7 @@ }, "end": { "line": 132, - "column": 29 + "column": 27 } } }, @@ -8877,35 +8737,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 159, - "column": 24 - }, - "end": { - "line": 159, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 159, - "column": 24 - }, - "end": { - "line": 159, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 159, @@ -8913,7 +8745,7 @@ }, "end": { "line": 159, - "column": 30 + "column": 28 } } }, @@ -10399,35 +10231,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 185, - "column": 25 - }, - "end": { - "line": 185, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 185, - "column": 25 - }, - "end": { - "line": 185, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 185, @@ -10435,7 +10239,7 @@ }, "end": { "line": 185, - "column": 31 + "column": 29 } } }, @@ -11836,35 +11640,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 210, - "column": 26 - }, - "end": { - "line": 210, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 210, - "column": 26 - }, - "end": { - "line": 210, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 210, @@ -11872,7 +11648,7 @@ }, "end": { "line": 210, - "column": 32 + "column": 30 } } }, diff --git a/ets2panda/test/parser/ets/cast_expressions10-expected.txt b/ets2panda/test/parser/ets/cast_expressions10-expected.txt index abe87272b5..675a2ef3ed 100644 --- a/ets2panda/test/parser/ets/cast_expressions10-expected.txt +++ b/ets2panda/test/parser/ets/cast_expressions10-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/cast_expressions2-expected.txt b/ets2panda/test/parser/ets/cast_expressions2-expected.txt index 049b371ae5..ce5e20b348 100644 --- a/ets2panda/test/parser/ets/cast_expressions2-expected.txt +++ b/ets2panda/test/parser/ets/cast_expressions2-expected.txt @@ -436,35 +436,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 38 - }, - "end": { - "line": 19, - "column": 42 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 38 - }, - "end": { - "line": 19, - "column": 44 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -472,7 +444,7 @@ }, "end": { "line": 19, - "column": 44 + "column": 42 } } }, diff --git a/ets2panda/test/parser/ets/cast_expressions3-expected.txt b/ets2panda/test/parser/ets/cast_expressions3-expected.txt index f62c2b7548..7de2b73f5a 100644 --- a/ets2panda/test/parser/ets/cast_expressions3-expected.txt +++ b/ets2panda/test/parser/ets/cast_expressions3-expected.txt @@ -751,35 +751,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 37 - }, - "end": { - "line": 21, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 37 - }, - "end": { - "line": 21, - "column": 43 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -787,7 +759,7 @@ }, "end": { "line": 21, - "column": 43 + "column": 41 } } }, diff --git a/ets2panda/test/parser/ets/cast_expressions4-expected.txt b/ets2panda/test/parser/ets/cast_expressions4-expected.txt index eae98bf4d8..5b61e4ac10 100644 --- a/ets2panda/test/parser/ets/cast_expressions4-expected.txt +++ b/ets2panda/test/parser/ets/cast_expressions4-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 33 - }, - "end": { - "line": 16, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 33 - }, - "end": { - "line": 16, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 39 + "column": 37 } } }, diff --git a/ets2panda/test/parser/ets/cast_expressions5-expected.txt b/ets2panda/test/parser/ets/cast_expressions5-expected.txt index e68c5b2871..4ceb6d64d9 100644 --- a/ets2panda/test/parser/ets/cast_expressions5-expected.txt +++ b/ets2panda/test/parser/ets/cast_expressions5-expected.txt @@ -117,35 +117,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 13 - }, - "end": { - "line": 25, - "column": 17 - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 13 - }, - "end": { - "line": 25, - "column": 19 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 25, @@ -153,7 +125,7 @@ }, "end": { "line": 25, - "column": 19 + "column": 17 } } }, diff --git a/ets2panda/test/parser/ets/cast_expressions6-expected.txt b/ets2panda/test/parser/ets/cast_expressions6-expected.txt deleted file mode 100644 index 3ea0bddc37..0000000000 --- a/ets2panda/test/parser/ets/cast_expressions6-expected.txt +++ /dev/null @@ -1 +0,0 @@ -Failed to open file: /home/snail/wdir/arkruntime/static_core/tools/es2panda/test/parser/ets/cast_expressions6.ets diff --git a/ets2panda/test/parser/ets/cast_expressions7-expected.txt b/ets2panda/test/parser/ets/cast_expressions7-expected.txt index 6fe26ccff2..dd9a166df4 100644 --- a/ets2panda/test/parser/ets/cast_expressions7-expected.txt +++ b/ets2panda/test/parser/ets/cast_expressions7-expected.txt @@ -476,35 +476,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -512,7 +484,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/cast_expressions8-expected.txt b/ets2panda/test/parser/ets/cast_expressions8-expected.txt index 7ae471b150..79c8c35503 100644 --- a/ets2panda/test/parser/ets/cast_expressions8-expected.txt +++ b/ets2panda/test/parser/ets/cast_expressions8-expected.txt @@ -476,35 +476,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -512,7 +484,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/cast_expressions9-expected.txt b/ets2panda/test/parser/ets/cast_expressions9-expected.txt index 4eb28ca4f9..c19cf1255b 100644 --- a/ets2panda/test/parser/ets/cast_expressions9-expected.txt +++ b/ets2panda/test/parser/ets/cast_expressions9-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/class_composite_1-expected.txt b/ets2panda/test/parser/ets/class_composite_1-expected.txt index f386c4a28e..e7de54e8cf 100644 --- a/ets2panda/test/parser/ets/class_composite_1-expected.txt +++ b/ets2panda/test/parser/ets/class_composite_1-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/conditionalExpressionType-expected.txt b/ets2panda/test/parser/ets/conditionalExpressionType-expected.txt index a3046e47c1..e692c9c1f4 100644 --- a/ets2panda/test/parser/ets/conditionalExpressionType-expected.txt +++ b/ets2panda/test/parser/ets/conditionalExpressionType-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 27 - }, - "end": { - "line": 16, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 27 - }, - "end": { - "line": 16, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 32 + "column": 31 } } }, @@ -1551,35 +1523,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 39, - "column": 27 - }, - "end": { - "line": 39, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 39, - "column": 27 - }, - "end": { - "line": 39, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 39, @@ -1587,7 +1531,7 @@ }, "end": { "line": 39, - "column": 32 + "column": 31 } } }, @@ -2229,35 +2173,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 49, - "column": 34 - }, - "end": { - "line": 49, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 49, - "column": 34 - }, - "end": { - "line": 49, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 49, @@ -2265,7 +2181,7 @@ }, "end": { "line": 49, - "column": 39 + "column": 38 } } }, @@ -3496,35 +3412,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 66, - "column": 18 - }, - "end": { - "line": 66, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 66, - "column": 18 - }, - "end": { - "line": 66, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 66, @@ -3532,7 +3420,7 @@ }, "end": { "line": 66, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/continue-expected.txt b/ets2panda/test/parser/ets/continue-expected.txt index 264fa69017..7ed4b554ab 100644 --- a/ets2panda/test/parser/ets/continue-expected.txt +++ b/ets2panda/test/parser/ets/continue-expected.txt @@ -324,35 +324,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -360,7 +332,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/declare_class-expected.txt b/ets2panda/test/parser/ets/declare_class-expected.txt index 4e26b0f345..315d1e681a 100644 --- a/ets2panda/test/parser/ets/declare_class-expected.txt +++ b/ets2panda/test/parser/ets/declare_class-expected.txt @@ -399,43 +399,15 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 28 - }, - "end": { - "line": 20, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 28 - }, - "end": { - "line": 21, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, "column": 28 }, "end": { - "line": 21, - "column": 2 + "line": 20, + "column": 32 } } }, diff --git a/ets2panda/test/parser/ets/declare_class_bad_2-expected.txt b/ets2panda/test/parser/ets/declare_class_bad_2-expected.txt index 8fc27406b6..478bf5c3e0 100644 --- a/ets2panda/test/parser/ets/declare_class_bad_2-expected.txt +++ b/ets2panda/test/parser/ets/declare_class_bad_2-expected.txt @@ -215,35 +215,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 21 - }, - "end": { - "line": 18, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 21 - }, - "end": { - "line": 18, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -251,7 +223,7 @@ }, "end": { "line": 18, - "column": 27 + "column": 25 } } }, diff --git a/ets2panda/test/parser/ets/declare_class_bad_4-expected.txt b/ets2panda/test/parser/ets/declare_class_bad_4-expected.txt index beb867b7c5..f39eb8db4d 100644 --- a/ets2panda/test/parser/ets/declare_class_bad_4-expected.txt +++ b/ets2panda/test/parser/ets/declare_class_bad_4-expected.txt @@ -215,35 +215,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 28 - }, - "end": { - "line": 18, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 28 - }, - "end": { - "line": 18, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -251,7 +223,7 @@ }, "end": { "line": 18, - "column": 34 + "column": 32 } } }, diff --git a/ets2panda/test/parser/ets/declare_func-expected.txt b/ets2panda/test/parser/ets/declare_func-expected.txt index 69f6f0f38f..1f61843eba 100644 --- a/ets2panda/test/parser/ets/declare_func-expected.txt +++ b/ets2panda/test/parser/ets/declare_func-expected.txt @@ -232,35 +232,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 34 - }, - "end": { - "line": 16, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 34 - }, - "end": { - "line": 16, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -268,7 +240,7 @@ }, "end": { "line": 16, - "column": 39 + "column": 38 } } }, diff --git a/ets2panda/test/parser/ets/declare_func_bad-expected.txt b/ets2panda/test/parser/ets/declare_func_bad-expected.txt index a0e4a781ed..257a5d68b1 100644 --- a/ets2panda/test/parser/ets/declare_func_bad-expected.txt +++ b/ets2panda/test/parser/ets/declare_func_bad-expected.txt @@ -232,35 +232,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 34 - }, - "end": { - "line": 16, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 34 - }, - "end": { - "line": 16, - "column": 40 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -268,7 +240,7 @@ }, "end": { "line": 16, - "column": 40 + "column": 38 } } }, diff --git a/ets2panda/test/parser/ets/declare_iface-expected.txt b/ets2panda/test/parser/ets/declare_iface-expected.txt index db0f6ba96b..22390e70af 100644 --- a/ets2panda/test/parser/ets/declare_iface-expected.txt +++ b/ets2panda/test/parser/ets/declare_iface-expected.txt @@ -929,35 +929,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 28 - }, - "end": { - "line": 19, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 28 - }, - "end": { - "line": 19, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -965,7 +937,7 @@ }, "end": { "line": 19, - "column": 33 + "column": 32 } } }, @@ -977,7 +949,7 @@ }, "end": { "line": 19, - "column": 33 + "column": 32 } } }, @@ -988,7 +960,7 @@ }, "end": { "line": 19, - "column": 33 + "column": 32 } } }, diff --git a/ets2panda/test/parser/ets/declare_namespace_2-expected.txt b/ets2panda/test/parser/ets/declare_namespace_2-expected.txt index ef0198eda6..727d59cfb7 100644 --- a/ets2panda/test/parser/ets/declare_namespace_2-expected.txt +++ b/ets2panda/test/parser/ets/declare_namespace_2-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 11 - }, - "end": { - "line": 17, - "column": 15 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 11 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 16 + "column": 15 } } }, diff --git a/ets2panda/test/parser/ets/default_parameter1-expected.txt b/ets2panda/test/parser/ets/default_parameter1-expected.txt index c5a652b4ed..bb6ecdb874 100644 --- a/ets2panda/test/parser/ets/default_parameter1-expected.txt +++ b/ets2panda/test/parser/ets/default_parameter1-expected.txt @@ -162,43 +162,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 17, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, "column": 19 }, "end": { - "line": 17, - "column": 2 + "line": 16, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/default_parameter10-expected.txt b/ets2panda/test/parser/ets/default_parameter10-expected.txt index 59f1454654..6798d5e677 100644 --- a/ets2panda/test/parser/ets/default_parameter10-expected.txt +++ b/ets2panda/test/parser/ets/default_parameter10-expected.txt @@ -752,35 +752,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -788,7 +760,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/default_parameter2-expected.txt b/ets2panda/test/parser/ets/default_parameter2-expected.txt index f47cb840b0..039f2275c5 100644 --- a/ets2panda/test/parser/ets/default_parameter2-expected.txt +++ b/ets2panda/test/parser/ets/default_parameter2-expected.txt @@ -162,43 +162,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 17, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, "column": 19 }, "end": { - "line": 17, - "column": 2 + "line": 16, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/default_parameter4-expected.txt b/ets2panda/test/parser/ets/default_parameter4-expected.txt index 454bc6306f..20c060ec16 100644 --- a/ets2panda/test/parser/ets/default_parameter4-expected.txt +++ b/ets2panda/test/parser/ets/default_parameter4-expected.txt @@ -162,43 +162,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 17, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, "column": 19 }, "end": { - "line": 17, - "column": 2 + "line": 16, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/default_parameter5-expected.txt b/ets2panda/test/parser/ets/default_parameter5-expected.txt index ae851a1e80..57397b7813 100644 --- a/ets2panda/test/parser/ets/default_parameter5-expected.txt +++ b/ets2panda/test/parser/ets/default_parameter5-expected.txt @@ -162,43 +162,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 17, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, "column": 19 }, "end": { - "line": 17, - "column": 2 + "line": 16, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/default_parameter8-expected.txt b/ets2panda/test/parser/ets/default_parameter8-expected.txt index d8744e7aa6..3e0e3dda6c 100644 --- a/ets2panda/test/parser/ets/default_parameter8-expected.txt +++ b/ets2panda/test/parser/ets/default_parameter8-expected.txt @@ -1196,35 +1196,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 39 - }, - "end": { - "line": 30, - "column": 43 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 39 - }, - "end": { - "line": 30, - "column": 45 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 30, @@ -1232,7 +1204,7 @@ }, "end": { "line": 30, - "column": 45 + "column": 43 } } }, @@ -1405,35 +1377,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 39 - }, - "end": { - "line": 30, - "column": 43 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 39 - }, - "end": { - "line": 30, - "column": 45 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 30, @@ -1441,7 +1385,7 @@ }, "end": { "line": 30, - "column": 45 + "column": 43 } } }, @@ -2529,35 +2473,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 41, - "column": 18 - }, - "end": { - "line": 41, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 41, - "column": 18 - }, - "end": { - "line": 41, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 41, @@ -2565,7 +2481,7 @@ }, "end": { "line": 41, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/default_parameter_implicitly_typed_return_void-expected.txt b/ets2panda/test/parser/ets/default_parameter_implicitly_typed_return_void-expected.txt index e61275c82a..8495f52fa2 100644 --- a/ets2panda/test/parser/ets/default_parameter_implicitly_typed_return_void-expected.txt +++ b/ets2panda/test/parser/ets/default_parameter_implicitly_typed_return_void-expected.txt @@ -1162,35 +1162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -1198,7 +1170,7 @@ }, "end": { "line": 20, - "column": 23 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/dynamic_import_tests/modules/module-expected.txt b/ets2panda/test/parser/ets/dynamic_import_tests/modules/module-expected.txt index 63103e5c36..9e690fd0d3 100644 --- a/ets2panda/test/parser/ets/dynamic_import_tests/modules/module-expected.txt +++ b/ets2panda/test/parser/ets/dynamic_import_tests/modules/module-expected.txt @@ -1221,35 +1221,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 36 - }, - "end": { - "line": 16, - "column": 40 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 36 - }, - "end": { - "line": 16, - "column": 41 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -1257,7 +1229,7 @@ }, "end": { "line": 16, - "column": 41 + "column": 40 } } }, diff --git a/ets2panda/test/parser/ets/empty_statement-expected.txt b/ets2panda/test/parser/ets/empty_statement-expected.txt index 2e225881a5..786d08768d 100644 --- a/ets2panda/test/parser/ets/empty_statement-expected.txt +++ b/ets2panda/test/parser/ets/empty_statement-expected.txt @@ -257,35 +257,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 21 - }, - "end": { - "line": 20, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 21 - }, - "end": { - "line": 20, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -293,7 +265,7 @@ }, "end": { "line": 20, - "column": 27 + "column": 25 } } }, @@ -747,35 +719,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 20 - }, - "end": { - "line": 31, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 20 - }, - "end": { - "line": 31, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 31, @@ -783,7 +727,7 @@ }, "end": { "line": 31, - "column": 26 + "column": 24 } } }, diff --git a/ets2panda/test/parser/ets/enum-expected.txt b/ets2panda/test/parser/ets/enum-expected.txt index edcd158548..6d15e922e1 100644 --- a/ets2panda/test/parser/ets/enum-expected.txt +++ b/ets2panda/test/parser/ets/enum-expected.txt @@ -922,35 +922,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 18 - }, - "end": { - "line": 29, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 18 - }, - "end": { - "line": 29, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 29, @@ -958,7 +930,7 @@ }, "end": { "line": 29, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/enum10-expected.txt b/ets2panda/test/parser/ets/enum10-expected.txt index 1f526c797d..fa67a817c6 100644 --- a/ets2panda/test/parser/ets/enum10-expected.txt +++ b/ets2panda/test/parser/ets/enum10-expected.txt @@ -235,35 +235,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -271,7 +243,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/enum11-expected.txt b/ets2panda/test/parser/ets/enum11-expected.txt index e656ffec58..d7ffef1db5 100644 --- a/ets2panda/test/parser/ets/enum11-expected.txt +++ b/ets2panda/test/parser/ets/enum11-expected.txt @@ -235,35 +235,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -271,7 +243,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/enum12-expected.txt b/ets2panda/test/parser/ets/enum12-expected.txt index a3cb3a471a..1a5cbc8ee2 100644 --- a/ets2panda/test/parser/ets/enum12-expected.txt +++ b/ets2panda/test/parser/ets/enum12-expected.txt @@ -305,35 +305,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -341,7 +313,7 @@ }, "end": { "line": 18, - "column": 32 + "column": 30 } } }, @@ -703,35 +675,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 18 - }, - "end": { - "line": 23, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 18 - }, - "end": { - "line": 23, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -739,7 +683,7 @@ }, "end": { "line": 23, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/enum13-expected.txt b/ets2panda/test/parser/ets/enum13-expected.txt index e9357392f7..440ba7ece9 100644 --- a/ets2panda/test/parser/ets/enum13-expected.txt +++ b/ets2panda/test/parser/ets/enum13-expected.txt @@ -305,35 +305,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -341,7 +313,7 @@ }, "end": { "line": 18, - "column": 37 + "column": 30 } } }, @@ -762,35 +734,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 18 - }, - "end": { - "line": 23, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 18 - }, - "end": { - "line": 23, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -798,7 +742,7 @@ }, "end": { "line": 23, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/enum14-expected.txt b/ets2panda/test/parser/ets/enum14-expected.txt index 44f44c38ca..5be5600c5a 100644 --- a/ets2panda/test/parser/ets/enum14-expected.txt +++ b/ets2panda/test/parser/ets/enum14-expected.txt @@ -319,35 +319,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -355,7 +327,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/enum20-expected.txt b/ets2panda/test/parser/ets/enum20-expected.txt index ddbf6ffb3d..d698d023f3 100644 --- a/ets2panda/test/parser/ets/enum20-expected.txt +++ b/ets2panda/test/parser/ets/enum20-expected.txt @@ -361,35 +361,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -397,7 +369,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/enum6-expected.txt b/ets2panda/test/parser/ets/enum6-expected.txt index 7c44fc1e79..ce893e1c8d 100644 --- a/ets2panda/test/parser/ets/enum6-expected.txt +++ b/ets2panda/test/parser/ets/enum6-expected.txt @@ -319,35 +319,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -355,7 +327,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/enum7-expected.txt b/ets2panda/test/parser/ets/enum7-expected.txt index 1d1053bc24..e1126efa6a 100644 --- a/ets2panda/test/parser/ets/enum7-expected.txt +++ b/ets2panda/test/parser/ets/enum7-expected.txt @@ -308,35 +308,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -344,7 +316,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/enum8-expected.txt b/ets2panda/test/parser/ets/enum8-expected.txt index 150b136c75..5efdb564d0 100644 --- a/ets2panda/test/parser/ets/enum8-expected.txt +++ b/ets2panda/test/parser/ets/enum8-expected.txt @@ -308,35 +308,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -344,7 +316,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/enum9-expected.txt b/ets2panda/test/parser/ets/enum9-expected.txt index 425b1e8380..413451bfb4 100644 --- a/ets2panda/test/parser/ets/enum9-expected.txt +++ b/ets2panda/test/parser/ets/enum9-expected.txt @@ -235,35 +235,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -271,7 +243,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/exports-expected.txt b/ets2panda/test/parser/ets/exports-expected.txt index aaceffc96d..594900d4d1 100644 --- a/ets2panda/test/parser/ets/exports-expected.txt +++ b/ets2panda/test/parser/ets/exports-expected.txt @@ -540,35 +540,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 22 - }, - "end": { - "line": 19, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 22 - }, - "end": { - "line": 19, - "column": 28 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -576,7 +548,7 @@ }, "end": { "line": 19, - "column": 28 + "column": 26 } } }, diff --git a/ets2panda/test/parser/ets/for_of-expected.txt b/ets2panda/test/parser/ets/for_of-expected.txt index cef1c5eec2..9e1618b223 100644 --- a/ets2panda/test/parser/ets/for_of-expected.txt +++ b/ets2panda/test/parser/ets/for_of-expected.txt @@ -324,35 +324,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -360,7 +332,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/for_of_02-expected.txt b/ets2panda/test/parser/ets/for_of_02-expected.txt index adcd757016..cfbec4291d 100644 --- a/ets2panda/test/parser/ets/for_of_02-expected.txt +++ b/ets2panda/test/parser/ets/for_of_02-expected.txt @@ -588,35 +588,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 18 - }, - "end": { - "line": 25, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 18 - }, - "end": { - "line": 25, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 25, @@ -624,7 +596,7 @@ }, "end": { "line": 25, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/for_with_break-expected.txt b/ets2panda/test/parser/ets/for_with_break-expected.txt index ec654926a4..1434443754 100644 --- a/ets2panda/test/parser/ets/for_with_break-expected.txt +++ b/ets2panda/test/parser/ets/for_with_break-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/functionThrowsRethrows-expected.txt b/ets2panda/test/parser/ets/functionThrowsRethrows-expected.txt index 58d47fb3f6..2f1584bc25 100644 --- a/ets2panda/test/parser/ets/functionThrowsRethrows-expected.txt +++ b/ets2panda/test/parser/ets/functionThrowsRethrows-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 37 + "column": 30 } } }, @@ -548,35 +520,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 75 - }, - "end": { - "line": 20, - "column": 79 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 75 - }, - "end": { - "line": 20, - "column": 88 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -584,7 +528,7 @@ }, "end": { "line": 20, - "column": 88 + "column": 79 } } }, diff --git a/ets2panda/test/parser/ets/function_implicit_return_type4-expected.txt b/ets2panda/test/parser/ets/function_implicit_return_type4-expected.txt index 371c602d96..9630d641f0 100644 --- a/ets2panda/test/parser/ets/function_implicit_return_type4-expected.txt +++ b/ets2panda/test/parser/ets/function_implicit_return_type4-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -104,7 +76,7 @@ }, "end": { "line": 18, - "column": 23 + "column": 21 } } }, diff --git a/ets2panda/test/parser/ets/generic_error-expected.txt b/ets2panda/test/parser/ets/generic_error-expected.txt index 11e1c94b0e..b5b8f7d389 100644 --- a/ets2panda/test/parser/ets/generic_error-expected.txt +++ b/ets2panda/test/parser/ets/generic_error-expected.txt @@ -605,35 +605,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -641,7 +613,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/generic_resolve-expected.txt b/ets2panda/test/parser/ets/generic_resolve-expected.txt index ee62b20b1c..11a66547e8 100644 --- a/ets2panda/test/parser/ets/generic_resolve-expected.txt +++ b/ets2panda/test/parser/ets/generic_resolve-expected.txt @@ -598,35 +598,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 23 - }, - "end": { - "line": 22, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 23 - }, - "end": { - "line": 22, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -634,7 +606,7 @@ }, "end": { "line": 22, - "column": 29 + "column": 27 } } }, @@ -645,7 +617,7 @@ }, "end": { "line": 22, - "column": 29 + "column": 27 } } }, @@ -671,35 +643,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 34 - }, - "end": { - "line": 22, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 34 - }, - "end": { - "line": 22, - "column": 41 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -707,7 +651,7 @@ }, "end": { "line": 22, - "column": 41 + "column": 38 } } }, @@ -1167,35 +1111,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 39 - }, - "end": { - "line": 29, - "column": 43 - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 39 - }, - "end": { - "line": 29, - "column": 44 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 29, @@ -1203,7 +1119,7 @@ }, "end": { "line": 29, - "column": 44 + "column": 43 } } }, diff --git a/ets2panda/test/parser/ets/generics_1-expected.txt b/ets2panda/test/parser/ets/generics_1-expected.txt index d8e381e5d7..66c0a6a597 100644 --- a/ets2panda/test/parser/ets/generics_1-expected.txt +++ b/ets2panda/test/parser/ets/generics_1-expected.txt @@ -932,35 +932,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -968,7 +940,7 @@ }, "end": { "line": 28, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/generics_3-expected.txt b/ets2panda/test/parser/ets/generics_3-expected.txt index ae48670b0f..8b846727c5 100644 --- a/ets2panda/test/parser/ets/generics_3-expected.txt +++ b/ets2panda/test/parser/ets/generics_3-expected.txt @@ -454,35 +454,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -490,7 +462,7 @@ }, "end": { "line": 16, - "column": 36 + "column": 34 } } }, @@ -632,35 +604,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -668,7 +612,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/generics_4-expected.txt b/ets2panda/test/parser/ets/generics_4-expected.txt index 48bf1bd9de..920dce1f09 100644 --- a/ets2panda/test/parser/ets/generics_4-expected.txt +++ b/ets2panda/test/parser/ets/generics_4-expected.txt @@ -482,35 +482,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -518,7 +490,7 @@ }, "end": { "line": 16, - "column": 36 + "column": 34 } } }, @@ -660,35 +632,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -696,7 +640,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/generics_5-expected.txt b/ets2panda/test/parser/ets/generics_5-expected.txt index 4c53dbd8ee..206b61b747 100644 --- a/ets2panda/test/parser/ets/generics_5-expected.txt +++ b/ets2panda/test/parser/ets/generics_5-expected.txt @@ -426,35 +426,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -462,7 +434,7 @@ }, "end": { "line": 16, - "column": 36 + "column": 34 } } }, @@ -604,35 +576,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -640,7 +584,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/generics_6-expected.txt b/ets2panda/test/parser/ets/generics_6-expected.txt index 83fc825712..d3e777687c 100644 --- a/ets2panda/test/parser/ets/generics_6-expected.txt +++ b/ets2panda/test/parser/ets/generics_6-expected.txt @@ -634,35 +634,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -670,7 +642,7 @@ }, "end": { "line": 16, - "column": 36 + "column": 34 } } }, @@ -812,35 +784,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -848,7 +792,7 @@ }, "end": { "line": 21, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/generics_7-expected.txt b/ets2panda/test/parser/ets/generics_7-expected.txt index 6761af939b..48621af4d9 100644 --- a/ets2panda/test/parser/ets/generics_7-expected.txt +++ b/ets2panda/test/parser/ets/generics_7-expected.txt @@ -634,35 +634,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -670,7 +642,7 @@ }, "end": { "line": 16, - "column": 36 + "column": 34 } } }, @@ -812,35 +784,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -848,7 +792,7 @@ }, "end": { "line": 21, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/generics_type_param_constraint_10-expected.txt b/ets2panda/test/parser/ets/generics_type_param_constraint_10-expected.txt index 5d2baa5275..4e65fd62c6 100644 --- a/ets2panda/test/parser/ets/generics_type_param_constraint_10-expected.txt +++ b/ets2panda/test/parser/ets/generics_type_param_constraint_10-expected.txt @@ -536,35 +536,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -572,7 +544,7 @@ }, "end": { "line": 21, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/generics_type_param_constraint_4-expected.txt b/ets2panda/test/parser/ets/generics_type_param_constraint_4-expected.txt index c01abfe35c..af0880a852 100644 --- a/ets2panda/test/parser/ets/generics_type_param_constraint_4-expected.txt +++ b/ets2panda/test/parser/ets/generics_type_param_constraint_4-expected.txt @@ -122,35 +122,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -158,7 +130,7 @@ }, "end": { "line": 18, - "column": 23 + "column": 22 } } }, @@ -170,7 +142,7 @@ }, "end": { "line": 18, - "column": 23 + "column": 22 } } }, @@ -181,7 +153,7 @@ }, "end": { "line": 18, - "column": 23 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/generics_type_param_constraint_5-expected.txt b/ets2panda/test/parser/ets/generics_type_param_constraint_5-expected.txt index fd54bd69e7..85dde51e85 100644 --- a/ets2panda/test/parser/ets/generics_type_param_constraint_5-expected.txt +++ b/ets2panda/test/parser/ets/generics_type_param_constraint_5-expected.txt @@ -122,35 +122,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -158,7 +130,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 23 } } }, @@ -170,7 +142,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 23 } } }, @@ -181,7 +153,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 23 } } }, @@ -314,35 +286,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 19 - }, - "end": { - "line": 19, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 19 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -350,7 +294,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 23 } } }, @@ -362,7 +306,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 23 } } }, @@ -373,7 +317,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/getter_setter_access_modifiers-expected.txt b/ets2panda/test/parser/ets/getter_setter_access_modifiers-expected.txt index 3412eacfea..927d1eea45 100644 --- a/ets2panda/test/parser/ets/getter_setter_access_modifiers-expected.txt +++ b/ets2panda/test/parser/ets/getter_setter_access_modifiers-expected.txt @@ -1067,35 +1067,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 35, - "column": 31 - }, - "end": { - "line": 35, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 35, - "column": 31 - }, - "end": { - "line": 35, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 35, @@ -1103,7 +1075,7 @@ }, "end": { "line": 35, - "column": 37 + "column": 35 } } }, @@ -1343,35 +1315,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 39, - "column": 33 - }, - "end": { - "line": 39, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 39, - "column": 33 - }, - "end": { - "line": 39, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 39, @@ -1379,7 +1323,7 @@ }, "end": { "line": 39, - "column": 39 + "column": 37 } } }, diff --git a/ets2panda/test/parser/ets/getter_setter_access_modifiers_2-expected.txt b/ets2panda/test/parser/ets/getter_setter_access_modifiers_2-expected.txt index ed873fe692..0126b23167 100644 --- a/ets2panda/test/parser/ets/getter_setter_access_modifiers_2-expected.txt +++ b/ets2panda/test/parser/ets/getter_setter_access_modifiers_2-expected.txt @@ -360,35 +360,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 29 - }, - "end": { - "line": 24, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 29 - }, - "end": { - "line": 24, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -396,7 +368,7 @@ }, "end": { "line": 24, - "column": 35 + "column": 33 } } }, @@ -911,35 +883,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 33, - "column": 32 - }, - "end": { - "line": 33, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 33, - "column": 32 - }, - "end": { - "line": 33, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 33, @@ -947,7 +891,7 @@ }, "end": { "line": 33, - "column": 38 + "column": 36 } } }, diff --git a/ets2panda/test/parser/ets/global_const_vars3-expected.txt b/ets2panda/test/parser/ets/global_const_vars3-expected.txt index e2c12eaa49..04e9ad0cdb 100644 --- a/ets2panda/test/parser/ets/global_const_vars3-expected.txt +++ b/ets2panda/test/parser/ets/global_const_vars3-expected.txt @@ -365,35 +365,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 20 - }, - "end": { - "line": 26, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 20 - }, - "end": { - "line": 26, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 26, @@ -401,7 +373,7 @@ }, "end": { "line": 26, - "column": 26 + "column": 24 } } }, diff --git a/ets2panda/test/parser/ets/global_const_vars4-expected.txt b/ets2panda/test/parser/ets/global_const_vars4-expected.txt index 8d67d403e8..effa949d28 100644 --- a/ets2panda/test/parser/ets/global_const_vars4-expected.txt +++ b/ets2panda/test/parser/ets/global_const_vars4-expected.txt @@ -366,35 +366,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 21 - }, - "end": { - "line": 23, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 21 - }, - "end": { - "line": 23, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -402,7 +374,7 @@ }, "end": { "line": 23, - "column": 27 + "column": 25 } } }, @@ -627,35 +599,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 20 - }, - "end": { - "line": 27, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 20 - }, - "end": { - "line": 27, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 27, @@ -663,7 +607,7 @@ }, "end": { "line": 27, - "column": 26 + "column": 24 } } }, diff --git a/ets2panda/test/parser/ets/if-expected.txt b/ets2panda/test/parser/ets/if-expected.txt index affe2d1603..fcf38d2ba6 100644 --- a/ets2panda/test/parser/ets/if-expected.txt +++ b/ets2panda/test/parser/ets/if-expected.txt @@ -208,35 +208,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -244,7 +216,7 @@ }, "end": { "line": 19, - "column": 27 + "column": 25 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/check_exported_1-expected.txt b/ets2panda/test/parser/ets/import_tests/check_exported_1-expected.txt index f5ea1ce217..87f7a08a7d 100644 --- a/ets2panda/test/parser/ets/import_tests/check_exported_1-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/check_exported_1-expected.txt @@ -219,35 +219,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -255,7 +227,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/default_import-expected.txt b/ets2panda/test/parser/ets/import_tests/default_import-expected.txt index e45d7ab4d7..e3b27802c8 100644 --- a/ets2panda/test/parser/ets/import_tests/default_import-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/default_import-expected.txt @@ -219,35 +219,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -255,7 +227,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/import_alias/export-expected.txt b/ets2panda/test/parser/ets/import_tests/import_alias/export-expected.txt index 03aa93b5c2..73374c4ffc 100644 --- a/ets2panda/test/parser/ets/import_tests/import_alias/export-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_alias/export-expected.txt @@ -737,35 +737,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 17 - }, - "end": { - "line": 24, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 17 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -773,7 +745,7 @@ }, "end": { "line": 24, - "column": 22 + "column": 21 } } }, @@ -872,35 +844,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 24 - }, - "end": { - "line": 26, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 24 - }, - "end": { - "line": 26, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 26, @@ -908,7 +852,7 @@ }, "end": { "line": 26, - "column": 29 + "column": 28 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_1-expected.txt b/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_1-expected.txt index 328f1e30a8..32ead5df1d 100644 --- a/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_1-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_1-expected.txt @@ -219,35 +219,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -255,7 +227,7 @@ }, "end": { "line": 18, - "column": 22 + "column": 21 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_2-expected.txt b/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_2-expected.txt index dc7b8c9484..1526e0d2d9 100644 --- a/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_2-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_2-expected.txt @@ -219,35 +219,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -255,7 +227,7 @@ }, "end": { "line": 18, - "column": 22 + "column": 21 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_3-expected.txt b/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_3-expected.txt index c68062b33a..9509e32c1c 100644 --- a/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_3-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_3-expected.txt @@ -219,35 +219,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -255,7 +227,7 @@ }, "end": { "line": 18, - "column": 22 + "column": 21 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_4-expected.txt b/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_4-expected.txt index 4695e9911c..1b65b4d63d 100644 --- a/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_4-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_alias/import_alias_4-expected.txt @@ -219,35 +219,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -255,7 +227,7 @@ }, "end": { "line": 18, - "column": 22 + "column": 21 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/import_alias_and_without_alias_1-expected.txt b/ets2panda/test/parser/ets/import_tests/import_alias_and_without_alias_1-expected.txt index 8c0b40cfd6..c1757bd21c 100644 --- a/ets2panda/test/parser/ets/import_tests/import_alias_and_without_alias_1-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_alias_and_without_alias_1-expected.txt @@ -291,35 +291,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 17 - }, - "end": { - "line": 19, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 17 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -327,7 +299,7 @@ }, "end": { "line": 19, - "column": 22 + "column": 21 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/import_alias_and_without_alias_2-expected.txt b/ets2panda/test/parser/ets/import_tests/import_alias_and_without_alias_2-expected.txt index d5602c785e..cfe800f574 100644 --- a/ets2panda/test/parser/ets/import_tests/import_alias_and_without_alias_2-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_alias_and_without_alias_2-expected.txt @@ -363,35 +363,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 17 - }, - "end": { - "line": 20, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 17 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -399,7 +371,7 @@ }, "end": { "line": 20, - "column": 22 + "column": 21 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/import_alias_and_without_alias_3-expected.txt b/ets2panda/test/parser/ets/import_tests/import_alias_and_without_alias_3-expected.txt index 4f64d58163..f4d8f9abdd 100644 --- a/ets2panda/test/parser/ets/import_tests/import_alias_and_without_alias_3-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_alias_and_without_alias_3-expected.txt @@ -363,35 +363,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 17 - }, - "end": { - "line": 20, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 17 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -399,7 +371,7 @@ }, "end": { "line": 20, - "column": 22 + "column": 21 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/import_all_2-expected.txt b/ets2panda/test/parser/ets/import_tests/import_all_2-expected.txt index 279b5c3a73..0d780421cc 100644 --- a/ets2panda/test/parser/ets/import_tests/import_all_2-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_all_2-expected.txt @@ -219,35 +219,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -255,7 +227,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/import_all_3-expected.txt b/ets2panda/test/parser/ets/import_tests/import_all_3-expected.txt index d69502a277..99120e764e 100644 --- a/ets2panda/test/parser/ets/import_tests/import_all_3-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_all_3-expected.txt @@ -219,35 +219,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -255,7 +227,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/import_extension/import_extension-expected.txt b/ets2panda/test/parser/ets/import_tests/import_extension/import_extension-expected.txt index 64c376b204..0d7ca70fb1 100644 --- a/ets2panda/test/parser/ets/import_tests/import_extension/import_extension-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_extension/import_extension-expected.txt @@ -306,35 +306,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -342,7 +314,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/import_max_as_alias-expected.txt b/ets2panda/test/parser/ets/import_tests/import_max_as_alias-expected.txt index 12beab65ee..d7c4a9587b 100644 --- a/ets2panda/test/parser/ets/import_tests/import_max_as_alias-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_max_as_alias-expected.txt @@ -234,35 +234,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -270,7 +242,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/import_ts_file-expected.txt b/ets2panda/test/parser/ets/import_tests/import_ts_file-expected.txt index f1c34221ae..05e50f8402 100644 --- a/ets2panda/test/parser/ets/import_tests/import_ts_file-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_ts_file-expected.txt @@ -234,35 +234,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -270,7 +242,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/modules/default_export-expected.txt b/ets2panda/test/parser/ets/import_tests/modules/default_export-expected.txt index 7b52eccf53..4407e0da8d 100644 --- a/ets2panda/test/parser/ets/import_tests/modules/default_export-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/modules/default_export-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 48 - }, - "end": { - "line": 16, - "column": 52 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 48 - }, - "end": { - "line": 16, - "column": 54 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 54 + "column": 52 } } }, @@ -297,35 +269,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 43 - }, - "end": { - "line": 18, - "column": 47 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 43 - }, - "end": { - "line": 18, - "column": 49 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -333,7 +277,7 @@ }, "end": { "line": 18, - "column": 49 + "column": 47 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/modules/missing_default_export-expected.txt b/ets2panda/test/parser/ets/import_tests/modules/missing_default_export-expected.txt index de79dcf431..1cb362a46f 100644 --- a/ets2panda/test/parser/ets/import_tests/modules/missing_default_export-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/modules/missing_default_export-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 29 - }, - "end": { - "line": 16, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 29 - }, - "end": { - "line": 16, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 35 + "column": 33 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/relative_import/Point-expected.txt b/ets2panda/test/parser/ets/import_tests/relative_import/Point-expected.txt index db8f03c2be..b6f39a4560 100644 --- a/ets2panda/test/parser/ets/import_tests/relative_import/Point-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/relative_import/Point-expected.txt @@ -597,35 +597,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 32 - }, - "end": { - "line": 25, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 32 - }, - "end": { - "line": 25, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 25, @@ -633,7 +605,7 @@ }, "end": { "line": 25, - "column": 38 + "column": 36 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/relative_import/alias2-expected.txt b/ets2panda/test/parser/ets/import_tests/relative_import/alias2-expected.txt index 0ce3e4dd86..37cfedf514 100644 --- a/ets2panda/test/parser/ets/import_tests/relative_import/alias2-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/relative_import/alias2-expected.txt @@ -500,35 +500,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 25 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 25 - }, - "end": { - "line": 18, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -536,7 +508,7 @@ }, "end": { "line": 18, - "column": 31 + "column": 29 } } }, diff --git a/ets2panda/test/parser/ets/inheritance2-expected.txt b/ets2panda/test/parser/ets/inheritance2-expected.txt index b6c70a83de..36af7ac4f9 100644 --- a/ets2panda/test/parser/ets/inheritance2-expected.txt +++ b/ets2panda/test/parser/ets/inheritance2-expected.txt @@ -830,35 +830,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -866,7 +838,7 @@ }, "end": { "line": 21, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/interface_method_default_body-expected.txt b/ets2panda/test/parser/ets/interface_method_default_body-expected.txt index 581f18ebb0..e4327c1dfb 100644 --- a/ets2panda/test/parser/ets/interface_method_default_body-expected.txt +++ b/ets2panda/test/parser/ets/interface_method_default_body-expected.txt @@ -52,35 +52,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 10 - }, - "end": { - "line": 17, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 10 - }, - "end": { - "line": 17, - "column": 15 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -88,7 +60,7 @@ }, "end": { "line": 17, - "column": 15 + "column": 14 } } }, @@ -100,7 +72,7 @@ }, "end": { "line": 17, - "column": 15 + "column": 14 } } }, @@ -111,7 +83,7 @@ }, "end": { "line": 17, - "column": 15 + "column": 14 } } }, @@ -218,35 +190,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -254,7 +198,7 @@ }, "end": { "line": 21, - "column": 16 + "column": 14 } } }, @@ -354,43 +298,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 10 - }, - "end": { - "line": 22, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 10 - }, - "end": { - "line": 23, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, "column": 10 }, "end": { - "line": 23, - "column": 2 + "line": 22, + "column": 14 } } }, @@ -401,8 +317,8 @@ "column": 6 }, "end": { - "line": 23, - "column": 2 + "line": 22, + "column": 14 } } }, @@ -412,8 +328,8 @@ "column": 6 }, "end": { - "line": 23, - "column": 2 + "line": 22, + "column": 14 } } }, @@ -425,8 +341,8 @@ "column": 3 }, "end": { - "line": 23, - "column": 2 + "line": 22, + "column": 14 } } } @@ -646,35 +562,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 10 - }, - "end": { - "line": 26, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 10 - }, - "end": { - "line": 26, - "column": 16 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 26, @@ -682,7 +570,7 @@ }, "end": { "line": 26, - "column": 16 + "column": 14 } } }, @@ -1012,35 +900,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 18 - }, - "end": { - "line": 29, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 18 - }, - "end": { - "line": 29, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 29, @@ -1048,7 +908,7 @@ }, "end": { "line": 29, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/interface_static_function_1-expected.txt b/ets2panda/test/parser/ets/interface_static_function_1-expected.txt index ed88c432e0..6d19156003 100644 --- a/ets2panda/test/parser/ets/interface_static_function_1-expected.txt +++ b/ets2panda/test/parser/ets/interface_static_function_1-expected.txt @@ -805,35 +805,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 32, @@ -841,7 +813,7 @@ }, "end": { "line": 32, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/interface_static_function_2-expected.txt b/ets2panda/test/parser/ets/interface_static_function_2-expected.txt index aaf46ac04d..e344174ceb 100644 --- a/ets2panda/test/parser/ets/interface_static_function_2-expected.txt +++ b/ets2panda/test/parser/ets/interface_static_function_2-expected.txt @@ -805,35 +805,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 32, @@ -841,7 +813,7 @@ }, "end": { "line": 32, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/interfaces-expected.txt b/ets2panda/test/parser/ets/interfaces-expected.txt index 5867d9032d..4c33267a11 100644 --- a/ets2panda/test/parser/ets/interfaces-expected.txt +++ b/ets2panda/test/parser/ets/interfaces-expected.txt @@ -934,35 +934,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -970,7 +942,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, @@ -1144,35 +1116,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 20 - }, - "end": { - "line": 23, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 20 - }, - "end": { - "line": 23, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -1180,7 +1124,7 @@ }, "end": { "line": 23, - "column": 26 + "column": 24 } } }, @@ -1280,35 +1224,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 16 - }, - "end": { - "line": 24, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 16 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -1316,7 +1232,7 @@ }, "end": { "line": 24, - "column": 22 + "column": 20 } } }, diff --git a/ets2panda/test/parser/ets/internalParsing-expected.txt b/ets2panda/test/parser/ets/internalParsing-expected.txt index a2fe1faccd..91c3639a74 100644 --- a/ets2panda/test/parser/ets/internalParsing-expected.txt +++ b/ets2panda/test/parser/ets/internalParsing-expected.txt @@ -514,35 +514,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 19 - }, - "end": { - "line": 25, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 19 - }, - "end": { - "line": 25, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 25, @@ -550,7 +522,7 @@ }, "end": { "line": 25, - "column": 25 + "column": 23 } } }, @@ -787,35 +759,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -823,7 +767,7 @@ }, "end": { "line": 28, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/internalProtectedParsing-expected.txt b/ets2panda/test/parser/ets/internalProtectedParsing-expected.txt index 9c8de543ac..ceeee9e6f7 100644 --- a/ets2panda/test/parser/ets/internalProtectedParsing-expected.txt +++ b/ets2panda/test/parser/ets/internalProtectedParsing-expected.txt @@ -723,35 +723,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 29 - }, - "end": { - "line": 29, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 29 - }, - "end": { - "line": 29, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 29, @@ -759,7 +731,7 @@ }, "end": { "line": 29, - "column": 35 + "column": 33 } } }, @@ -996,35 +968,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 32, @@ -1032,7 +976,7 @@ }, "end": { "line": 32, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/labeledDoWhileStatement-expected.txt b/ets2panda/test/parser/ets/labeledDoWhileStatement-expected.txt index bac5b0dde5..07b3af4cc8 100644 --- a/ets2panda/test/parser/ets/labeledDoWhileStatement-expected.txt +++ b/ets2panda/test/parser/ets/labeledDoWhileStatement-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 34 - }, - "end": { - "line": 16, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 34 - }, - "end": { - "line": 16, - "column": 40 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 40 + "column": 38 } } }, diff --git a/ets2panda/test/parser/ets/labeledForStatement-expected.txt b/ets2panda/test/parser/ets/labeledForStatement-expected.txt index cc597d92ce..49245fba59 100644 --- a/ets2panda/test/parser/ets/labeledForStatement-expected.txt +++ b/ets2panda/test/parser/ets/labeledForStatement-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 36 + "column": 34 } } }, diff --git a/ets2panda/test/parser/ets/labeledSwitchStatement-expected.txt b/ets2panda/test/parser/ets/labeledSwitchStatement-expected.txt index a8ffaf63a7..3dd740a25f 100644 --- a/ets2panda/test/parser/ets/labeledSwitchStatement-expected.txt +++ b/ets2panda/test/parser/ets/labeledSwitchStatement-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 33 - }, - "end": { - "line": 16, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 33 - }, - "end": { - "line": 16, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 39 + "column": 37 } } }, @@ -956,35 +928,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 36, - "column": 33 - }, - "end": { - "line": 36, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 36, - "column": 33 - }, - "end": { - "line": 36, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 36, @@ -992,7 +936,7 @@ }, "end": { "line": 36, - "column": 39 + "column": 37 } } }, diff --git a/ets2panda/test/parser/ets/labeledWhileStatement-expected.txt b/ets2panda/test/parser/ets/labeledWhileStatement-expected.txt index c7ac60a0ea..ed679bcd28 100644 --- a/ets2panda/test/parser/ets/labeledWhileStatement-expected.txt +++ b/ets2panda/test/parser/ets/labeledWhileStatement-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 32 - }, - "end": { - "line": 16, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 32 - }, - "end": { - "line": 16, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 38 + "column": 36 } } }, diff --git a/ets2panda/test/parser/ets/lambda-expected.txt b/ets2panda/test/parser/ets/lambda-expected.txt index 7110e93662..9bae6d8f2a 100644 --- a/ets2panda/test/parser/ets/lambda-expected.txt +++ b/ets2panda/test/parser/ets/lambda-expected.txt @@ -240,35 +240,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 41 - }, - "end": { - "line": 16, - "column": 45 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 41 - }, - "end": { - "line": 16, - "column": 46 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -276,7 +248,7 @@ }, "end": { "line": 16, - "column": 46 + "column": 45 } } }, @@ -287,7 +259,7 @@ }, "end": { "line": 16, - "column": 46 + "column": 45 } } }, @@ -299,7 +271,7 @@ }, "end": { "line": 16, - "column": 46 + "column": 45 } } }, @@ -310,41 +282,13 @@ }, "end": { "line": 16, - "column": 46 + "column": 45 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 48 - }, - "end": { - "line": 16, - "column": 52 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 48 - }, - "end": { - "line": 16, - "column": 54 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -352,7 +296,7 @@ }, "end": { "line": 16, - "column": 54 + "column": 52 } } }, @@ -510,35 +454,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -546,7 +462,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, @@ -653,35 +569,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -689,7 +577,7 @@ }, "end": { "line": 21, - "column": 31 + "column": 28 } } }, diff --git a/ets2panda/test/parser/ets/lambda-lambda-expected.txt b/ets2panda/test/parser/ets/lambda-lambda-expected.txt index a6897819c1..715e50ec4b 100644 --- a/ets2panda/test/parser/ets/lambda-lambda-expected.txt +++ b/ets2panda/test/parser/ets/lambda-lambda-expected.txt @@ -220,35 +220,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 48 - }, - "end": { - "line": 16, - "column": 52 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 48 - }, - "end": { - "line": 16, - "column": 53 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -256,7 +228,7 @@ }, "end": { "line": 16, - "column": 53 + "column": 52 } } }, @@ -267,7 +239,7 @@ }, "end": { "line": 16, - "column": 53 + "column": 52 } } }, @@ -279,7 +251,7 @@ }, "end": { "line": 16, - "column": 53 + "column": 52 } } }, @@ -290,41 +262,13 @@ }, "end": { "line": 16, - "column": 53 + "column": 52 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 57 - }, - "end": { - "line": 16, - "column": 61 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 57 - }, - "end": { - "line": 16, - "column": 62 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -332,7 +276,7 @@ }, "end": { "line": 16, - "column": 62 + "column": 61 } } }, @@ -343,7 +287,7 @@ }, "end": { "line": 16, - "column": 62 + "column": 61 } } }, @@ -355,7 +299,7 @@ }, "end": { "line": 16, - "column": 62 + "column": 61 } } }, @@ -366,41 +310,13 @@ }, "end": { "line": 16, - "column": 62 + "column": 61 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 64 - }, - "end": { - "line": 16, - "column": 68 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 64 - }, - "end": { - "line": 16, - "column": 70 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -408,7 +324,7 @@ }, "end": { "line": 16, - "column": 70 + "column": 68 } } }, @@ -507,35 +423,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -543,7 +431,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, @@ -630,35 +518,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 33 - }, - "end": { - "line": 20, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 33 - }, - "end": { - "line": 20, - "column": 38 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -666,7 +526,7 @@ }, "end": { "line": 20, - "column": 38 + "column": 37 } } }, @@ -677,7 +537,7 @@ }, "end": { "line": 20, - "column": 38 + "column": 37 } } }, @@ -689,7 +549,7 @@ }, "end": { "line": 20, - "column": 38 + "column": 37 } } }, @@ -700,41 +560,13 @@ }, "end": { "line": 20, - "column": 38 + "column": 37 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 40 - }, - "end": { - "line": 20, - "column": 44 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 40 - }, - "end": { - "line": 20, - "column": 47 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -742,7 +574,7 @@ }, "end": { "line": 20, - "column": 47 + "column": 44 } } }, diff --git a/ets2panda/test/parser/ets/lambda-type-inference-alias-expected.txt b/ets2panda/test/parser/ets/lambda-type-inference-alias-expected.txt index 3ed65879e2..a9570ccb8c 100644 --- a/ets2panda/test/parser/ets/lambda-type-inference-alias-expected.txt +++ b/ets2panda/test/parser/ets/lambda-type-inference-alias-expected.txt @@ -64,35 +64,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 27 - }, - "end": { - "line": 16, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 27 - }, - "end": { - "line": 16, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -100,7 +72,7 @@ }, "end": { "line": 16, - "column": 32 + "column": 31 } } }, @@ -111,7 +83,7 @@ }, "end": { "line": 16, - "column": 32 + "column": 31 } } }, @@ -426,35 +398,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 34 - }, - "end": { - "line": 19, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 34 - }, - "end": { - "line": 19, - "column": 40 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -462,7 +406,7 @@ }, "end": { "line": 19, - "column": 40 + "column": 38 } } }, @@ -561,35 +505,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -597,7 +513,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, @@ -663,35 +579,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 14 - }, - "end": { - "line": 23, - "column": 18 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 14 - }, - "end": { - "line": 23, - "column": 21 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -699,7 +587,7 @@ }, "end": { "line": 23, - "column": 21 + "column": 18 } } }, diff --git a/ets2panda/test/parser/ets/lambda-type-inference-arg-no-type-expected.txt b/ets2panda/test/parser/ets/lambda-type-inference-arg-no-type-expected.txt index 971a987aff..d6834b671d 100644 --- a/ets2panda/test/parser/ets/lambda-type-inference-arg-no-type-expected.txt +++ b/ets2panda/test/parser/ets/lambda-type-inference-arg-no-type-expected.txt @@ -329,35 +329,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 57 - }, - "end": { - "line": 16, - "column": 61 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 57 - }, - "end": { - "line": 16, - "column": 63 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -365,7 +337,7 @@ }, "end": { "line": 16, - "column": 63 + "column": 61 } } }, @@ -581,35 +553,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -617,7 +561,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/lambda-type-inference-expected.txt b/ets2panda/test/parser/ets/lambda-type-inference-expected.txt index ca93a3e8cf..32e3fc57cd 100644 --- a/ets2panda/test/parser/ets/lambda-type-inference-expected.txt +++ b/ets2panda/test/parser/ets/lambda-type-inference-expected.txt @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 44 - }, - "end": { - "line": 16, - "column": 48 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 44 - }, - "end": { - "line": 16, - "column": 49 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 49 + "column": 48 } } }, @@ -217,7 +189,7 @@ }, "end": { "line": 16, - "column": 49 + "column": 48 } } }, @@ -229,7 +201,7 @@ }, "end": { "line": 16, - "column": 49 + "column": 48 } } }, @@ -240,41 +212,13 @@ }, "end": { "line": 16, - "column": 49 + "column": 48 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 51 - }, - "end": { - "line": 16, - "column": 55 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 51 - }, - "end": { - "line": 16, - "column": 57 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -282,7 +226,7 @@ }, "end": { "line": 16, - "column": 57 + "column": 55 } } }, @@ -481,35 +425,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 49 - }, - "end": { - "line": 20, - "column": 53 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 49 - }, - "end": { - "line": 20, - "column": 55 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -517,7 +433,7 @@ }, "end": { "line": 20, - "column": 55 + "column": 53 } } }, @@ -871,35 +787,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 75 - }, - "end": { - "line": 24, - "column": 79 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 75 - }, - "end": { - "line": 24, - "column": 81 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -907,7 +795,7 @@ }, "end": { "line": 24, - "column": 81 + "column": 79 } } }, @@ -1123,35 +1011,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -1159,7 +1019,7 @@ }, "end": { "line": 28, - "column": 24 + "column": 22 } } }, @@ -1196,35 +1056,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 27 - }, - "end": { - "line": 29, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 27 - }, - "end": { - "line": 29, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 29, @@ -1232,7 +1064,7 @@ }, "end": { "line": 29, - "column": 34 + "column": 31 } } }, diff --git a/ets2panda/test/parser/ets/lambda-type-inference-neg-expected.txt b/ets2panda/test/parser/ets/lambda-type-inference-neg-expected.txt index 4ac2df4d2f..b0b001ac73 100644 --- a/ets2panda/test/parser/ets/lambda-type-inference-neg-expected.txt +++ b/ets2panda/test/parser/ets/lambda-type-inference-neg-expected.txt @@ -212,35 +212,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 40 - }, - "end": { - "line": 16, - "column": 44 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 40 - }, - "end": { - "line": 16, - "column": 45 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -248,7 +220,7 @@ }, "end": { "line": 16, - "column": 45 + "column": 44 } } }, @@ -259,7 +231,7 @@ }, "end": { "line": 16, - "column": 45 + "column": 44 } } }, @@ -271,7 +243,7 @@ }, "end": { "line": 16, - "column": 45 + "column": 44 } } }, @@ -282,41 +254,13 @@ }, "end": { "line": 16, - "column": 45 + "column": 44 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 47 - }, - "end": { - "line": 16, - "column": 51 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 47 - }, - "end": { - "line": 16, - "column": 53 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -324,7 +268,7 @@ }, "end": { "line": 16, - "column": 53 + "column": 51 } } }, @@ -461,35 +405,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 36 - }, - "end": { - "line": 19, - "column": 40 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 36 - }, - "end": { - "line": 19, - "column": 41 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -497,7 +413,7 @@ }, "end": { "line": 19, - "column": 41 + "column": 40 } } }, @@ -508,7 +424,7 @@ }, "end": { "line": 19, - "column": 41 + "column": 40 } } }, @@ -520,7 +436,7 @@ }, "end": { "line": 19, - "column": 41 + "column": 40 } } }, @@ -531,41 +447,13 @@ }, "end": { "line": 19, - "column": 41 + "column": 40 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 43 - }, - "end": { - "line": 19, - "column": 47 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 43 - }, - "end": { - "line": 19, - "column": 49 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -573,7 +461,7 @@ }, "end": { "line": 19, - "column": 49 + "column": 47 } } }, @@ -685,35 +573,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -721,7 +581,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/lambda-type-inference-neg2-expected.txt b/ets2panda/test/parser/ets/lambda-type-inference-neg2-expected.txt index 84f195713e..5a318e0870 100644 --- a/ets2panda/test/parser/ets/lambda-type-inference-neg2-expected.txt +++ b/ets2panda/test/parser/ets/lambda-type-inference-neg2-expected.txt @@ -301,35 +301,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 50 - }, - "end": { - "line": 16, - "column": 54 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 50 - }, - "end": { - "line": 16, - "column": 56 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -337,7 +309,7 @@ }, "end": { "line": 16, - "column": 56 + "column": 54 } } }, @@ -553,35 +525,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -589,7 +533,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/lambda-type-inference-no-ret-type-expected.txt b/ets2panda/test/parser/ets/lambda-type-inference-no-ret-type-expected.txt index ae30c4f989..5fb584ec37 100644 --- a/ets2panda/test/parser/ets/lambda-type-inference-no-ret-type-expected.txt +++ b/ets2panda/test/parser/ets/lambda-type-inference-no-ret-type-expected.txt @@ -329,35 +329,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 57 - }, - "end": { - "line": 16, - "column": 61 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 57 - }, - "end": { - "line": 16, - "column": 63 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -365,7 +337,7 @@ }, "end": { "line": 16, - "column": 63 + "column": 61 } } }, @@ -581,35 +553,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -617,7 +561,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/lambda-type-inference-overloaded-1-expected.txt b/ets2panda/test/parser/ets/lambda-type-inference-overloaded-1-expected.txt index 898613c8c7..db6810c4b3 100644 --- a/ets2panda/test/parser/ets/lambda-type-inference-overloaded-1-expected.txt +++ b/ets2panda/test/parser/ets/lambda-type-inference-overloaded-1-expected.txt @@ -329,35 +329,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 57 - }, - "end": { - "line": 16, - "column": 61 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 57 - }, - "end": { - "line": 16, - "column": 63 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -365,7 +337,7 @@ }, "end": { "line": 16, - "column": 63 + "column": 61 } } }, @@ -736,35 +708,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 60 - }, - "end": { - "line": 20, - "column": 64 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 60 - }, - "end": { - "line": 20, - "column": 66 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -772,7 +716,7 @@ }, "end": { "line": 20, - "column": 66 + "column": 64 } } }, @@ -1001,35 +945,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -1037,7 +953,7 @@ }, "end": { "line": 24, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/lambda-type-inference-overloaded-2-expected.txt b/ets2panda/test/parser/ets/lambda-type-inference-overloaded-2-expected.txt index d87a2cfdb9..1a2cf39532 100644 --- a/ets2panda/test/parser/ets/lambda-type-inference-overloaded-2-expected.txt +++ b/ets2panda/test/parser/ets/lambda-type-inference-overloaded-2-expected.txt @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 35 + "column": 34 } } }, @@ -217,7 +189,7 @@ }, "end": { "line": 16, - "column": 35 + "column": 34 } } }, @@ -229,7 +201,7 @@ }, "end": { "line": 16, - "column": 35 + "column": 34 } } }, @@ -240,7 +212,7 @@ }, "end": { "line": 16, - "column": 35 + "column": 34 } } }, @@ -287,35 +259,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 45 - }, - "end": { - "line": 16, - "column": 49 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 45 - }, - "end": { - "line": 16, - "column": 51 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -323,7 +267,7 @@ }, "end": { "line": 16, - "column": 51 + "column": 49 } } }, @@ -549,35 +493,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 58 - }, - "end": { - "line": 19, - "column": 62 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 58 - }, - "end": { - "line": 19, - "column": 64 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -585,7 +501,7 @@ }, "end": { "line": 19, - "column": 64 + "column": 62 } } }, @@ -697,35 +613,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -733,7 +621,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/lambda-type-inference-overloaded-3-expected.txt b/ets2panda/test/parser/ets/lambda-type-inference-overloaded-3-expected.txt index c6cbd4d02b..a3d4d03102 100644 --- a/ets2panda/test/parser/ets/lambda-type-inference-overloaded-3-expected.txt +++ b/ets2panda/test/parser/ets/lambda-type-inference-overloaded-3-expected.txt @@ -118,35 +118,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 31 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 31 - }, - "end": { - "line": 17, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -154,7 +126,7 @@ }, "end": { "line": 17, - "column": 36 + "column": 35 } } }, @@ -165,7 +137,7 @@ }, "end": { "line": 17, - "column": 36 + "column": 35 } } }, @@ -177,7 +149,7 @@ }, "end": { "line": 17, - "column": 36 + "column": 35 } } }, @@ -188,41 +160,13 @@ }, "end": { "line": 17, - "column": 36 + "column": 35 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 38 - }, - "end": { - "line": 17, - "column": 42 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 38 - }, - "end": { - "line": 17, - "column": 44 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -230,7 +174,7 @@ }, "end": { "line": 17, - "column": 44 + "column": 42 } } }, @@ -556,35 +500,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 34 - }, - "end": { - "line": 22, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 34 - }, - "end": { - "line": 22, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -592,7 +508,7 @@ }, "end": { "line": 22, - "column": 39 + "column": 38 } } }, @@ -603,7 +519,7 @@ }, "end": { "line": 22, - "column": 39 + "column": 38 } } }, @@ -615,7 +531,7 @@ }, "end": { "line": 22, - "column": 39 + "column": 38 } } }, @@ -626,41 +542,13 @@ }, "end": { "line": 22, - "column": 39 + "column": 38 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 41 - }, - "end": { - "line": 22, - "column": 45 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 41 - }, - "end": { - "line": 22, - "column": 47 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -668,7 +556,7 @@ }, "end": { "line": 22, - "column": 47 + "column": 45 } } }, @@ -767,35 +655,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 13 - }, - "end": { - "line": 25, - "column": 17 - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 13 - }, - "end": { - "line": 25, - "column": 19 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 25, @@ -803,7 +663,7 @@ }, "end": { "line": 25, - "column": 19 + "column": 17 } } }, @@ -897,35 +757,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 23 - }, - "end": { - "line": 26, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 23 - }, - "end": { - "line": 26, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 26, @@ -933,7 +765,7 @@ }, "end": { "line": 26, - "column": 30 + "column": 27 } } }, diff --git a/ets2panda/test/parser/ets/lambda-type-inference-overloaded-expected.txt b/ets2panda/test/parser/ets/lambda-type-inference-overloaded-expected.txt index f703a32a67..45b5ee1b40 100644 --- a/ets2panda/test/parser/ets/lambda-type-inference-overloaded-expected.txt +++ b/ets2panda/test/parser/ets/lambda-type-inference-overloaded-expected.txt @@ -232,35 +232,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -268,7 +240,7 @@ }, "end": { "line": 16, - "column": 29 + "column": 27 } } }, @@ -363,35 +335,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 30 - }, - "end": { - "line": 19, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 30 - }, - "end": { - "line": 19, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -399,7 +343,7 @@ }, "end": { "line": 19, - "column": 35 + "column": 34 } } }, @@ -410,7 +354,7 @@ }, "end": { "line": 19, - "column": 35 + "column": 34 } } }, @@ -422,7 +366,7 @@ }, "end": { "line": 19, - "column": 35 + "column": 34 } } }, @@ -433,41 +377,13 @@ }, "end": { "line": 19, - "column": 35 + "column": 34 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 37 - }, - "end": { - "line": 19, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 37 - }, - "end": { - "line": 19, - "column": 43 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -475,7 +391,7 @@ }, "end": { "line": 19, - "column": 43 + "column": 41 } } }, @@ -785,35 +701,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 57 - }, - "end": { - "line": 23, - "column": 61 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 57 - }, - "end": { - "line": 23, - "column": 63 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -821,7 +709,7 @@ }, "end": { "line": 23, - "column": 63 + "column": 61 } } }, @@ -1050,35 +938,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 18 - }, - "end": { - "line": 27, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 18 - }, - "end": { - "line": 27, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 27, @@ -1086,7 +946,7 @@ }, "end": { "line": 27, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatement-expected.txt b/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatement-expected.txt index 22c782deec..da25446262 100644 --- a/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatement-expected.txt +++ b/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatement-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatementCallAVoidFunction-expected.txt b/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatementCallAVoidFunction-expected.txt index abbbb1b232..166cc49993 100644 --- a/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatementCallAVoidFunction-expected.txt +++ b/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatementCallAVoidFunction-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 29 + "column": 27 } } }, @@ -297,35 +269,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -333,7 +277,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, @@ -352,35 +296,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 22 - }, - "end": { - "line": 19, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 22 - }, - "end": { - "line": 19, - "column": 28 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -388,7 +304,7 @@ }, "end": { "line": 19, - "column": 28 + "column": 26 } } }, @@ -399,7 +315,7 @@ }, "end": { "line": 19, - "column": 28 + "column": 26 } } }, @@ -425,35 +341,7 @@ "expression": true, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 33 - }, - "end": { - "line": 19, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 33 - }, - "end": { - "line": 19, - "column": 40 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -461,7 +349,7 @@ }, "end": { "line": 19, - "column": 40 + "column": 37 } } }, @@ -469,8 +357,8 @@ "type": "BlockStatement", "statements": [ { - "type": "ReturnStatement", - "argument": { + "type": "ExpressionStatement", + "expression": { "type": "CallExpression", "callee": { "type": "Identifier", diff --git a/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatementVoid-expected.txt b/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatementVoid-expected.txt index d1c490b611..5f4bbd9763 100644 --- a/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatementVoid-expected.txt +++ b/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatementVoid-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, @@ -217,35 +189,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -253,7 +197,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, @@ -264,7 +208,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, @@ -290,35 +234,7 @@ "expression": true, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 29 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 29 - }, - "end": { - "line": 17, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -326,7 +242,7 @@ }, "end": { "line": 17, - "column": 36 + "column": 33 } } }, @@ -334,8 +250,8 @@ "type": "BlockStatement", "statements": [ { - "type": "ReturnStatement", - "argument": { + "type": "ExpressionStatement", + "expression": { "type": "CallExpression", "callee": { "type": "MemberExpression", diff --git a/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatementWithFunctionParameters-expected.txt b/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatementWithFunctionParameters-expected.txt index 4198ef2def..aaf24d3830 100644 --- a/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatementWithFunctionParameters-expected.txt +++ b/ets2panda/test/parser/ets/lambdaExpressionWithoutBlockStatementWithFunctionParameters-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/lambdaThrowsRethrows-expected.txt b/ets2panda/test/parser/ets/lambdaThrowsRethrows-expected.txt index bc9900bde9..eddc4d3a1f 100644 --- a/ets2panda/test/parser/ets/lambdaThrowsRethrows-expected.txt +++ b/ets2panda/test/parser/ets/lambdaThrowsRethrows-expected.txt @@ -143,35 +143,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 37 - }, - "end": { - "line": 16, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 37 - }, - "end": { - "line": 16, - "column": 48 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -179,7 +151,7 @@ }, "end": { "line": 16, - "column": 48 + "column": 41 } } }, @@ -230,35 +202,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -266,7 +210,7 @@ }, "end": { "line": 16, - "column": 30 + "column": 23 } } } @@ -278,7 +222,7 @@ }, "end": { "line": 16, - "column": 30 + "column": 23 } } }, @@ -462,35 +406,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 114 - }, - "end": { - "line": 18, - "column": 118 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 114 - }, - "end": { - "line": 18, - "column": 127 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -498,7 +414,7 @@ }, "end": { "line": 18, - "column": 127 + "column": 118 } } }, @@ -689,35 +605,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 58 - }, - "end": { - "line": 18, - "column": 62 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 58 - }, - "end": { - "line": 18, - "column": 69 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -725,7 +613,7 @@ }, "end": { "line": 18, - "column": 69 + "column": 62 } } } @@ -737,7 +625,7 @@ }, "end": { "line": 18, - "column": 69 + "column": 62 } } }, diff --git a/ets2panda/test/parser/ets/launch-expected.txt b/ets2panda/test/parser/ets/launch-expected.txt index 69354243b1..2abcf171d9 100755 --- a/ets2panda/test/parser/ets/launch-expected.txt +++ b/ets2panda/test/parser/ets/launch-expected.txt @@ -1326,35 +1326,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 35, - "column": 18 - }, - "end": { - "line": 35, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 35, - "column": 18 - }, - "end": { - "line": 35, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 35, @@ -1362,7 +1334,7 @@ }, "end": { "line": 35, - "column": 24 + "column": 22 } } }, @@ -2363,35 +2335,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 44, - "column": 21 - }, - "end": { - "line": 44, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 44, - "column": 21 - }, - "end": { - "line": 44, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 44, @@ -2399,7 +2343,7 @@ }, "end": { "line": 44, - "column": 27 + "column": 25 } } }, @@ -2410,7 +2354,7 @@ }, "end": { "line": 44, - "column": 27 + "column": 25 } } }, @@ -2436,35 +2380,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 44, - "column": 32 - }, - "end": { - "line": 44, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 44, - "column": 32 - }, - "end": { - "line": 44, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 44, @@ -2472,7 +2388,7 @@ }, "end": { "line": 44, - "column": 39 + "column": 36 } } }, diff --git a/ets2panda/test/parser/ets/launch_ret-expected.txt b/ets2panda/test/parser/ets/launch_ret-expected.txt index 8c013e1a17..e6a23877ca 100644 --- a/ets2panda/test/parser/ets/launch_ret-expected.txt +++ b/ets2panda/test/parser/ets/launch_ret-expected.txt @@ -297,35 +297,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -333,7 +305,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/launch_super-expected.txt b/ets2panda/test/parser/ets/launch_super-expected.txt index 740ef6c10d..20aab1a491 100755 --- a/ets2panda/test/parser/ets/launch_super-expected.txt +++ b/ets2panda/test/parser/ets/launch_super-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 20 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 20 - }, - "end": { - "line": 17, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 26 + "column": 24 } } }, @@ -380,35 +352,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -416,7 +360,7 @@ }, "end": { "line": 21, - "column": 27 + "column": 25 } } }, diff --git a/ets2panda/test/parser/ets/launch_unresolved-expected.txt b/ets2panda/test/parser/ets/launch_unresolved-expected.txt index fbe801324e..65f5bc0ae7 100755 --- a/ets2panda/test/parser/ets/launch_unresolved-expected.txt +++ b/ets2panda/test/parser/ets/launch_unresolved-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/loops-expected.txt b/ets2panda/test/parser/ets/loops-expected.txt index c30aa0c543..1ea34dabb4 100644 --- a/ets2panda/test/parser/ets/loops-expected.txt +++ b/ets2panda/test/parser/ets/loops-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, @@ -915,35 +887,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 20 - }, - "end": { - "line": 27, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 20 - }, - "end": { - "line": 27, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 27, @@ -951,7 +895,7 @@ }, "end": { "line": 27, - "column": 26 + "column": 24 } } }, @@ -1133,35 +1077,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 34, - "column": 22 - }, - "end": { - "line": 34, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 34, - "column": 22 - }, - "end": { - "line": 34, - "column": 28 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 34, @@ -1169,7 +1085,7 @@ }, "end": { "line": 34, - "column": 28 + "column": 26 } } }, @@ -1581,35 +1497,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 46, - "column": 26 - }, - "end": { - "line": 46, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 46, - "column": 26 - }, - "end": { - "line": 46, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 46, @@ -1617,7 +1505,7 @@ }, "end": { "line": 46, - "column": 32 + "column": 30 } } }, @@ -2119,35 +2007,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 57, - "column": 29 - }, - "end": { - "line": 57, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 57, - "column": 29 - }, - "end": { - "line": 57, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 57, @@ -2155,7 +2015,7 @@ }, "end": { "line": 57, - "column": 35 + "column": 33 } } }, diff --git a/ets2panda/test/parser/ets/main_entry_point_1-expected.txt b/ets2panda/test/parser/ets/main_entry_point_1-expected.txt index 66bc2887d3..0d70eb572e 100644 --- a/ets2panda/test/parser/ets/main_entry_point_1-expected.txt +++ b/ets2panda/test/parser/ets/main_entry_point_1-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/main_entry_point_3-expected.txt b/ets2panda/test/parser/ets/main_entry_point_3-expected.txt index ce10728450..72cb9f1b8a 100644 --- a/ets2panda/test/parser/ets/main_entry_point_3-expected.txt +++ b/ets2panda/test/parser/ets/main_entry_point_3-expected.txt @@ -217,35 +217,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 27 - }, - "end": { - "line": 16, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 27 - }, - "end": { - "line": 16, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -253,7 +225,7 @@ }, "end": { "line": 16, - "column": 33 + "column": 31 } } }, diff --git a/ets2panda/test/parser/ets/main_entry_point_4-expected.txt b/ets2panda/test/parser/ets/main_entry_point_4-expected.txt index 038926786e..9a79909845 100644 --- a/ets2panda/test/parser/ets/main_entry_point_4-expected.txt +++ b/ets2panda/test/parser/ets/main_entry_point_4-expected.txt @@ -258,35 +258,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 37 - }, - "end": { - "line": 16, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 37 - }, - "end": { - "line": 16, - "column": 43 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -294,7 +266,7 @@ }, "end": { "line": 16, - "column": 43 + "column": 41 } } }, diff --git a/ets2panda/test/parser/ets/main_entry_point_6-expected.txt b/ets2panda/test/parser/ets/main_entry_point_6-expected.txt index f1b23c2fde..093803aa4f 100644 --- a/ets2panda/test/parser/ets/main_entry_point_6-expected.txt +++ b/ets2panda/test/parser/ets/main_entry_point_6-expected.txt @@ -245,35 +245,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 16, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -281,7 +253,7 @@ }, "end": { "line": 16, - "column": 36 + "column": 34 } } }, diff --git a/ets2panda/test/parser/ets/main_entry_point_7-expected.txt b/ets2panda/test/parser/ets/main_entry_point_7-expected.txt index 4d502fcf3b..2dc6b78535 100644 --- a/ets2panda/test/parser/ets/main_entry_point_7-expected.txt +++ b/ets2panda/test/parser/ets/main_entry_point_7-expected.txt @@ -640,35 +640,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -676,7 +648,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/main_entry_point_8-expected.txt b/ets2panda/test/parser/ets/main_entry_point_8-expected.txt index 406da83ac1..398b09b8b1 100644 --- a/ets2panda/test/parser/ets/main_entry_point_8-expected.txt +++ b/ets2panda/test/parser/ets/main_entry_point_8-expected.txt @@ -314,35 +314,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 27 - }, - "end": { - "line": 18, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 27 - }, - "end": { - "line": 18, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -350,7 +322,7 @@ }, "end": { "line": 18, - "column": 33 + "column": 31 } } }, diff --git a/ets2panda/test/parser/ets/main_entry_point_9-expected.txt b/ets2panda/test/parser/ets/main_entry_point_9-expected.txt index 8ab846bcea..d4b95fa07d 100644 --- a/ets2panda/test/parser/ets/main_entry_point_9-expected.txt +++ b/ets2panda/test/parser/ets/main_entry_point_9-expected.txt @@ -314,35 +314,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 25 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 25 - }, - "end": { - "line": 18, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -350,7 +322,7 @@ }, "end": { "line": 18, - "column": 31 + "column": 29 } } }, diff --git a/ets2panda/test/parser/ets/methodThrowsRethrows-expected.txt b/ets2panda/test/parser/ets/methodThrowsRethrows-expected.txt index 385bd2bde7..612c4addfb 100644 --- a/ets2panda/test/parser/ets/methodThrowsRethrows-expected.txt +++ b/ets2panda/test/parser/ets/methodThrowsRethrows-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 27 } } }, @@ -344,35 +316,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 63 - }, - "end": { - "line": 19, - "column": 67 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 63 - }, - "end": { - "line": 19, - "column": 76 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -380,7 +324,7 @@ }, "end": { "line": 19, - "column": 76 + "column": 67 } } }, diff --git a/ets2panda/test/parser/ets/method_empty-expected.txt b/ets2panda/test/parser/ets/method_empty-expected.txt index 9b59904d9c..f0f97178b4 100644 --- a/ets2panda/test/parser/ets/method_empty-expected.txt +++ b/ets2panda/test/parser/ets/method_empty-expected.txt @@ -208,35 +208,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 20 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 20 - }, - "end": { - "line": 19, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -244,7 +216,7 @@ }, "end": { "line": 19, - "column": 26 + "column": 24 } } }, @@ -373,35 +345,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 27 - }, - "end": { - "line": 21, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 27 - }, - "end": { - "line": 21, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -409,7 +353,7 @@ }, "end": { "line": 21, - "column": 33 + "column": 31 } } }, @@ -563,35 +507,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -599,7 +515,7 @@ }, "end": { "line": 23, - "column": 35 + "column": 33 } } }, diff --git a/ets2panda/test/parser/ets/method_full-expected.txt b/ets2panda/test/parser/ets/method_full-expected.txt index 217d377aeb..963b8b949b 100644 --- a/ets2panda/test/parser/ets/method_full-expected.txt +++ b/ets2panda/test/parser/ets/method_full-expected.txt @@ -208,35 +208,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 12 - }, - "end": { - "line": 19, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 12 - }, - "end": { - "line": 19, - "column": 18 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -244,7 +216,7 @@ }, "end": { "line": 19, - "column": 18 + "column": 16 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_1-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_1-expected.txt index e3224b8f8f..bfbe5b729d 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_1-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_1-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 32 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_10-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_10-expected.txt index 36c6d3daea..53c6577011 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_10-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_10-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 26 - }, - "end": { - "line": 17, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 26 - }, - "end": { - "line": 17, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 32 + "column": 30 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_11-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_11-expected.txt index 781cc3889a..b69337a9f1 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_11-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_11-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 32 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_12-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_12-expected.txt index 13dcd8b708..ff3d4b7786 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_12-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_12-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 26 - }, - "end": { - "line": 17, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 26 - }, - "end": { - "line": 17, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 32 + "column": 30 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_13-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_13-expected.txt index 5b259a8453..c927ad4f19 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_13-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_13-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 29 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 29 - }, - "end": { - "line": 17, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 33 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_14-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_14-expected.txt index 7365c0e397..6620974883 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_14-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_14-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 32 + "column": 31 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_15-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_15-expected.txt index adf31a8145..6529f2d724 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_15-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_15-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 26 - }, - "end": { - "line": 17, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 26 - }, - "end": { - "line": 17, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 31 + "column": 30 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_16-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_16-expected.txt index f7aa11dedc..c2dbfc4618 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_16-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_16-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 29 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 29 - }, - "end": { - "line": 17, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 33 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_2-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_2-expected.txt index de3b52cd12..dbf48ae86f 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_2-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_2-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 31 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_3-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_3-expected.txt index b29e6a461c..deb246e3ec 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_3-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_3-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 30 - }, - "end": { - "line": 17, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 30 - }, - "end": { - "line": 17, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 36 + "column": 34 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_4-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_4-expected.txt index 552012fcd1..530f0bd203 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_4-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_4-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 32 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_5-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_5-expected.txt index fc02f417b4..cbdd0544e8 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_5-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_5-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 32 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_6-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_6-expected.txt index 8db996a9f0..06769206a4 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_6-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_6-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 25 - }, - "end": { - "line": 17, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 25 - }, - "end": { - "line": 17, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 31 + "column": 29 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_7-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_7-expected.txt index e8b4bbfc7b..5f04dd8bb0 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_7-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_7-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 34 + "column": 32 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_8-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_8-expected.txt index 7365c0e397..6620974883 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_8-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_8-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 32 + "column": 31 } } }, diff --git a/ets2panda/test/parser/ets/method_modifier_check_9-expected.txt b/ets2panda/test/parser/ets/method_modifier_check_9-expected.txt index d3627937d0..8492bc5358 100644 --- a/ets2panda/test/parser/ets/method_modifier_check_9-expected.txt +++ b/ets2panda/test/parser/ets/method_modifier_check_9-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 32 } } }, diff --git a/ets2panda/test/parser/ets/method_override_throw_1-expected.txt b/ets2panda/test/parser/ets/method_override_throw_1-expected.txt index 5e54b382c8..a865846465 100644 --- a/ets2panda/test/parser/ets/method_override_throw_1-expected.txt +++ b/ets2panda/test/parser/ets/method_override_throw_1-expected.txt @@ -52,35 +52,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 13 - }, - "end": { - "line": 17, - "column": 17 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 13 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -88,7 +60,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 17 } } }, @@ -101,7 +73,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 17 } } }, @@ -112,7 +84,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 17 } } }, @@ -183,35 +155,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -219,7 +163,7 @@ }, "end": { "line": 18, - "column": 34 + "column": 27 } } } @@ -231,7 +175,7 @@ }, "end": { "line": 18, - "column": 34 + "column": 27 } } }, @@ -243,7 +187,7 @@ }, "end": { "line": 18, - "column": 34 + "column": 27 } } }, @@ -254,41 +198,13 @@ }, "end": { "line": 18, - "column": 34 + "column": 27 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 37 - }, - "end": { - "line": 18, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 37 - }, - "end": { - "line": 18, - "column": 50 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -296,7 +212,7 @@ }, "end": { "line": 18, - "column": 50 + "column": 41 } } }, @@ -309,7 +225,7 @@ }, "end": { "line": 18, - "column": 50 + "column": 41 } } }, @@ -320,7 +236,7 @@ }, "end": { "line": 18, - "column": 50 + "column": 41 } } }, @@ -383,35 +299,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 13 - }, - "end": { - "line": 19, - "column": 17 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 13 - }, - "end": { - "line": 19, - "column": 18 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -419,7 +307,7 @@ }, "end": { "line": 19, - "column": 18 + "column": 17 } } }, @@ -431,7 +319,7 @@ }, "end": { "line": 19, - "column": 18 + "column": 17 } } }, @@ -442,7 +330,7 @@ }, "end": { "line": 19, - "column": 18 + "column": 17 } } }, @@ -620,35 +508,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 22 - }, - "end": { - "line": 23, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 22 - }, - "end": { - "line": 23, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -656,7 +516,7 @@ }, "end": { "line": 23, - "column": 33 + "column": 26 } } }, @@ -764,35 +624,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 32 - }, - "end": { - "line": 24, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 32 - }, - "end": { - "line": 24, - "column": 43 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -800,7 +632,7 @@ }, "end": { "line": 24, - "column": 43 + "column": 36 } } } @@ -812,7 +644,7 @@ }, "end": { "line": 24, - "column": 43 + "column": 36 } } }, @@ -824,7 +656,7 @@ }, "end": { "line": 24, - "column": 43 + "column": 36 } } }, @@ -835,41 +667,13 @@ }, "end": { "line": 24, - "column": 43 + "column": 36 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 46 - }, - "end": { - "line": 24, - "column": 50 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 46 - }, - "end": { - "line": 24, - "column": 59 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -877,7 +681,7 @@ }, "end": { "line": 24, - "column": 59 + "column": 50 } } }, @@ -977,35 +781,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 22 - }, - "end": { - "line": 25, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 22 - }, - "end": { - "line": 25, - "column": 28 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 25, @@ -1013,7 +789,7 @@ }, "end": { "line": 25, - "column": 28 + "column": 26 } } }, @@ -1249,35 +1025,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 13 - }, - "end": { - "line": 29, - "column": 17 - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 13 - }, - "end": { - "line": 29, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 29, @@ -1285,7 +1033,7 @@ }, "end": { "line": 29, - "column": 24 + "column": 17 } } }, @@ -1393,35 +1141,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 23 - }, - "end": { - "line": 30, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 23 - }, - "end": { - "line": 30, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 30, @@ -1429,7 +1149,7 @@ }, "end": { "line": 30, - "column": 34 + "column": 27 } } } @@ -1441,7 +1161,7 @@ }, "end": { "line": 30, - "column": 34 + "column": 27 } } }, @@ -1453,7 +1173,7 @@ }, "end": { "line": 30, - "column": 34 + "column": 27 } } }, @@ -1464,41 +1184,13 @@ }, "end": { "line": 30, - "column": 34 + "column": 27 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 37 - }, - "end": { - "line": 30, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 37 - }, - "end": { - "line": 30, - "column": 50 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 30, @@ -1506,7 +1198,7 @@ }, "end": { "line": 30, - "column": 50 + "column": 41 } } }, @@ -1606,35 +1298,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 13 - }, - "end": { - "line": 31, - "column": 17 - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 13 - }, - "end": { - "line": 31, - "column": 19 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 31, @@ -1642,7 +1306,7 @@ }, "end": { "line": 31, - "column": 19 + "column": 17 } } }, @@ -1918,35 +1582,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 35, - "column": 22 - }, - "end": { - "line": 35, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 35, - "column": 22 - }, - "end": { - "line": 35, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 35, @@ -1954,7 +1590,7 @@ }, "end": { "line": 35, - "column": 33 + "column": 26 } } }, @@ -2062,35 +1698,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 36, - "column": 32 - }, - "end": { - "line": 36, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 36, - "column": 32 - }, - "end": { - "line": 36, - "column": 43 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 36, @@ -2098,7 +1706,7 @@ }, "end": { "line": 36, - "column": 43 + "column": 36 } } } @@ -2110,7 +1718,7 @@ }, "end": { "line": 36, - "column": 43 + "column": 36 } } }, @@ -2122,7 +1730,7 @@ }, "end": { "line": 36, - "column": 43 + "column": 36 } } }, @@ -2133,41 +1741,13 @@ }, "end": { "line": 36, - "column": 43 + "column": 36 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 36, - "column": 46 - }, - "end": { - "line": 36, - "column": 50 - } - } - }, - "loc": { - "start": { - "line": 36, - "column": 46 - }, - "end": { - "line": 36, - "column": 59 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 36, @@ -2175,7 +1755,7 @@ }, "end": { "line": 36, - "column": 59 + "column": 50 } } }, @@ -2275,35 +1855,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 37, - "column": 22 - }, - "end": { - "line": 37, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 37, - "column": 22 - }, - "end": { - "line": 37, - "column": 28 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 37, @@ -2311,7 +1863,7 @@ }, "end": { "line": 37, - "column": 28 + "column": 26 } } }, diff --git a/ets2panda/test/parser/ets/method_override_throw_2-expected.txt b/ets2panda/test/parser/ets/method_override_throw_2-expected.txt index 4dcd12776b..76adc106eb 100644 --- a/ets2panda/test/parser/ets/method_override_throw_2-expected.txt +++ b/ets2panda/test/parser/ets/method_override_throw_2-expected.txt @@ -52,35 +52,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -88,7 +60,7 @@ }, "end": { "line": 17, - "column": 23 + "column": 16 } } }, @@ -101,7 +73,7 @@ }, "end": { "line": 17, - "column": 23 + "column": 16 } } }, @@ -112,7 +84,7 @@ }, "end": { "line": 17, - "column": 23 + "column": 16 } } }, @@ -290,35 +262,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -326,7 +270,7 @@ }, "end": { "line": 21, - "column": 27 + "column": 25 } } }, diff --git a/ets2panda/test/parser/ets/method_override_throw_3-expected.txt b/ets2panda/test/parser/ets/method_override_throw_3-expected.txt index e340f84123..5529651586 100644 --- a/ets2panda/test/parser/ets/method_override_throw_3-expected.txt +++ b/ets2panda/test/parser/ets/method_override_throw_3-expected.txt @@ -60,35 +60,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 22 - }, - "end": { - "line": 17, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 22 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -96,7 +68,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 26 } } } @@ -108,7 +80,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 26 } } }, @@ -120,7 +92,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 26 } } }, @@ -131,41 +103,13 @@ }, "end": { "line": 17, - "column": 33 + "column": 26 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 36 - }, - "end": { - "line": 17, - "column": 40 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 36 - }, - "end": { - "line": 17, - "column": 49 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -173,7 +117,7 @@ }, "end": { "line": 17, - "column": 49 + "column": 40 } } }, @@ -186,7 +130,7 @@ }, "end": { "line": 17, - "column": 49 + "column": 40 } } }, @@ -197,7 +141,7 @@ }, "end": { "line": 17, - "column": 49 + "column": 40 } } }, @@ -383,35 +327,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 31 - }, - "end": { - "line": 21, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 31 - }, - "end": { - "line": 21, - "column": 42 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -419,7 +335,7 @@ }, "end": { "line": 21, - "column": 42 + "column": 35 } } } @@ -431,7 +347,7 @@ }, "end": { "line": 21, - "column": 42 + "column": 35 } } }, @@ -443,7 +359,7 @@ }, "end": { "line": 21, - "column": 42 + "column": 35 } } }, @@ -454,41 +370,13 @@ }, "end": { "line": 21, - "column": 42 + "column": 35 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 45 - }, - "end": { - "line": 21, - "column": 49 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 45 - }, - "end": { - "line": 21, - "column": 56 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -496,7 +384,7 @@ }, "end": { "line": 21, - "column": 56 + "column": 49 } } }, diff --git a/ets2panda/test/parser/ets/method_override_throw_4-expected.txt b/ets2panda/test/parser/ets/method_override_throw_4-expected.txt index 873680b145..f9adc53620 100644 --- a/ets2panda/test/parser/ets/method_override_throw_4-expected.txt +++ b/ets2panda/test/parser/ets/method_override_throw_4-expected.txt @@ -76,35 +76,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 22 - }, - "end": { - "line": 17, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 22 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -112,7 +84,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 26 } } } @@ -124,7 +96,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 26 } } }, @@ -136,7 +108,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 26 } } }, @@ -147,41 +119,13 @@ }, "end": { "line": 17, - "column": 33 + "column": 26 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 36 - }, - "end": { - "line": 17, - "column": 40 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 36 - }, - "end": { - "line": 17, - "column": 49 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -189,7 +133,7 @@ }, "end": { "line": 17, - "column": 49 + "column": 40 } } }, @@ -474,35 +418,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 31 - }, - "end": { - "line": 21, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 31 - }, - "end": { - "line": 21, - "column": 42 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -510,7 +426,7 @@ }, "end": { "line": 21, - "column": 42 + "column": 35 } } } @@ -522,7 +438,7 @@ }, "end": { "line": 21, - "column": 42 + "column": 35 } } }, @@ -534,7 +450,7 @@ }, "end": { "line": 21, - "column": 42 + "column": 35 } } }, @@ -545,41 +461,13 @@ }, "end": { "line": 21, - "column": 42 + "column": 35 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 45 - }, - "end": { - "line": 21, - "column": 49 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 45 - }, - "end": { - "line": 21, - "column": 51 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -587,7 +475,7 @@ }, "end": { "line": 21, - "column": 51 + "column": 49 } } }, diff --git a/ets2panda/test/parser/ets/method_override_throw_5-expected.txt b/ets2panda/test/parser/ets/method_override_throw_5-expected.txt index 1ad87dcfb4..9f006735a8 100644 --- a/ets2panda/test/parser/ets/method_override_throw_5-expected.txt +++ b/ets2panda/test/parser/ets/method_override_throw_5-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 23 + "column": 16 } } }, @@ -381,35 +353,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -417,7 +361,7 @@ }, "end": { "line": 21, - "column": 34 + "column": 25 } } }, diff --git a/ets2panda/test/parser/ets/method_override_throw_6-expected.txt b/ets2panda/test/parser/ets/method_override_throw_6-expected.txt index 90934c6a03..bb00d0e8c3 100644 --- a/ets2panda/test/parser/ets/method_override_throw_6-expected.txt +++ b/ets2panda/test/parser/ets/method_override_throw_6-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 30 + "column": 23 } } }, @@ -381,35 +353,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 19 - }, - "end": { - "line": 21, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 19 - }, - "end": { - "line": 21, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -417,7 +361,7 @@ }, "end": { "line": 21, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/methods-expected.txt b/ets2panda/test/parser/ets/methods-expected.txt index c6795d18fd..334e66e7c5 100644 --- a/ets2panda/test/parser/ets/methods-expected.txt +++ b/ets2panda/test/parser/ets/methods-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 8 - }, - "end": { - "line": 17, - "column": 12 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 8 - }, - "end": { - "line": 17, - "column": 14 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 14 + "column": 12 } } }, @@ -203,35 +175,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 15 - }, - "end": { - "line": 18, - "column": 19 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 15 - }, - "end": { - "line": 18, - "column": 21 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -239,7 +183,7 @@ }, "end": { "line": 18, - "column": 21 + "column": 19 } } }, @@ -338,35 +282,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -374,7 +290,7 @@ }, "end": { "line": 19, - "column": 27 + "column": 25 } } }, @@ -473,35 +389,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 22 - }, - "end": { - "line": 20, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 22 - }, - "end": { - "line": 20, - "column": 28 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -509,7 +397,7 @@ }, "end": { "line": 20, - "column": 28 + "column": 26 } } }, @@ -608,35 +496,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -644,7 +504,7 @@ }, "end": { "line": 21, - "column": 30 + "column": 28 } } }, @@ -743,35 +603,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -779,7 +611,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, @@ -878,35 +710,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 25 - }, - "end": { - "line": 23, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 25 - }, - "end": { - "line": 23, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -914,7 +718,7 @@ }, "end": { "line": 23, - "column": 31 + "column": 29 } } }, @@ -1150,35 +954,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 17 - }, - "end": { - "line": 28, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 17 - }, - "end": { - "line": 28, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -1186,7 +962,7 @@ }, "end": { "line": 28, - "column": 22 + "column": 21 } } }, @@ -1448,35 +1224,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 17 - }, - "end": { - "line": 32, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 17 - }, - "end": { - "line": 32, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 32, @@ -1484,7 +1232,7 @@ }, "end": { "line": 32, - "column": 23 + "column": 21 } } }, @@ -1720,35 +1468,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 36, - "column": 8 - }, - "end": { - "line": 36, - "column": 12 - } - } - }, - "loc": { - "start": { - "line": 36, - "column": 8 - }, - "end": { - "line": 36, - "column": 13 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 36, @@ -1756,7 +1476,7 @@ }, "end": { "line": 36, - "column": 13 + "column": 12 } } }, @@ -2018,35 +1738,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 40, - "column": 17 - }, - "end": { - "line": 40, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 40, - "column": 17 - }, - "end": { - "line": 40, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 40, @@ -2054,7 +1746,7 @@ }, "end": { "line": 40, - "column": 23 + "column": 21 } } }, diff --git a/ets2panda/test/parser/ets/n_arrayHoldingNullValue-expected.txt b/ets2panda/test/parser/ets/n_arrayHoldingNullValue-expected.txt index 10346aee63..f3afece131 100644 --- a/ets2panda/test/parser/ets/n_arrayHoldingNullValue-expected.txt +++ b/ets2panda/test/parser/ets/n_arrayHoldingNullValue-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/n_assignNullableFromFunctionToNonNullable-expected.txt b/ets2panda/test/parser/ets/n_assignNullableFromFunctionToNonNullable-expected.txt index c61ffafce0..9fe571757c 100644 --- a/ets2panda/test/parser/ets/n_assignNullableFromFunctionToNonNullable-expected.txt +++ b/ets2panda/test/parser/ets/n_assignNullableFromFunctionToNonNullable-expected.txt @@ -531,35 +531,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -567,7 +539,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/n_assignNullableFromMethodToNullableParam-expected.txt b/ets2panda/test/parser/ets/n_assignNullableFromMethodToNullableParam-expected.txt index 41b3b86914..5d1ead0fe1 100644 --- a/ets2panda/test/parser/ets/n_assignNullableFromMethodToNullableParam-expected.txt +++ b/ets2panda/test/parser/ets/n_assignNullableFromMethodToNullableParam-expected.txt @@ -531,35 +531,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -567,7 +539,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/n_assignNullableToNonNullable-expected.txt b/ets2panda/test/parser/ets/n_assignNullableToNonNullable-expected.txt index 2f8cf591f8..2fcd362950 100644 --- a/ets2panda/test/parser/ets/n_assignNullableToNonNullable-expected.txt +++ b/ets2panda/test/parser/ets/n_assignNullableToNonNullable-expected.txt @@ -299,35 +299,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -335,7 +307,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/n_assignNullableToNonNullableArray-expected.txt b/ets2panda/test/parser/ets/n_assignNullableToNonNullableArray-expected.txt index d95f6878d6..4f7aa8abd6 100644 --- a/ets2panda/test/parser/ets/n_assignNullableToNonNullableArray-expected.txt +++ b/ets2panda/test/parser/ets/n_assignNullableToNonNullableArray-expected.txt @@ -299,35 +299,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -335,7 +307,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/n_assignNullableToNonNullableTypeAlias-expected.txt b/ets2panda/test/parser/ets/n_assignNullableToNonNullableTypeAlias-expected.txt index ce9f84a389..3764badd42 100644 --- a/ets2panda/test/parser/ets/n_assignNullableToNonNullableTypeAlias-expected.txt +++ b/ets2panda/test/parser/ets/n_assignNullableToNonNullableTypeAlias-expected.txt @@ -396,35 +396,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -432,7 +404,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/n_callFunctionWithNullableParam-expected.txt b/ets2panda/test/parser/ets/n_callFunctionWithNullableParam-expected.txt index d285a43cd1..694a48ec19 100644 --- a/ets2panda/test/parser/ets/n_callFunctionWithNullableParam-expected.txt +++ b/ets2panda/test/parser/ets/n_callFunctionWithNullableParam-expected.txt @@ -369,35 +369,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -405,7 +377,7 @@ }, "end": { "line": 18, - "column": 29 + "column": 27 } } }, @@ -504,35 +476,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -540,7 +484,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/n_callInterfaceMethodWithNullableParam-expected.txt b/ets2panda/test/parser/ets/n_callInterfaceMethodWithNullableParam-expected.txt index 986c26ce76..aac8b849d7 100644 --- a/ets2panda/test/parser/ets/n_callInterfaceMethodWithNullableParam-expected.txt +++ b/ets2panda/test/parser/ets/n_callInterfaceMethodWithNullableParam-expected.txt @@ -122,35 +122,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 23 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -158,7 +130,7 @@ }, "end": { "line": 17, - "column": 23 + "column": 22 } } }, @@ -170,7 +142,7 @@ }, "end": { "line": 17, - "column": 23 + "column": 22 } } }, @@ -181,7 +153,7 @@ }, "end": { "line": 17, - "column": 23 + "column": 22 } } }, @@ -429,35 +401,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -465,7 +409,7 @@ }, "end": { "line": 21, - "column": 24 + "column": 22 } } }, @@ -795,35 +739,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -831,7 +747,7 @@ }, "end": { "line": 24, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/n_callMethodWithNullableParam-expected.txt b/ets2panda/test/parser/ets/n_callMethodWithNullableParam-expected.txt index b84e5e8ae0..833d0450d0 100644 --- a/ets2panda/test/parser/ets/n_callMethodWithNullableParam-expected.txt +++ b/ets2panda/test/parser/ets/n_callMethodWithNullableParam-expected.txt @@ -138,35 +138,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -174,7 +146,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, @@ -504,35 +476,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -540,7 +484,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/native_function_with_return_type-expected.txt b/ets2panda/test/parser/ets/native_function_with_return_type-expected.txt index 06d46c9314..6b68f38ad1 100644 --- a/ets2panda/test/parser/ets/native_function_with_return_type-expected.txt +++ b/ets2panda/test/parser/ets/native_function_with_return_type-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -198,7 +170,7 @@ }, "end": { "line": 17, - "column": 29 + "column": 28 } } }, @@ -283,35 +255,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -319,7 +263,7 @@ }, "end": { "line": 19, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/native_function_without_return_type-expected.txt b/ets2panda/test/parser/ets/native_function_without_return_type-expected.txt index 7f087614ac..433ebc942b 100644 --- a/ets2panda/test/parser/ets/native_function_without_return_type-expected.txt +++ b/ets2panda/test/parser/ets/native_function_without_return_type-expected.txt @@ -242,35 +242,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -278,7 +250,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/new_expressions-expected.txt b/ets2panda/test/parser/ets/new_expressions-expected.txt index df3ea62456..b4101bed1b 100644 --- a/ets2panda/test/parser/ets/new_expressions-expected.txt +++ b/ets2panda/test/parser/ets/new_expressions-expected.txt @@ -300,35 +300,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -336,7 +308,7 @@ }, "end": { "line": 24, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/new_object_3-expected.txt b/ets2panda/test/parser/ets/new_object_3-expected.txt index 84dc0a7207..bba00c3c4e 100644 --- a/ets2panda/test/parser/ets/new_object_3-expected.txt +++ b/ets2panda/test/parser/ets/new_object_3-expected.txt @@ -162,43 +162,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 17, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, "column": 19 }, "end": { - "line": 17, - "column": 2 + "line": 16, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/nonIntegralIndex-expected.txt b/ets2panda/test/parser/ets/nonIntegralIndex-expected.txt index c714438db0..67646bd14f 100644 --- a/ets2panda/test/parser/ets/nonIntegralIndex-expected.txt +++ b/ets2panda/test/parser/ets/nonIntegralIndex-expected.txt @@ -164,35 +164,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 46 - }, - "end": { - "line": 17, - "column": 50 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 46 - }, - "end": { - "line": 17, - "column": 52 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -200,7 +172,7 @@ }, "end": { "line": 17, - "column": 52 + "column": 50 } } }, diff --git a/ets2panda/test/parser/ets/null-expected.txt b/ets2panda/test/parser/ets/null-expected.txt index f8d95b5469..cbdf5e9028 100644 --- a/ets2panda/test/parser/ets/null-expected.txt +++ b/ets2panda/test/parser/ets/null-expected.txt @@ -733,35 +733,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 33 - }, - "end": { - "line": 21, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 33 - }, - "end": { - "line": 21, - "column": 39 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -769,7 +741,7 @@ }, "end": { "line": 21, - "column": 39 + "column": 37 } } }, @@ -868,35 +840,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -904,7 +848,7 @@ }, "end": { "line": 24, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/nullableType-expected.txt b/ets2panda/test/parser/ets/nullableType-expected.txt index ed0d540685..1dac23b140 100644 --- a/ets2panda/test/parser/ets/nullableType-expected.txt +++ b/ets2panda/test/parser/ets/nullableType-expected.txt @@ -1591,35 +1591,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -1627,7 +1599,7 @@ }, "end": { "line": 24, - "column": 24 + "column": 22 } } }, @@ -1856,35 +1828,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 26 - }, - "end": { - "line": 30, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 26 - }, - "end": { - "line": 30, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 30, @@ -1892,7 +1836,7 @@ }, "end": { "line": 30, - "column": 32 + "column": 30 } } }, @@ -4473,35 +4417,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 65, - "column": 31 - }, - "end": { - "line": 65, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 65, - "column": 31 - }, - "end": { - "line": 65, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 65, @@ -4509,7 +4425,7 @@ }, "end": { "line": 65, - "column": 37 + "column": 35 } } }, @@ -4820,35 +4736,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 70, - "column": 31 - }, - "end": { - "line": 70, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 70, - "column": 31 - }, - "end": { - "line": 70, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 70, @@ -4856,7 +4744,7 @@ }, "end": { "line": 70, - "column": 37 + "column": 35 } } }, @@ -9296,35 +9184,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 144, - "column": 29 - }, - "end": { - "line": 144, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 144, - "column": 29 - }, - "end": { - "line": 144, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 144, @@ -9332,7 +9192,7 @@ }, "end": { "line": 144, - "column": 35 + "column": 33 } } }, diff --git a/ets2panda/test/parser/ets/nullable_union_array-expected.txt b/ets2panda/test/parser/ets/nullable_union_array-expected.txt index b2df922323..26028df0d9 100644 --- a/ets2panda/test/parser/ets/nullable_union_array-expected.txt +++ b/ets2panda/test/parser/ets/nullable_union_array-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/optional_union_paramter-expected.txt b/ets2panda/test/parser/ets/optional_union_paramter-expected.txt index 22c62beb9b..97356b2fa1 100644 --- a/ets2panda/test/parser/ets/optional_union_paramter-expected.txt +++ b/ets2panda/test/parser/ets/optional_union_paramter-expected.txt @@ -1187,35 +1187,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 20 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 20 - }, - "end": { - "line": 21, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -1223,7 +1195,7 @@ }, "end": { "line": 21, - "column": 26 + "column": 24 } } }, diff --git a/ets2panda/test/parser/ets/overrideStaticFunc-expected.txt b/ets2panda/test/parser/ets/overrideStaticFunc-expected.txt index 65967293ae..28523cc7c3 100644 --- a/ets2panda/test/parser/ets/overrideStaticFunc-expected.txt +++ b/ets2panda/test/parser/ets/overrideStaticFunc-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 22 - }, - "end": { - "line": 17, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 22 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 28 + "column": 26 } } }, @@ -380,35 +352,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 15 - }, - "end": { - "line": 21, - "column": 19 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 15 - }, - "end": { - "line": 21, - "column": 21 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -416,7 +360,7 @@ }, "end": { "line": 21, - "column": 21 + "column": 19 } } }, @@ -636,35 +580,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 13 - }, - "end": { - "line": 25, - "column": 17 - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 13 - }, - "end": { - "line": 25, - "column": 19 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 25, @@ -672,7 +588,7 @@ }, "end": { "line": 25, - "column": 19 + "column": 17 } } }, diff --git a/ets2panda/test/parser/ets/parentheses_expression_value-expected.txt b/ets2panda/test/parser/ets/parentheses_expression_value-expected.txt index 38eb06e701..79db720826 100644 --- a/ets2panda/test/parser/ets/parentheses_expression_value-expected.txt +++ b/ets2panda/test/parser/ets/parentheses_expression_value-expected.txt @@ -589,35 +589,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -625,7 +597,7 @@ }, "end": { "line": 21, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/property-access-method-1-expected.txt b/ets2panda/test/parser/ets/property-access-method-1-expected.txt index 58a190143c..3eeff6b372 100644 --- a/ets2panda/test/parser/ets/property-access-method-1-expected.txt +++ b/ets2panda/test/parser/ets/property-access-method-1-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 25 + "column": 23 } } }, @@ -203,35 +175,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 23 - }, - "end": { - "line": 19, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 23 - }, - "end": { - "line": 19, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -239,7 +183,7 @@ }, "end": { "line": 19, - "column": 29 + "column": 27 } } }, diff --git a/ets2panda/test/parser/ets/property-access-method-2-expected.txt b/ets2panda/test/parser/ets/property-access-method-2-expected.txt index 4e8f873553..63383abaa1 100644 --- a/ets2panda/test/parser/ets/property-access-method-2-expected.txt +++ b/ets2panda/test/parser/ets/property-access-method-2-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 12 - }, - "end": { - "line": 18, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 12 - }, - "end": { - "line": 18, - "column": 18 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -104,7 +76,7 @@ }, "end": { "line": 18, - "column": 18 + "column": 16 } } }, @@ -203,35 +175,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 23 - }, - "end": { - "line": 20, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 23 - }, - "end": { - "line": 20, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -239,7 +183,7 @@ }, "end": { "line": 20, - "column": 29 + "column": 27 } } }, diff --git a/ets2panda/test/parser/ets/proxyVoidGeneration-expected.txt b/ets2panda/test/parser/ets/proxyVoidGeneration-expected.txt index d5aa05a5b9..c1e9196668 100644 --- a/ets2panda/test/parser/ets/proxyVoidGeneration-expected.txt +++ b/ets2panda/test/parser/ets/proxyVoidGeneration-expected.txt @@ -166,35 +166,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 38 - }, - "end": { - "line": 17, - "column": 42 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 38 - }, - "end": { - "line": 17, - "column": 44 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -202,7 +174,7 @@ }, "end": { "line": 17, - "column": 44 + "column": 42 } } }, @@ -289,35 +261,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 38 - }, - "end": { - "line": 17, - "column": 42 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 38 - }, - "end": { - "line": 17, - "column": 44 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -325,7 +269,7 @@ }, "end": { "line": 17, - "column": 44 + "column": 42 } } }, @@ -622,35 +566,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -658,7 +574,7 @@ }, "end": { "line": 18, - "column": 35 + "column": 33 } } }, @@ -745,35 +661,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -781,7 +669,7 @@ }, "end": { "line": 18, - "column": 35 + "column": 33 } } }, diff --git a/ets2panda/test/parser/ets/re_export/export-expected.txt b/ets2panda/test/parser/ets/re_export/export-expected.txt index ab233733e6..ff11037079 100644 --- a/ets2panda/test/parser/ets/re_export/export-expected.txt +++ b/ets2panda/test/parser/ets/re_export/export-expected.txt @@ -162,43 +162,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 17, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, "column": 23 }, "end": { - "line": 17, - "column": 2 + "line": 16, + "column": 27 } } }, diff --git a/ets2panda/test/parser/ets/re_export/export_2-expected.txt b/ets2panda/test/parser/ets/re_export/export_2-expected.txt index ab233733e6..ff11037079 100644 --- a/ets2panda/test/parser/ets/re_export/export_2-expected.txt +++ b/ets2panda/test/parser/ets/re_export/export_2-expected.txt @@ -162,43 +162,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 17, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, "column": 23 }, "end": { - "line": 17, - "column": 2 + "line": 16, + "column": 27 } } }, diff --git a/ets2panda/test/parser/ets/re_export/folder/export-expected.txt b/ets2panda/test/parser/ets/re_export/folder/export-expected.txt index ab233733e6..ff11037079 100644 --- a/ets2panda/test/parser/ets/re_export/folder/export-expected.txt +++ b/ets2panda/test/parser/ets/re_export/folder/export-expected.txt @@ -162,43 +162,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 17, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, "column": 23 }, "end": { - "line": 17, - "column": 2 + "line": 16, + "column": 27 } } }, diff --git a/ets2panda/test/parser/ets/re_export/folder/folder2/export-expected.txt b/ets2panda/test/parser/ets/re_export/folder/folder2/export-expected.txt index ab233733e6..ff11037079 100644 --- a/ets2panda/test/parser/ets/re_export/folder/folder2/export-expected.txt +++ b/ets2panda/test/parser/ets/re_export/folder/folder2/export-expected.txt @@ -162,43 +162,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 17, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, "column": 23 }, "end": { - "line": 17, - "column": 2 + "line": 16, + "column": 27 } } }, diff --git a/ets2panda/test/parser/ets/re_export/import-expected.txt b/ets2panda/test/parser/ets/re_export/import-expected.txt index 76365e0577..cc2444722a 100644 --- a/ets2panda/test/parser/ets/re_export/import-expected.txt +++ b/ets2panda/test/parser/ets/re_export/import-expected.txt @@ -219,43 +219,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, "column": 19 }, "end": { - "line": 19, - "column": 2 + "line": 18, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/re_export/import_2-expected.txt b/ets2panda/test/parser/ets/re_export/import_2-expected.txt index 1a75bf6ad8..4e6ad800c6 100644 --- a/ets2panda/test/parser/ets/re_export/import_2-expected.txt +++ b/ets2panda/test/parser/ets/re_export/import_2-expected.txt @@ -219,43 +219,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, "column": 19 }, "end": { - "line": 19, - "column": 2 + "line": 18, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/re_export/import_3-expected.txt b/ets2panda/test/parser/ets/re_export/import_3-expected.txt index a86adcff2f..3027ee9616 100644 --- a/ets2panda/test/parser/ets/re_export/import_3-expected.txt +++ b/ets2panda/test/parser/ets/re_export/import_3-expected.txt @@ -234,43 +234,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, "column": 19 }, "end": { - "line": 19, - "column": 2 + "line": 18, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/re_export/import_4-expected.txt b/ets2panda/test/parser/ets/re_export/import_4-expected.txt index abd5c3d1b7..ebe35836b8 100644 --- a/ets2panda/test/parser/ets/re_export/import_4-expected.txt +++ b/ets2panda/test/parser/ets/re_export/import_4-expected.txt @@ -219,43 +219,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, "column": 19 }, "end": { - "line": 19, - "column": 2 + "line": 18, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/re_export/import_5-expected.txt b/ets2panda/test/parser/ets/re_export/import_5-expected.txt index a6bc554d84..e8609cf103 100644 --- a/ets2panda/test/parser/ets/re_export/import_5-expected.txt +++ b/ets2panda/test/parser/ets/re_export/import_5-expected.txt @@ -219,43 +219,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, "column": 19 }, "end": { - "line": 19, - "column": 2 + "line": 18, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/re_export/import_6-expected.txt b/ets2panda/test/parser/ets/re_export/import_6-expected.txt index 2e1f1af0db..02b7f2b2d0 100644 --- a/ets2panda/test/parser/ets/re_export/import_6-expected.txt +++ b/ets2panda/test/parser/ets/re_export/import_6-expected.txt @@ -219,43 +219,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, "column": 19 }, "end": { - "line": 19, - "column": 2 + "line": 18, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/re_export/import_7-expected.txt b/ets2panda/test/parser/ets/re_export/import_7-expected.txt index 40f7893eb1..06508df534 100644 --- a/ets2panda/test/parser/ets/re_export/import_7-expected.txt +++ b/ets2panda/test/parser/ets/re_export/import_7-expected.txt @@ -219,43 +219,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, "column": 19 }, "end": { - "line": 19, - "column": 2 + "line": 18, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/re_export/import_8-expected.txt b/ets2panda/test/parser/ets/re_export/import_8-expected.txt index 4d8d1f6639..a32d13f7c5 100644 --- a/ets2panda/test/parser/ets/re_export/import_8-expected.txt +++ b/ets2panda/test/parser/ets/re_export/import_8-expected.txt @@ -219,43 +219,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, "column": 19 }, "end": { - "line": 19, - "column": 2 + "line": 18, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/regression-target-type-context-expected.txt b/ets2panda/test/parser/ets/regression-target-type-context-expected.txt index a287010dbf..8c09e57e3f 100644 --- a/ets2panda/test/parser/ets/regression-target-type-context-expected.txt +++ b/ets2panda/test/parser/ets/regression-target-type-context-expected.txt @@ -873,35 +873,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 14 - }, - "end": { - "line": 24, - "column": 18 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 14 - }, - "end": { - "line": 24, - "column": 20 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -909,7 +881,7 @@ }, "end": { "line": 24, - "column": 20 + "column": 18 } } }, diff --git a/ets2panda/test/parser/ets/rethrow-func-1-expected.txt b/ets2panda/test/parser/ets/rethrow-func-1-expected.txt index 0427944a28..0d1ec375f8 100644 --- a/ets2panda/test/parser/ets/rethrow-func-1-expected.txt +++ b/ets2panda/test/parser/ets/rethrow-func-1-expected.txt @@ -22,35 +22,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -58,7 +30,7 @@ }, "end": { "line": 16, - "column": 35 + "column": 28 } } } @@ -70,7 +42,7 @@ }, "end": { "line": 16, - "column": 35 + "column": 28 } } }, @@ -543,35 +515,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 18 - }, - "end": { - "line": 23, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 18 - }, - "end": { - "line": 23, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -579,7 +523,7 @@ }, "end": { "line": 23, - "column": 24 + "column": 22 } } }, @@ -657,35 +601,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 33 - }, - "end": { - "line": 24, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 33 - }, - "end": { - "line": 24, - "column": 40 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -693,7 +609,7 @@ }, "end": { "line": 24, - "column": 40 + "column": 37 } } }, diff --git a/ets2panda/test/parser/ets/return-expected.txt b/ets2panda/test/parser/ets/return-expected.txt index 45f9c493e3..9fbd1a66f1 100644 --- a/ets2panda/test/parser/ets/return-expected.txt +++ b/ets2panda/test/parser/ets/return-expected.txt @@ -324,35 +324,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -360,7 +332,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/scoped_decl-expected.txt b/ets2panda/test/parser/ets/scoped_decl-expected.txt index eb61c9058d..38c30b0af7 100644 --- a/ets2panda/test/parser/ets/scoped_decl-expected.txt +++ b/ets2panda/test/parser/ets/scoped_decl-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/selective_export/import_1-expected.txt b/ets2panda/test/parser/ets/selective_export/import_1-expected.txt index 1da65f2be0..9a3210b017 100644 --- a/ets2panda/test/parser/ets/selective_export/import_1-expected.txt +++ b/ets2panda/test/parser/ets/selective_export/import_1-expected.txt @@ -219,43 +219,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, "column": 19 }, "end": { - "line": 19, - "column": 2 + "line": 18, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/selective_export/import_2-expected.txt b/ets2panda/test/parser/ets/selective_export/import_2-expected.txt index 9ca0096dd0..829e9dac09 100644 --- a/ets2panda/test/parser/ets/selective_export/import_2-expected.txt +++ b/ets2panda/test/parser/ets/selective_export/import_2-expected.txt @@ -219,43 +219,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, "column": 19 }, "end": { - "line": 19, - "column": 2 + "line": 18, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/selective_export/import_3-expected.txt b/ets2panda/test/parser/ets/selective_export/import_3-expected.txt index 3988409545..57953c6b69 100644 --- a/ets2panda/test/parser/ets/selective_export/import_3-expected.txt +++ b/ets2panda/test/parser/ets/selective_export/import_3-expected.txt @@ -219,43 +219,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, "column": 19 }, "end": { - "line": 19, - "column": 2 + "line": 18, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/selective_export/import_4-expected.txt b/ets2panda/test/parser/ets/selective_export/import_4-expected.txt index a35238d3d1..39ae388e12 100644 --- a/ets2panda/test/parser/ets/selective_export/import_4-expected.txt +++ b/ets2panda/test/parser/ets/selective_export/import_4-expected.txt @@ -219,43 +219,15 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, "column": 19 }, "end": { - "line": 19, - "column": 2 + "line": 18, + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/setter_native-expected.txt b/ets2panda/test/parser/ets/setter_native-expected.txt index a36ac42314..10aa2e6d18 100644 --- a/ets2panda/test/parser/ets/setter_native-expected.txt +++ b/ets2panda/test/parser/ets/setter_native-expected.txt @@ -159,35 +159,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 30 - }, - "end": { - "line": 18, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 30 - }, - "end": { - "line": 18, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -195,7 +167,7 @@ }, "end": { "line": 18, - "column": 36 + "column": 34 } } }, diff --git a/ets2panda/test/parser/ets/setter_with_non_void-expected.txt b/ets2panda/test/parser/ets/setter_with_non_void-expected.txt index d346044787..699eb1f4a7 100644 --- a/ets2panda/test/parser/ets/setter_with_non_void-expected.txt +++ b/ets2panda/test/parser/ets/setter_with_non_void-expected.txt @@ -582,35 +582,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -618,7 +590,7 @@ }, "end": { "line": 24, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/simple_types-expected.txt b/ets2panda/test/parser/ets/simple_types-expected.txt index ce0e4dda7f..7c49b45744 100644 --- a/ets2panda/test/parser/ets/simple_types-expected.txt +++ b/ets2panda/test/parser/ets/simple_types-expected.txt @@ -970,35 +970,7 @@ "optional": false, "computed": false, "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 12 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 13 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -1006,7 +978,7 @@ }, "end": { "line": 24, - "column": 13 + "column": 12 } } }, diff --git a/ets2panda/test/parser/ets/static_function_override_1-expected.txt b/ets2panda/test/parser/ets/static_function_override_1-expected.txt index 31301941e5..80a998c431 100644 --- a/ets2panda/test/parser/ets/static_function_override_1-expected.txt +++ b/ets2panda/test/parser/ets/static_function_override_1-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 20 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 20 - }, - "end": { - "line": 17, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 26 + "column": 24 } } }, @@ -380,35 +352,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 20 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 20 - }, - "end": { - "line": 21, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -416,7 +360,7 @@ }, "end": { "line": 21, - "column": 26 + "column": 24 } } }, diff --git a/ets2panda/test/parser/ets/static_function_override_2-expected.txt b/ets2panda/test/parser/ets/static_function_override_2-expected.txt index 5a8bd44985..34509d6823 100644 --- a/ets2panda/test/parser/ets/static_function_override_2-expected.txt +++ b/ets2panda/test/parser/ets/static_function_override_2-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 18 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 18 + "column": 16 } } }, @@ -380,35 +352,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 19 - }, - "end": { - "line": 21, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 19 - }, - "end": { - "line": 21, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -416,7 +360,7 @@ }, "end": { "line": 21, - "column": 25 + "column": 23 } } }, diff --git a/ets2panda/test/parser/ets/static_function_override_3-expected.txt b/ets2panda/test/parser/ets/static_function_override_3-expected.txt index ef25ad7085..f12cc2fb07 100644 --- a/ets2panda/test/parser/ets/static_function_override_3-expected.txt +++ b/ets2panda/test/parser/ets/static_function_override_3-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 25 + "column": 23 } } }, @@ -380,35 +352,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 12 - }, - "end": { - "line": 21, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 12 - }, - "end": { - "line": 21, - "column": 18 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -416,7 +360,7 @@ }, "end": { "line": 21, - "column": 18 + "column": 16 } } }, diff --git a/ets2panda/test/parser/ets/static_function_override_4-expected.txt b/ets2panda/test/parser/ets/static_function_override_4-expected.txt index 5d48d160d5..d95084dbb8 100644 --- a/ets2panda/test/parser/ets/static_function_override_4-expected.txt +++ b/ets2panda/test/parser/ets/static_function_override_4-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 25 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 25 + "column": 23 } } }, @@ -380,35 +352,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -416,7 +360,7 @@ }, "end": { "line": 21, - "column": 27 + "column": 25 } } }, diff --git a/ets2panda/test/parser/ets/static_invoke_tests/static_invoke_mismatch_signature_2-expected.txt b/ets2panda/test/parser/ets/static_invoke_tests/static_invoke_mismatch_signature_2-expected.txt index f796f0d37d..e127a15040 100644 --- a/ets2panda/test/parser/ets/static_invoke_tests/static_invoke_mismatch_signature_2-expected.txt +++ b/ets2panda/test/parser/ets/static_invoke_tests/static_invoke_mismatch_signature_2-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -104,7 +76,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 31 } } }, diff --git a/ets2panda/test/parser/ets/string_template-expected.txt b/ets2panda/test/parser/ets/string_template-expected.txt index 3efbbd8bd5..eb424db468 100644 --- a/ets2panda/test/parser/ets/string_template-expected.txt +++ b/ets2panda/test/parser/ets/string_template-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/struct_templete-expected.txt b/ets2panda/test/parser/ets/struct_templete-expected.txt index 5060c2b73b..387e53bcad 100644 --- a/ets2panda/test/parser/ets/struct_templete-expected.txt +++ b/ets2panda/test/parser/ets/struct_templete-expected.txt @@ -932,35 +932,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 18 - }, - "end": { - "line": 28, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -968,7 +940,7 @@ }, "end": { "line": 28, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/switch-expected.txt b/ets2panda/test/parser/ets/switch-expected.txt index bf956fcd08..27e4e9a9bc 100644 --- a/ets2panda/test/parser/ets/switch-expected.txt +++ b/ets2panda/test/parser/ets/switch-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -198,7 +170,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/switch2-expected.txt b/ets2panda/test/parser/ets/switch2-expected.txt index 0f1939f693..26d29e343c 100644 --- a/ets2panda/test/parser/ets/switch2-expected.txt +++ b/ets2panda/test/parser/ets/switch2-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -198,7 +170,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/switch_enum-expected.txt b/ets2panda/test/parser/ets/switch_enum-expected.txt index f4d9debe2d..d2722c344c 100644 --- a/ets2panda/test/parser/ets/switch_enum-expected.txt +++ b/ets2panda/test/parser/ets/switch_enum-expected.txt @@ -319,35 +319,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -355,7 +327,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/switch_enum2-expected.txt b/ets2panda/test/parser/ets/switch_enum2-expected.txt index 59ed0f5ca2..e54916e2ca 100644 --- a/ets2panda/test/parser/ets/switch_enum2-expected.txt +++ b/ets2panda/test/parser/ets/switch_enum2-expected.txt @@ -319,35 +319,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -355,7 +327,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/test_interface-expected.txt b/ets2panda/test/parser/ets/test_interface-expected.txt index 176f14aabf..47210d2f38 100644 --- a/ets2panda/test/parser/ets/test_interface-expected.txt +++ b/ets2panda/test/parser/ets/test_interface-expected.txt @@ -1030,35 +1030,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 12 - }, - "end": { - "line": 23, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 12 - }, - "end": { - "line": 23, - "column": 17 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -1067,6 +1039,7 @@ "end": { "line": 23, "column": 17 + "column": 16 } } }, @@ -1078,7 +1051,7 @@ }, "end": { "line": 23, - "column": 17 + "column": 16 } } }, @@ -1182,35 +1155,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 31 - }, - "end": { - "line": 26, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 31 - }, - "end": { - "line": 26, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 26, @@ -1218,7 +1163,7 @@ }, "end": { "line": 26, - "column": 37 + "column": 35 } } }, @@ -1373,35 +1318,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 26 - }, - "end": { - "line": 24, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 26 - }, - "end": { - "line": 24, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -1409,7 +1326,7 @@ }, "end": { "line": 24, - "column": 32 + "column": 30 } } }, diff --git a/ets2panda/test/parser/ets/test_jsvalue_set_double-expected.txt b/ets2panda/test/parser/ets/test_jsvalue_set_double-expected.txt index 193072b36e..28dc200fff 100644 --- a/ets2panda/test/parser/ets/test_jsvalue_set_double-expected.txt +++ b/ets2panda/test/parser/ets/test_jsvalue_set_double-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 16 - }, - "end": { - "line": 16, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 16 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 22 + "column": 20 } } }, diff --git a/ets2panda/test/parser/ets/test_jsvalue_set_property_1-expected.txt b/ets2panda/test/parser/ets/test_jsvalue_set_property_1-expected.txt index 48beaae200..652817c1c2 100644 --- a/ets2panda/test/parser/ets/test_jsvalue_set_property_1-expected.txt +++ b/ets2panda/test/parser/ets/test_jsvalue_set_property_1-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 16 - }, - "end": { - "line": 16, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 16 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 22 + "column": 20 } } }, diff --git a/ets2panda/test/parser/ets/test_jsvalue_set_property_2-expected.txt b/ets2panda/test/parser/ets/test_jsvalue_set_property_2-expected.txt index 286306f1ac..a4259c59b6 100644 --- a/ets2panda/test/parser/ets/test_jsvalue_set_property_2-expected.txt +++ b/ets2panda/test/parser/ets/test_jsvalue_set_property_2-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 16 - }, - "end": { - "line": 16, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 16 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 22 + "column": 20 } } }, diff --git a/ets2panda/test/parser/ets/test_type_alias7-expected.txt b/ets2panda/test/parser/ets/test_type_alias7-expected.txt index bb931f984e..b2edf1cc7b 100644 --- a/ets2panda/test/parser/ets/test_type_alias7-expected.txt +++ b/ets2panda/test/parser/ets/test_type_alias7-expected.txt @@ -203,35 +203,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -239,7 +211,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/test_type_alias8-expected.txt b/ets2panda/test/parser/ets/test_type_alias8-expected.txt index 58cd0b30d6..b0985d5d7a 100644 --- a/ets2panda/test/parser/ets/test_type_alias8-expected.txt +++ b/ets2panda/test/parser/ets/test_type_alias8-expected.txt @@ -301,35 +301,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -337,7 +309,7 @@ }, "end": { "line": 18, - "column": 32 + "column": 30 } } }, @@ -506,35 +478,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 21, @@ -542,7 +486,7 @@ }, "end": { "line": 21, - "column": 30 + "column": 28 } } }, @@ -641,35 +585,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -677,7 +593,7 @@ }, "end": { "line": 24, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/throwsRethrowsAsVariables-expected.txt b/ets2panda/test/parser/ets/throwsRethrowsAsVariables-expected.txt index f0c71fd715..d1ea49ee75 100644 --- a/ets2panda/test/parser/ets/throwsRethrowsAsVariables-expected.txt +++ b/ets2panda/test/parser/ets/throwsRethrowsAsVariables-expected.txt @@ -375,35 +375,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 26 - }, - "end": { - "line": 19, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 26 - }, - "end": { - "line": 19, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -411,7 +383,7 @@ }, "end": { "line": 19, - "column": 37 + "column": 30 } } }, @@ -519,35 +491,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 33 - }, - "end": { - "line": 20, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 33 - }, - "end": { - "line": 20, - "column": 44 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -555,7 +499,7 @@ }, "end": { "line": 20, - "column": 44 + "column": 37 } } } @@ -567,7 +511,7 @@ }, "end": { "line": 20, - "column": 44 + "column": 37 } } }, @@ -579,7 +523,7 @@ }, "end": { "line": 20, - "column": 44 + "column": 37 } } }, @@ -590,41 +534,13 @@ }, "end": { "line": 20, - "column": 44 + "column": 37 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 47 - }, - "end": { - "line": 20, - "column": 51 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 47 - }, - "end": { - "line": 20, - "column": 60 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -632,7 +548,7 @@ }, "end": { "line": 20, - "column": 60 + "column": 51 } } }, diff --git a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_define_lambda_in_body-expected.txt b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_define_lambda_in_body-expected.txt index 0065010236..40eef6db2b 100644 --- a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_define_lambda_in_body-expected.txt +++ b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_define_lambda_in_body-expected.txt @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 29 + "column": 28 } } }, @@ -217,7 +189,7 @@ }, "end": { "line": 16, - "column": 29 + "column": 28 } } }, @@ -229,7 +201,7 @@ }, "end": { "line": 16, - "column": 29 + "column": 28 } } }, @@ -240,41 +212,13 @@ }, "end": { "line": 16, - "column": 29 + "column": 28 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 31 - }, - "end": { - "line": 16, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 31 - }, - "end": { - "line": 16, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -282,7 +226,7 @@ }, "end": { "line": 16, - "column": 37 + "column": 35 } } }, @@ -425,35 +369,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -461,7 +377,7 @@ }, "end": { "line": 20, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_mismatch_lambda_signature-expected.txt b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_mismatch_lambda_signature-expected.txt index f3e0754f7f..27e8ce09b1 100644 --- a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_mismatch_lambda_signature-expected.txt +++ b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_mismatch_lambda_signature-expected.txt @@ -319,35 +319,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 25 - }, - "end": { - "line": 17, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 25 - }, - "end": { - "line": 17, - "column": 30 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -355,7 +327,7 @@ }, "end": { "line": 17, - "column": 30 + "column": 29 } } }, @@ -366,7 +338,7 @@ }, "end": { "line": 17, - "column": 30 + "column": 29 } } }, @@ -378,7 +350,7 @@ }, "end": { "line": 17, - "column": 30 + "column": 29 } } }, @@ -389,7 +361,7 @@ }, "end": { "line": 17, - "column": 30 + "column": 29 } } } diff --git a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_mismatch_lambda_signature_1-expected.txt b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_mismatch_lambda_signature_1-expected.txt index d28a8d4b71..f5296dca4c 100644 --- a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_mismatch_lambda_signature_1-expected.txt +++ b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_mismatch_lambda_signature_1-expected.txt @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } }, @@ -217,7 +189,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } }, @@ -229,7 +201,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } }, @@ -240,7 +212,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } } diff --git a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_1-expected.txt b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_1-expected.txt index 2b121252b4..99138c5325 100644 --- a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_1-expected.txt +++ b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_1-expected.txt @@ -260,35 +260,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -296,7 +268,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } }, @@ -307,7 +279,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } }, @@ -319,7 +291,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } }, @@ -330,7 +302,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } } diff --git a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_2-expected.txt b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_2-expected.txt index 338dae3eb5..5cf1da5e21 100644 --- a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_2-expected.txt +++ b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_2-expected.txt @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } }, @@ -217,7 +189,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } }, @@ -229,7 +201,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } }, @@ -240,7 +212,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } } diff --git a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_3-expected.txt b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_3-expected.txt index 848c68a958..7a02693290 100644 --- a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_3-expected.txt +++ b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_3-expected.txt @@ -76,35 +76,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -112,7 +84,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 32 } } }, @@ -123,7 +95,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 32 } } }, @@ -135,7 +107,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 32 } } }, @@ -146,7 +118,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 32 } } } @@ -384,35 +356,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -420,7 +364,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_4-expected.txt b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_4-expected.txt index 8b2aba34a5..d531519af8 100644 --- a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_4-expected.txt +++ b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_not_transform_trailing_block_4-expected.txt @@ -76,35 +76,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -112,7 +84,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 32 } } }, @@ -123,7 +95,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 32 } } }, @@ -135,7 +107,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 32 } } }, @@ -146,7 +118,7 @@ }, "end": { "line": 17, - "column": 33 + "column": 32 } } } @@ -384,35 +356,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -420,7 +364,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_overload-expected.txt b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_overload-expected.txt index efb009850f..477129e0c7 100644 --- a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_overload-expected.txt +++ b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_overload-expected.txt @@ -211,35 +211,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 36 - }, - "end": { - "line": 16, - "column": 40 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 36 - }, - "end": { - "line": 16, - "column": 41 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -247,7 +219,7 @@ }, "end": { "line": 16, - "column": 41 + "column": 40 } } }, @@ -258,7 +230,7 @@ }, "end": { "line": 16, - "column": 41 + "column": 40 } } }, @@ -270,7 +242,7 @@ }, "end": { "line": 16, - "column": 41 + "column": 40 } } }, @@ -281,7 +253,7 @@ }, "end": { "line": 16, - "column": 41 + "column": 40 } } } diff --git a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_overload_1-expected.txt b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_overload_1-expected.txt index 207b01ff01..d850e53e7a 100644 --- a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_overload_1-expected.txt +++ b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_overload_1-expected.txt @@ -240,35 +240,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 31 - }, - "end": { - "line": 16, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 31 - }, - "end": { - "line": 16, - "column": 36 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -276,7 +248,7 @@ }, "end": { "line": 16, - "column": 36 + "column": 35 } } }, @@ -287,7 +259,7 @@ }, "end": { "line": 16, - "column": 36 + "column": 35 } } }, @@ -299,7 +271,7 @@ }, "end": { "line": 16, - "column": 36 + "column": 35 } } }, @@ -310,7 +282,7 @@ }, "end": { "line": 16, - "column": 36 + "column": 35 } } }, @@ -323,35 +295,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 45 - }, - "end": { - "line": 16, - "column": 49 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 45 - }, - "end": { - "line": 16, - "column": 50 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -359,7 +303,7 @@ }, "end": { "line": 16, - "column": 50 + "column": 49 } } }, @@ -370,7 +314,7 @@ }, "end": { "line": 16, - "column": 50 + "column": 49 } } }, @@ -382,7 +326,7 @@ }, "end": { "line": 16, - "column": 50 + "column": 49 } } }, @@ -393,7 +337,7 @@ }, "end": { "line": 16, - "column": 50 + "column": 49 } } } @@ -531,35 +475,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 28 - }, - "end": { - "line": 18, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 28 - }, - "end": { - "line": 18, - "column": 33 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -567,7 +483,7 @@ }, "end": { "line": 18, - "column": 33 + "column": 32 } } }, @@ -578,7 +494,7 @@ }, "end": { "line": 18, - "column": 33 + "column": 32 } } }, @@ -590,7 +506,7 @@ }, "end": { "line": 18, - "column": 33 + "column": 32 } } }, @@ -601,7 +517,7 @@ }, "end": { "line": 18, - "column": 33 + "column": 32 } } } diff --git a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_transform_trailing_block-expected.txt b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_transform_trailing_block-expected.txt index 957c812c6e..5996f3b112 100644 --- a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_transform_trailing_block-expected.txt +++ b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_transform_trailing_block-expected.txt @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } }, @@ -217,7 +189,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } }, @@ -229,7 +201,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } }, @@ -240,7 +212,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } } } diff --git a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_type_alias-expected.txt b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_type_alias-expected.txt index 99714c860f..666f33da52 100644 --- a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_type_alias-expected.txt +++ b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_type_alias-expected.txt @@ -22,43 +22,15 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 20 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 20 - }, - "end": { - "line": 18, - "column": 9 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, "column": 20 }, "end": { - "line": 18, - "column": 9 + "line": 16, + "column": 24 } } }, @@ -68,8 +40,8 @@ "column": 14 }, "end": { - "line": 18, - "column": 9 + "line": 16, + "column": 24 } } }, @@ -315,35 +287,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 25 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 25 - }, - "end": { - "line": 18, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -351,7 +295,7 @@ }, "end": { "line": 18, - "column": 31 + "column": 29 } } }, @@ -494,35 +438,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 18 - }, - "end": { - "line": 23, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 18 - }, - "end": { - "line": 23, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -530,7 +446,7 @@ }, "end": { "line": 23, - "column": 24 + "column": 22 } } }, 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 index 30bb12ad2e..f02e6b5a18 100644 --- 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 @@ -170,35 +170,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 21 - }, - "end": { - "line": 16, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 21 - }, - "end": { - "line": 16, - "column": 32 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -206,7 +178,7 @@ }, "end": { "line": 16, - "column": 32 + "column": 25 } } } @@ -218,7 +190,7 @@ }, "end": { "line": 16, - "column": 32 + "column": 25 } } }, @@ -230,7 +202,7 @@ }, "end": { "line": 16, - "column": 32 + "column": 25 } } }, @@ -241,7 +213,7 @@ }, "end": { "line": 16, - "column": 32 + "column": 25 } } } @@ -349,35 +321,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 22 - }, - "end": { - "line": 19, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 22 - }, - "end": { - "line": 19, - "column": 27 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -385,7 +329,7 @@ }, "end": { "line": 19, - "column": 27 + "column": 26 } } }, @@ -396,7 +340,7 @@ }, "end": { "line": 19, - "column": 27 + "column": 26 } } }, @@ -408,7 +352,7 @@ }, "end": { "line": 19, - "column": 27 + "column": 26 } } }, @@ -419,7 +363,7 @@ }, "end": { "line": 19, - "column": 27 + "column": 26 } } } diff --git a/ets2panda/test/parser/ets/type_variance1-expected.txt b/ets2panda/test/parser/ets/type_variance1-expected.txt index 526d6a2a59..a877e97aa7 100644 --- a/ets2panda/test/parser/ets/type_variance1-expected.txt +++ b/ets2panda/test/parser/ets/type_variance1-expected.txt @@ -182,35 +182,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 16 - }, - "end": { - "line": 17, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 16 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 17, @@ -218,7 +190,7 @@ }, "end": { "line": 17, - "column": 22 + "column": 20 } } }, @@ -508,35 +480,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 19 - }, - "end": { - "line": 23, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 19 - }, - "end": { - "line": 23, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -544,7 +488,7 @@ }, "end": { "line": 23, - "column": 24 + "column": 23 } } }, @@ -556,7 +500,7 @@ }, "end": { "line": 23, - "column": 24 + "column": 23 } } }, @@ -567,7 +511,7 @@ }, "end": { "line": 23, - "column": 24 + "column": 23 } } }, @@ -939,35 +883,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 19 - }, - "end": { - "line": 28, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 19 - }, - "end": { - "line": 28, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 28, @@ -975,7 +891,7 @@ }, "end": { "line": 28, - "column": 24 + "column": 23 } } }, @@ -987,7 +903,7 @@ }, "end": { "line": 28, - "column": 24 + "column": 23 } } }, @@ -998,7 +914,7 @@ }, "end": { "line": 28, - "column": 24 + "column": 23 } } }, @@ -1673,35 +1589,7 @@ } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 35, - "column": 25 - }, - "end": { - "line": 35, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 35, - "column": 25 - }, - "end": { - "line": 35, - "column": 31 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 35, @@ -1709,7 +1597,7 @@ }, "end": { "line": 35, - "column": 31 + "column": 29 } } }, @@ -3300,35 +3188,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 57, - "column": 18 - }, - "end": { - "line": 57, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 57, - "column": 18 - }, - "end": { - "line": 57, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 57, @@ -3336,7 +3196,7 @@ }, "end": { "line": 57, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/undefinedNullNotObject-expected.txt b/ets2panda/test/parser/ets/undefinedNullNotObject-expected.txt new file mode 100644 index 0000000000..adf7abcccb --- /dev/null +++ b/ets2panda/test/parser/ets/undefinedNullNotObject-expected.txt @@ -0,0 +1,432 @@ +{ + "type": "Program", + "statements": [ + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "main", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "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": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "mix", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 24 + } + } + }, + { + "type": "ETSNullType", + "loc": { + "start": { + "line": 17, + "column": 27 + }, + "end": { + "line": 17, + "column": 31 + } + } + } + ], + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 31 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 12 + } + } + }, + "init": null, + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 12 + } + } + } + ], + "kind": "let", + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 32 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "mix", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + "right": { + "type": "ETSNewClassInstanceExpression", + "typeReference": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 22 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 22 + } + } + }, + "arguments": [], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 24 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 19, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 20, + "column": 1 + } + } +} +TypeError: Type 'Object' cannot be assigned to type 'undefined|null' [undefinedNullNotObject.ets:18:11] diff --git a/ets2panda/test/runtime/ets/voidInstanceReturn.ets b/ets2panda/test/parser/ets/undefinedNullNotObject.ets similarity index 46% rename from ets2panda/test/runtime/ets/voidInstanceReturn.ets rename to ets2panda/test/parser/ets/undefinedNullNotObject.ets index 31fdf13cfa..02ba02c2a3 100644 --- a/ets2panda/test/runtime/ets/voidInstanceReturn.ets +++ b/ets2panda/test/parser/ets/undefinedNullNotObject.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 @@ -13,41 +13,7 @@ * limitations under the License. */ -let res: int -type F = () => void; - -function bar() :void { - return; -} - -function foo(f: F): void { - return Void; -} - -function emptyfoo(): void { -} - -function noreturnfoo(): void { - let a = 2; -} - -function main(): int { - - let instance = Void; - let static_field = void.void_instance; - - let a = foo(bar); - let b = bar(); - let c = console.print(""); - let d = emptyfoo(); - let e = noreturnfoo(); - - assert(instance === static_field); - assert(instance === a); - assert(instance === b); - assert(instance === c); - assert(instance === d); - assert(instance === e); - - return 0; +function main(){ + let mix : undefined | null; + mix = new Object(); } diff --git a/ets2panda/test/parser/ets/undefinedNullObjectTypeAnnotation-expected.txt b/ets2panda/test/parser/ets/undefinedNullObjectTypeAnnotation-expected.txt new file mode 100644 index 0000000000..29ee8867c0 --- /dev/null +++ b/ets2panda/test/parser/ets/undefinedNullObjectTypeAnnotation-expected.txt @@ -0,0 +1,584 @@ +{ + "type": "Program", + "statements": [ + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "main", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "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": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "mix", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 24 + } + } + }, + { + "type": "ETSNullType", + "loc": { + "start": { + "line": 17, + "column": 27 + }, + "end": { + "line": 17, + "column": 31 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 17, + "column": 34 + }, + "end": { + "line": 17, + "column": 40 + } + } + }, + "loc": { + "start": { + "line": 17, + "column": 34 + }, + "end": { + "line": 17, + "column": 41 + } + } + }, + "loc": { + "start": { + "line": 17, + "column": 34 + }, + "end": { + "line": 17, + "column": 41 + } + } + } + ], + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 41 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 12 + } + } + }, + "init": null, + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 12 + } + } + } + ], + "kind": "let", + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 41 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "mix", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + "right": { + "type": "UndefinedLiteral", + "value": undefined, + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "mix", + "decorators": [], + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 8 + } + } + }, + "right": { + "type": "NullLiteral", + "value": null, + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 15 + } + } + }, + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 15 + } + } + }, + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 16 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "mix", + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 8 + } + } + }, + "right": { + "type": "ETSNewClassInstanceExpression", + "typeReference": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 22 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 22 + } + } + }, + "arguments": [], + "loc": { + "start": { + "line": 20, + "column": 11 + }, + "end": { + "line": 20, + "column": 24 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 24 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 24 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 21, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 22, + "column": 1 + } + } +} diff --git a/ets2panda/test/parser/ets/undefinedNullObjectTypeAnnotation.ets b/ets2panda/test/parser/ets/undefinedNullObjectTypeAnnotation.ets new file mode 100644 index 0000000000..8d370cc35e --- /dev/null +++ b/ets2panda/test/parser/ets/undefinedNullObjectTypeAnnotation.ets @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 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 main(){ + let mix : undefined | null | Object; + mix = undefined; + mix = null; + mix = new Object(); +} diff --git a/ets2panda/test/parser/ets/undefinedNullTypeAlias-expected.txt b/ets2panda/test/parser/ets/undefinedNullTypeAlias-expected.txt new file mode 100644 index 0000000000..4924909d20 --- /dev/null +++ b/ets2panda/test/parser/ets/undefinedNullTypeAlias-expected.txt @@ -0,0 +1,476 @@ +{ + "type": "Program", + "statements": [ + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "main", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "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": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "und", + "typeAnnotation": { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 24 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 12 + } + } + }, + "init": null, + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 12 + } + } + } + ], + "kind": "let", + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "nul", + "typeAnnotation": { + "type": "ETSNullType", + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 12 + } + } + }, + "init": null, + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 12 + } + } + } + ], + "kind": "let", + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "und", + "decorators": [], + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 8 + } + } + }, + "right": { + "type": "UndefinedLiteral", + "value": undefined, + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 21 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "nul", + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 8 + } + } + }, + "right": { + "type": "NullLiteral", + "value": null, + "loc": { + "start": { + "line": 20, + "column": 11 + }, + "end": { + "line": 20, + "column": 15 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 15 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 16 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 21, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 22, + "column": 1 + } + } +} diff --git a/ets2panda/test/parser/ets/undefinedNullTypeAlias.ets b/ets2panda/test/parser/ets/undefinedNullTypeAlias.ets new file mode 100644 index 0000000000..c76d66a066 --- /dev/null +++ b/ets2panda/test/parser/ets/undefinedNullTypeAlias.ets @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 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 main(){ + let und : undefined; + let nul : null; + und = undefined; + nul = null; +} diff --git a/ets2panda/test/parser/ets/var_declare-expected.txt b/ets2panda/test/parser/ets/var_declare-expected.txt index 24fa8c7639..ad98c3727f 100644 --- a/ets2panda/test/parser/ets/var_declare-expected.txt +++ b/ets2panda/test/parser/ets/var_declare-expected.txt @@ -208,35 +208,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 20 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 20 - }, - "end": { - "line": 19, - "column": 26 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -244,7 +216,7 @@ }, "end": { "line": 19, - "column": 26 + "column": 24 } } }, diff --git a/ets2panda/test/parser/ets/variable_throw_function_1-expected.txt b/ets2panda/test/parser/ets/variable_throw_function_1-expected.txt index cab900f77a..604de34c49 100644 --- a/ets2panda/test/parser/ets/variable_throw_function_1-expected.txt +++ b/ets2panda/test/parser/ets/variable_throw_function_1-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, @@ -297,35 +269,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -333,7 +277,7 @@ }, "end": { "line": 18, - "column": 29 + "column": 22 } } }, @@ -441,35 +385,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 23 - }, - "end": { - "line": 20, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 23 - }, - "end": { - "line": 20, - "column": 34 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -477,7 +393,7 @@ }, "end": { "line": 20, - "column": 34 + "column": 27 } } } @@ -489,7 +405,7 @@ }, "end": { "line": 20, - "column": 34 + "column": 27 } } }, @@ -501,7 +417,7 @@ }, "end": { "line": 20, - "column": 34 + "column": 27 } } }, @@ -512,41 +428,13 @@ }, "end": { "line": 20, - "column": 34 + "column": 27 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 38 - }, - "end": { - "line": 20, - "column": 42 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 38 - }, - "end": { - "line": 20, - "column": 51 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 20, @@ -554,7 +442,7 @@ }, "end": { "line": 20, - "column": 51 + "column": 42 } } }, @@ -654,35 +542,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 22, @@ -690,7 +550,7 @@ }, "end": { "line": 22, - "column": 24 + "column": 22 } } }, @@ -709,35 +569,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 26 - }, - "end": { - "line": 23, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 26 - }, - "end": { - "line": 23, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 23, @@ -745,7 +577,7 @@ }, "end": { "line": 23, - "column": 37 + "column": 30 } } } @@ -757,7 +589,7 @@ }, "end": { "line": 23, - "column": 37 + "column": 30 } } }, @@ -824,35 +656,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 26 - }, - "end": { - "line": 25, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 26 - }, - "end": { - "line": 25, - "column": 37 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 25, @@ -860,7 +664,7 @@ }, "end": { "line": 25, - "column": 37 + "column": 30 } } } @@ -872,7 +676,7 @@ }, "end": { "line": 25, - "column": 37 + "column": 30 } } }, @@ -947,35 +751,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 30 - }, - "end": { - "line": 27, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 30 - }, - "end": { - "line": 27, - "column": 41 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 27, @@ -983,7 +759,7 @@ }, "end": { "line": 27, - "column": 41 + "column": 34 } } } @@ -995,7 +771,7 @@ }, "end": { "line": 27, - "column": 41 + "column": 34 } } }, @@ -1007,7 +783,7 @@ }, "end": { "line": 27, - "column": 41 + "column": 34 } } }, @@ -1018,41 +794,13 @@ }, "end": { "line": 27, - "column": 41 + "column": 34 } } } ], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 46 - }, - "end": { - "line": 27, - "column": 50 - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 46 - }, - "end": { - "line": 27, - "column": 57 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 27, @@ -1060,7 +808,7 @@ }, "end": { "line": 27, - "column": 57 + "column": 50 } } } @@ -1072,7 +820,7 @@ }, "end": { "line": 27, - "column": 57 + "column": 50 } } }, diff --git a/ets2panda/test/parser/ets/variable_throw_function_2-expected.txt b/ets2panda/test/parser/ets/variable_throw_function_2-expected.txt index a0cc39d967..ab6aff19a7 100644 --- a/ets2panda/test/parser/ets/variable_throw_function_2-expected.txt +++ b/ets2panda/test/parser/ets/variable_throw_function_2-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 29 + "column": 22 } } }, @@ -298,35 +270,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 18, @@ -334,7 +278,7 @@ }, "end": { "line": 18, - "column": 24 + "column": 22 } } }, @@ -353,35 +297,7 @@ "type": "ETSFunctionType", "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 29 - }, - "end": { - "line": 19, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 29 - }, - "end": { - "line": 19, - "column": 35 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 19, @@ -389,7 +305,7 @@ }, "end": { "line": 19, - "column": 35 + "column": 33 } } }, @@ -400,7 +316,7 @@ }, "end": { "line": 19, - "column": 35 + "column": 33 } } }, diff --git a/ets2panda/test/parser/ets/void-expected.txt b/ets2panda/test/parser/ets/void-expected.txt index f50e36f037..8f4c35becc 100644 --- a/ets2panda/test/parser/ets/void-expected.txt +++ b/ets2panda/test/parser/ets/void-expected.txt @@ -162,35 +162,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 16, @@ -198,7 +170,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/test-lists/parser/parser-js-ignored.txt b/ets2panda/test/test-lists/parser/parser-js-ignored.txt index 9e309d41f3..9e9cee060d 100644 --- a/ets2panda/test/test-lists/parser/parser-js-ignored.txt +++ b/ets2panda/test/test-lists/parser/parser-js-ignored.txt @@ -98,3 +98,10 @@ parser/ets/optional_chaining_object_property.ets compiler/ets/etsObjectToString4.ets compiler/ets/etsObjectToString5.ets compiler/ets/generic_variance_1.ets + +# 14595 +compiler/ets/n_assignGenericWithNullableTypeParamToNonNullable.ets + +# Related to void revert +compiler/ets/lambda_infer_type/lambda_cast_infer_type_void.ets +compiler/ets/promiseVoid.ets diff --git a/ets2panda/varbinder/ETSBinder.cpp b/ets2panda/varbinder/ETSBinder.cpp index fd3317e7bb..9adf1f8e6d 100644 --- a/ets2panda/varbinder/ETSBinder.cpp +++ b/ets2panda/varbinder/ETSBinder.cpp @@ -96,6 +96,9 @@ void ETSBinder::LookupTypeArgumentReferences(ir::ETSTypeReference *typeRef) void ETSBinder::LookupTypeReference(ir::Identifier *ident, bool allowDynamicNamespaces) { const auto &name = ident->Name(); + if (name == compiler::Signatures::UNDEFINED || name == compiler::Signatures::NULL_LITERAL) { + return; + } auto *iter = GetScope(); while (iter != nullptr) { -- Gitee From 0637dffb0deb057f18571f871061e8522cc5889e Mon Sep 17 00:00:00 2001 From: Peter Siket Date: Mon, 29 Jan 2024 16:05:30 +0100 Subject: [PATCH 06/12] Implement optional class/intrace fields. Issue: #I900QQ Internal issue: #15503 Change-Id: Ib3cf91b82f95a028478aa7f88483cf7d235d2be9 Signed-off-by: Peter Siket --- ets2panda/checker/ETSAnalyzer.cpp | 4 +- ets2panda/checker/ETSchecker.h | 2 + ets2panda/checker/ets/dynamic.cpp | 5 +- ets2panda/checker/ets/helpers.cpp | 22 +- ets2panda/checker/types/ets/etsUnionType.cpp | 10 + ets2panda/checker/types/ets/etsUnionType.h | 1 + ets2panda/compiler/core/ETSCompiler.cpp | 6 +- ets2panda/compiler/core/ETSGen.cpp | 13 +- .../ets/interfacePropertyDeclarations.cpp | 39 + ets2panda/ir/astNode.h | 5 + ets2panda/ir/base/classProperty.h | 5 + ets2panda/parser/ETSparser.cpp | 35 +- ets2panda/parser/ETSparser.h | 1 + ...erface_noreturn_type_function-expected.txt | 32 +- .../ets/optional_field_class-expected.txt | 444 +++ .../test/parser/ets/optional_field_class.ets | 20 + .../ets/optional_field_interface-expected.txt | 1720 +++++++++++ .../parser/ets/optional_field_interface.ets | 32 + ...optional_field_interfaceUnion-expected.txt | 2731 +++++++++++++++++ .../ets/optional_field_interfaceUnion.ets | 32 + ...d_interfaceUnionNotCompatible-expected.txt | 2363 ++++++++++++++ ...onal_field_interfaceUnionNotCompatible.ets | 32 + .../ets/optional_field_variable-expected.txt | 1080 +++++++ .../parser/ets/optional_field_variable.ets | 27 + ...optional_field_variable_forof-expected.txt | 1 + .../ets/optional_field_variable_forof.ets | 19 + ets2panda/test/runtime/ets/optional_field.ets | 55 + .../ets-runtime/ets-runtime-ignored-AOT.txt | 2 + 28 files changed, 8689 insertions(+), 49 deletions(-) create mode 100644 ets2panda/test/parser/ets/optional_field_class-expected.txt create mode 100644 ets2panda/test/parser/ets/optional_field_class.ets create mode 100644 ets2panda/test/parser/ets/optional_field_interface-expected.txt create mode 100644 ets2panda/test/parser/ets/optional_field_interface.ets create mode 100644 ets2panda/test/parser/ets/optional_field_interfaceUnion-expected.txt create mode 100644 ets2panda/test/parser/ets/optional_field_interfaceUnion.ets create mode 100644 ets2panda/test/parser/ets/optional_field_interfaceUnionNotCompatible-expected.txt create mode 100644 ets2panda/test/parser/ets/optional_field_interfaceUnionNotCompatible.ets create mode 100644 ets2panda/test/parser/ets/optional_field_variable-expected.txt create mode 100644 ets2panda/test/parser/ets/optional_field_variable.ets create mode 100644 ets2panda/test/parser/ets/optional_field_variable_forof-expected.txt create mode 100644 ets2panda/test/parser/ets/optional_field_variable_forof.ets create mode 100644 ets2panda/test/runtime/ets/optional_field.ets create mode 100644 ets2panda/test/test-lists/ets-runtime/ets-runtime-ignored-AOT.txt diff --git a/ets2panda/checker/ETSAnalyzer.cpp b/ets2panda/checker/ETSAnalyzer.cpp index 48669650a3..9259a20729 100644 --- a/ets2panda/checker/ETSAnalyzer.cpp +++ b/ets2panda/checker/ETSAnalyzer.cpp @@ -2547,7 +2547,9 @@ checker::Type *ETSAnalyzer::Check(ir::VariableDeclarator *st) const ir::VariableDeclaration::VariableDeclarationKind::CONST) { flags |= ir::ModifierFlags::CONST; } - + if (st->Id()->IsOptionalDeclaration()) { + flags |= ir::ModifierFlags::OPTIONAL; + } st->SetTsType(checker->CheckVariableDeclaration(st->Id()->AsIdentifier(), st->Id()->AsIdentifier()->TypeAnnotation(), st->Init(), flags)); return st->TsType(); diff --git a/ets2panda/checker/ETSchecker.h b/ets2panda/checker/ETSchecker.h index e71c513544..b90219d452 100644 --- a/ets2panda/checker/ETSchecker.h +++ b/ets2panda/checker/ETSchecker.h @@ -452,6 +452,8 @@ public: bool isCondExpr = false); Type *HandleBooleanLogicalOperators(Type *leftType, Type *rightType, lexer::TokenType tokenType); Type *HandleBooleanLogicalOperatorsExtended(Type *leftType, Type *rightType, ir::BinaryExpression *expr); + + checker::Type *FixOptionalVariableType(varbinder::Variable *const bindingVar, ir::ModifierFlags flags); checker::Type *CheckVariableDeclaration(ir::Identifier *ident, ir::TypeNode *typeAnnotation, ir::Expression *init, ir::ModifierFlags flags); void CheckTruthinessOfType(ir::Expression *expr); diff --git a/ets2panda/checker/ets/dynamic.cpp b/ets2panda/checker/ets/dynamic.cpp index b175b2e582..725c832fcd 100644 --- a/ets2panda/checker/ets/dynamic.cpp +++ b/ets2panda/checker/ets/dynamic.cpp @@ -671,9 +671,8 @@ ir::MethodDefinition *ETSChecker::CreateLambdaObjectClassInitializer(varbinder:: classScope, [this, classScope](varbinder::FunctionScope *scope, ArenaVector *statements, ArenaVector *params) { - util::UString thisParamName(std::string("this"), Allocator()); ir::ETSParameterExpression *thisParam = - AddParam(scope->Parent()->AsFunctionParamScope(), thisParamName.View(), + AddParam(scope->Parent()->AsFunctionParamScope(), varbinder::VarBinder::MANDATORY_PARAM_THIS, classScope->Node()->AsClassDeclaration()->Definition()->TsType()->AsETSObjectType()); params->push_back(thisParam); @@ -682,7 +681,7 @@ ir::MethodDefinition *ETSChecker::CreateLambdaObjectClassInitializer(varbinder:: AddParam(scope->Parent()->AsFunctionParamScope(), jsvalueParamName.View(), GlobalBuiltinJSValueType()); params->push_back(jsvalueParam); - auto *moduleClassId = AllocNode("this", Allocator()); + auto *moduleClassId = AllocNode(varbinder::VarBinder::MANDATORY_PARAM_THIS, Allocator()); auto *fieldId = AllocNode("jsvalue_lambda", Allocator()); auto *property = AllocNode(moduleClassId, fieldId, ir::MemberExpressionKind::PROPERTY_ACCESS, false, false); diff --git a/ets2panda/checker/ets/helpers.cpp b/ets2panda/checker/ets/helpers.cpp index 0d03030ed0..d730ca128f 100644 --- a/ets2panda/checker/ets/helpers.cpp +++ b/ets2panda/checker/ets/helpers.cpp @@ -1065,6 +1065,22 @@ checker::Type *ETSChecker::CheckArrayElements(ir::Identifier *ident, ir::ArrayEx return annotationType; } +checker::Type *ETSChecker::FixOptionalVariableType(varbinder::Variable *const bindingVar, ir::ModifierFlags flags) +{ + if ((flags & ir::ModifierFlags::OPTIONAL) != 0) { + auto type = bindingVar->TsType(); + if (type->IsETSUnionType()) { + auto constituentTypes = type->AsETSUnionType()->ConstituentTypes(); + constituentTypes.push_back(GlobalETSUndefinedType()); + type = CreateETSUnionType(std::move(constituentTypes)); + } else { + type = CreateETSUnionType({GlobalETSUndefinedType(), type}); + } + bindingVar->SetTsType(type); + } + return bindingVar->TsType(); +} + checker::Type *ETSChecker::CheckVariableDeclaration(ir::Identifier *ident, ir::TypeNode *typeAnnotation, ir::Expression *init, ir::ModifierFlags flags) { @@ -1081,7 +1097,7 @@ checker::Type *ETSChecker::CheckVariableDeclaration(ir::Identifier *ident, ir::T } if (init == nullptr) { - return annotationType; + return FixOptionalVariableType(bindingVar, flags); } if (typeAnnotation == nullptr) { @@ -1156,7 +1172,7 @@ checker::Type *ETSChecker::CheckVariableDeclaration(ir::Identifier *ident, ir::T annotationType->HasTypeFlag(TypeFlag::ETS_PRIMITIVE)) { bindingVar->SetTsType(init->TsType()); } - return bindingVar->TsType(); + return FixOptionalVariableType(bindingVar, flags); } if (initType->IsETSObjectType() && initType->AsETSObjectType()->HasObjectFlag(ETSObjectFlags::ENUM) && @@ -1167,7 +1183,7 @@ checker::Type *ETSChecker::CheckVariableDeclaration(ir::Identifier *ident, ir::T isConst ? bindingVar->SetTsType(initType) : bindingVar->SetTsType(GetNonConstantTypeFromPrimitiveType(initType)); - return bindingVar->TsType(); + return FixOptionalVariableType(bindingVar, flags); } void ETSChecker::SetArrayPreferredTypeForNestedMemberExpressions(ir::MemberExpression *expr, Type *annotationType) diff --git a/ets2panda/checker/types/ets/etsUnionType.cpp b/ets2panda/checker/types/ets/etsUnionType.cpp index b61449777f..d5587641be 100644 --- a/ets2panda/checker/types/ets/etsUnionType.cpp +++ b/ets2panda/checker/types/ets/etsUnionType.cpp @@ -471,4 +471,14 @@ std::tuple ETSUnionType::ResolveConditionExpr() const return {false, false}; } +bool ETSUnionType::HasUndefinedType() const +{ + for (const auto &type : constituentTypes_) { + if (type->IsETSUndefinedType()) { + return true; + } + } + return false; +} + } // namespace ark::es2panda::checker diff --git a/ets2panda/checker/types/ets/etsUnionType.h b/ets2panda/checker/types/ets/etsUnionType.h index 301d31be13..e1d99fc68b 100644 --- a/ets2panda/checker/types/ets/etsUnionType.h +++ b/ets2panda/checker/types/ets/etsUnionType.h @@ -49,6 +49,7 @@ public: Type *FindUnboxableType() const; bool HasObjectType(ETSObjectFlags flag) const; + bool HasUndefinedType() const; Type *FindExactOrBoxedType(ETSChecker *checker, Type *type) const; diff --git a/ets2panda/compiler/core/ETSCompiler.cpp b/ets2panda/compiler/core/ETSCompiler.cpp index 8d3933ed29..11eb18a832 100644 --- a/ets2panda/compiler/core/ETSCompiler.cpp +++ b/ets2panda/compiler/core/ETSCompiler.cpp @@ -61,14 +61,16 @@ void ETSCompiler::Compile([[maybe_unused]] const ir::ClassDefinition *node) cons void ETSCompiler::Compile(const ir::ClassProperty *st) const { ETSGen *etsg = GetETSGen(); - if (st->Value() == nullptr) { + if (st->Value() == nullptr && st->TsType()->HasTypeFlag(checker::TypeFlag::ETS_PRIMITIVE)) { return; } auto ttctx = compiler::TargetTypeContext(etsg, st->TsType()); compiler::RegScope rs(etsg); - if (!etsg->TryLoadConstantExpression(st->Value())) { + if (st->Value() == nullptr) { + etsg->LoadDefaultValue(st, st->TsType()); + } else if (!etsg->TryLoadConstantExpression(st->Value())) { st->Value()->Compile(etsg); etsg->ApplyConversion(st->Value(), st->TsType()); } diff --git a/ets2panda/compiler/core/ETSGen.cpp b/ets2panda/compiler/core/ETSGen.cpp index 6dbc5b41d7..21128778cd 100644 --- a/ets2panda/compiler/core/ETSGen.cpp +++ b/ets2panda/compiler/core/ETSGen.cpp @@ -724,12 +724,17 @@ void ETSGen::LoadDefaultValue([[maybe_unused]] const ir::AstNode *node, [[maybe_ } if (type->IsETSUnionType()) { - type = Checker()->GetGlobalTypesHolder()->GlobalETSObjectType(); + if (type->AsETSUnionType()->HasUndefinedType()) { + type = Checker()->GetGlobalTypesHolder()->GlobalETSUndefinedType(); + } else { + type = Checker()->GetGlobalTypesHolder()->GlobalETSObjectType(); + } } - if (type->IsETSObjectType() || type->IsETSArrayType() || type->IsETSTypeParameter() || type->IsETSNullType()) { - LoadAccumulatorNull(node, type); - } else if (type->IsETSUndefinedType()) { + if (type->IsUndefinedType() || type->IsETSUndefinedType()) { LoadAccumulatorUndefined(node); + } else if (type->IsETSObjectType() || type->IsETSArrayType() || type->IsETSTypeParameter() || + type->IsETSNullType()) { + LoadAccumulatorNull(node, type); } else if (type->IsETSBooleanType()) { LoadAccumulatorBoolean(node, type->AsETSBooleanType()->GetValue()); } else { diff --git a/ets2panda/compiler/lowering/ets/interfacePropertyDeclarations.cpp b/ets2panda/compiler/lowering/ets/interfacePropertyDeclarations.cpp index 9e099a1f1c..e5fb7fee43 100644 --- a/ets2panda/compiler/lowering/ets/interfacePropertyDeclarations.cpp +++ b/ets2panda/compiler/lowering/ets/interfacePropertyDeclarations.cpp @@ -27,8 +27,46 @@ #include "ir/statements/blockStatement.h" #include "ir/ts/tsInterfaceBody.h" #include "ir/base/classProperty.h" +#include "ir/ets/etsUnionType.h" +#include "ir/ets/etsNullishTypes.h" namespace ark::es2panda::compiler { + +namespace { + +void TransformOptionalFieldTypeAnnotation(checker::ETSChecker *const checker, ir::ClassProperty *const field) +{ + if (!field->IsOptionalDeclaration()) { + return; + } + + if (field->IsETSUnionType()) { + bool alreadyHasUndefined = false; + auto unionTypes = field->AsETSUnionType()->Types(); + for (const auto &type : unionTypes) { + if (type->IsETSUndefinedType()) { + alreadyHasUndefined = true; + break; + } + } + if (!alreadyHasUndefined) { + ArenaVector types(field->AsETSUnionType()->Types(), checker->Allocator()->Adapter()); + types.push_back(checker->AllocNode()); + auto *const unionType = checker->AllocNode(std::move(types)); + field->SetTypeAnnotation(unionType); + } + } else { + ArenaVector types(checker->Allocator()->Adapter()); + types.push_back(field->TypeAnnotation()); + types.push_back(checker->AllocNode()); + auto *const unionType = checker->AllocNode(std::move(types)); + field->SetTypeAnnotation(unionType); + } + field->ClearModifier(ir::ModifierFlags::OPTIONAL); +} + +} // namespace + static ir::MethodDefinition *GenerateGetterOrSetter(checker::ETSChecker *const checker, ir::ClassProperty *const field, bool isSetter) { @@ -42,6 +80,7 @@ static ir::MethodDefinition *GenerateGetterOrSetter(checker::ETSChecker *const c auto flags = ir::ModifierFlags::PUBLIC; flags |= ir::ModifierFlags::ABSTRACT; + TransformOptionalFieldTypeAnnotation(checker, field); ArenaVector params(checker->Allocator()->Adapter()); if (isSetter) { diff --git a/ets2panda/ir/astNode.h b/ets2panda/ir/astNode.h index de669111d0..be32df0db6 100644 --- a/ets2panda/ir/astNode.h +++ b/ets2panda/ir/astNode.h @@ -409,6 +409,11 @@ public: flags_ |= flags; } + void ClearModifier(ModifierFlags const flags) noexcept + { + flags_ &= ~flags; + } + [[nodiscard]] ModifierFlags Modifiers() noexcept { return flags_; diff --git a/ets2panda/ir/base/classProperty.h b/ets2panda/ir/base/classProperty.h index 3dbb34e406..5ac78b991b 100644 --- a/ets2panda/ir/base/classProperty.h +++ b/ets2panda/ir/base/classProperty.h @@ -46,6 +46,11 @@ public: return typeAnnotation_; } + void SetTypeAnnotation(TypeNode *typeAnnotation) noexcept + { + typeAnnotation_ = typeAnnotation; + } + [[nodiscard]] PrivateFieldKind ToPrivateFieldKind(bool const isStatic) const override { return isStatic ? PrivateFieldKind::STATIC_FIELD : PrivateFieldKind::FIELD; diff --git a/ets2panda/parser/ETSparser.cpp b/ets2panda/parser/ETSparser.cpp index c8efaf5c92..e91a181b96 100644 --- a/ets2panda/parser/ETSparser.cpp +++ b/ets2panda/parser/ETSparser.cpp @@ -655,13 +655,19 @@ void ETSParser::ParseClassFieldDefinition(ir::Identifier *fieldName, ir::Modifie ArenaVector *declarations, lexer::SourcePosition *letLoc) { lexer::SourcePosition startLoc = letLoc != nullptr ? *letLoc : fieldName->Start(); - lexer::SourcePosition endLoc = startLoc; + lexer::SourcePosition endLoc = fieldName->End(); ir::TypeNode *typeAnnotation = nullptr; TypeAnnotationParsingOptions options = TypeAnnotationParsingOptions::THROW_ERROR; + bool optionalField = false; + if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_QUESTION_MARK) { + Lexer()->NextToken(); // eat '?' + optionalField = true; + } if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_COLON) { Lexer()->NextToken(); // eat ':' typeAnnotation = ParseTypeAnnotation(&options); + endLoc = typeAnnotation->End(); } ir::Expression *initializer = nullptr; @@ -671,18 +677,18 @@ void ETSParser::ParseClassFieldDefinition(ir::Identifier *fieldName, ir::Modifie } else if (typeAnnotation == nullptr) { ThrowSyntaxError("Field type annotation expected"); } + bool isDeclare = (modifiers & ir::ModifierFlags::DECLARE) != 0; if (isDeclare && initializer != nullptr) { ThrowSyntaxError("Initializers are not allowed in ambient contexts."); } + auto *field = AllocNode(fieldName, initializer, typeAnnotation, modifiers, Allocator(), false); - if (initializer != nullptr) { - endLoc = initializer->End(); - } else { - endLoc = typeAnnotation != nullptr ? typeAnnotation->End() : fieldName->End(); + field->SetRange({fieldName->Start(), initializer != nullptr ? initializer->End() : endLoc}); + if (optionalField) { + field->AddModifier(ir::ModifierFlags::OPTIONAL); } - field->SetRange({startLoc, endLoc}); declarations->push_back(field); @@ -1409,6 +1415,12 @@ ir::ClassProperty *ETSParser::ParseInterfaceField() auto *name = AllocNode(Lexer()->GetToken().Ident(), Allocator()); name->SetRange(Lexer()->GetToken().Loc()); Lexer()->NextToken(); + bool optionalField = false; + + if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_QUESTION_MARK) { + Lexer()->NextToken(); // eat '?' + optionalField = true; + } ir::TypeNode *typeAnnotation = nullptr; if (!Lexer()->TryEatTokenType(lexer::TokenType::PUNCTUATOR_COLON)) { @@ -1432,6 +1444,9 @@ ir::ClassProperty *ETSParser::ParseInterfaceField() auto *field = AllocNode(name, nullptr, typeAnnotation->Clone(Allocator(), nullptr), fieldModifiers, Allocator(), false); + if (optionalField) { + field->AddModifier(ir::ModifierFlags::OPTIONAL); + } field->SetEnd(Lexer()->GetToken().End()); return field; @@ -2728,6 +2743,13 @@ ir::AnnotatedExpression *ETSParser::ParseVariableDeclaratorKey([[maybe_unused]] { ir::Identifier *init = ExpectIdentifier(); ir::TypeNode *typeAnnotation = nullptr; + if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_QUESTION_MARK) { + if ((flags & VariableParsingFlags::FOR_OF) != 0U) { + ThrowSyntaxError("Optional variable is not allowed in for of statements"); + } + Lexer()->NextToken(); // eat '?' + init->AddModifier(ir::ModifierFlags::OPTIONAL); + } if (auto const tokenType = Lexer()->GetToken().Type(); tokenType == lexer::TokenType::PUNCTUATOR_COLON) { Lexer()->NextToken(); // eat ':' @@ -2784,6 +2806,7 @@ ir::VariableDeclarator *ETSParser::ParseVariableDeclarator(ir::Expression *init, auto declarator = AllocNode(GetFlag(flags), init); declarator->SetRange({startLoc, endLoc}); + // NOTE (psiket) Transfer the OPTIONAL flag from the init to the declarator? return declarator; } diff --git a/ets2panda/parser/ETSparser.h b/ets2panda/parser/ETSparser.h index 24ec0b5c05..c470d1c530 100644 --- a/ets2panda/parser/ETSparser.h +++ b/ets2panda/parser/ETSparser.h @@ -163,6 +163,7 @@ private: ir::Expression *CreateParameterThis(util::StringView className) override; lexer::SourcePosition ParseEndLocInterfaceMethod(lexer::LexerPosition startPos, ir::ScriptFunction *func, ir::MethodDefinitionKind methodKind); + ir::TypeNode *ConvertToOptionalUnionType(ir::TypeNode *typeNode); // NOLINTNEXTLINE(google-default-arguments) void ParseClassFieldDefinition(ir::Identifier *fieldName, ir::ModifierFlags modifiers, ArenaVector *declarations, lexer::SourcePosition *letLoc = nullptr); diff --git a/ets2panda/test/compiler/ets/interface_noreturn_type_function-expected.txt b/ets2panda/test/compiler/ets/interface_noreturn_type_function-expected.txt index 2ce5584ec6..1d66eec90f 100644 --- a/ets2panda/test/compiler/ets/interface_noreturn_type_function-expected.txt +++ b/ets2panda/test/compiler/ets/interface_noreturn_type_function-expected.txt @@ -521,35 +521,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 24, @@ -557,7 +529,7 @@ }, "end": { "line": 24, - "column": 24 + "column": 22 } } }, diff --git a/ets2panda/test/parser/ets/optional_field_class-expected.txt b/ets2panda/test/parser/ets/optional_field_class-expected.txt new file mode 100644 index 0000000000..011ca0a932 --- /dev/null +++ b/ets2panda/test/parser/ets/optional_field_class-expected.txt @@ -0,0 +1,444 @@ +{ + "type": "Program", + "statements": [ + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "C", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "ClassProperty", + "key": { + "type": "Identifier", + "name": "field", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "accessibility": "public", + "static": false, + "readonly": false, + "declare": false, + "optional": true, + "computed": false, + "typeAnnotation": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "definite": false, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + { + "type": "ClassProperty", + "key": { + "type": "Identifier", + "name": "sfield", + "decorators": [], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + "accessibility": "public", + "static": true, + "readonly": false, + "declare": false, + "optional": true, + "computed": false, + "typeAnnotation": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 27 + } + } + }, + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 28 + } + } + }, + "definite": false, + "decorators": [], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 28 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "constructor", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 20, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 20, + "column": 2 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 21, + "column": 1 + } + } +} diff --git a/ets2panda/test/parser/ets/optional_field_class.ets b/ets2panda/test/parser/ets/optional_field_class.ets new file mode 100644 index 0000000000..11d7abaaa8 --- /dev/null +++ b/ets2panda/test/parser/ets/optional_field_class.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2024 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 C +{ + field? : Object; + static sfield? : Object; +} diff --git a/ets2panda/test/parser/ets/optional_field_interface-expected.txt b/ets2panda/test/parser/ets/optional_field_interface-expected.txt new file mode 100644 index 0000000000..bf45bd2434 --- /dev/null +++ b/ets2panda/test/parser/ets/optional_field_interface-expected.txt @@ -0,0 +1,1720 @@ +{ + "type": "Program", + "statements": [ + { + "type": "TSInterfaceDeclaration", + "body": { + "type": "TSInterfaceBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "kind": "method", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "returnType": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "declare": true, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "overloads": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "kind": "method", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [ + { + "type": "ETSParameterExpression", + "name": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + } + ], + "declare": true, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 20 + } + } + } + ], + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "kind": "method", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [ + { + "type": "ETSParameterExpression", + "name": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + } + ], + "declare": true, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 20 + } + } + } + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + "id": { + "type": "Identifier", + "name": "I", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "extends": [], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 21, + "column": 6 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "C", + "decorators": [], + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + "superClass": null, + "implements": [ + { + "type": "TSClassImplements", + "expression": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "I", + "decorators": [], + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 21, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 22, + "column": 2 + } + } + } + ], + "body": [ + { + "type": "ClassProperty", + "key": { + "type": "Identifier", + "name": "field_", + "decorators": [], + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 10 + } + } + }, + "accessibility": "public", + "static": false, + "readonly": false, + "declare": false, + "optional": true, + "computed": false, + "typeAnnotation": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + "definite": false, + "decorators": [], + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "field", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "get", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "field", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "returnType": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 24 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 36 + } + } + } + ], + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 36 + } + } + }, + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "ReturnStatement", + "argument": { + "type": "MemberExpression", + "object": { + "type": "ThisExpression", + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "field_", + "decorators": [], + "loc": { + "start": { + "line": 26, + "column": 19 + }, + "end": { + "line": 26, + "column": 25 + } + } + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 25 + } + } + }, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 26 + } + } + } + ], + "loc": { + "start": { + "line": 25, + "column": 37 + }, + "end": { + "line": 27, + "column": 5 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 27, + "column": 5 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 27, + "column": 5 + } + } + }, + "overloads": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "field", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "set", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "field", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [ + { + "type": "ETSParameterExpression", + "name": { + "type": "Identifier", + "name": "o", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 29, + "column": 18 + }, + "end": { + "line": 29, + "column": 24 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 18 + }, + "end": { + "line": 29, + "column": 26 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 18 + }, + "end": { + "line": 29, + "column": 26 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 29, + "column": 27 + }, + "end": { + "line": 29, + "column": 36 + } + } + } + ], + "loc": { + "start": { + "line": 29, + "column": 18 + }, + "end": { + "line": 29, + "column": 36 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 29, + "column": 14 + }, + "end": { + "line": 29, + "column": 36 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 14 + }, + "end": { + "line": 29, + "column": 36 + } + } + } + ], + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "object": { + "type": "ThisExpression", + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 11 + } + } + }, + "property": { + "type": "Identifier", + "name": "field_", + "decorators": [], + "loc": { + "start": { + "line": 30, + "column": 12 + }, + "end": { + "line": 30, + "column": 18 + } + } + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 18 + } + } + }, + "right": { + "type": "Identifier", + "name": "o", + "decorators": [], + "loc": { + "start": { + "line": 30, + "column": 21 + }, + "end": { + "line": 30, + "column": 22 + } + } + }, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 22 + } + } + }, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 23 + } + } + } + ], + "loc": { + "start": { + "line": 29, + "column": 38 + }, + "end": { + "line": 31, + "column": 5 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 31, + "column": 5 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 31, + "column": 5 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 31, + "column": 5 + } + } + } + ], + "decorators": [], + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 27, + "column": 5 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "constructor", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 32, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 32, + "column": 2 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 33, + "column": 1 + } + } +} diff --git a/ets2panda/test/parser/ets/optional_field_interface.ets b/ets2panda/test/parser/ets/optional_field_interface.ets new file mode 100644 index 0000000000..6dcb917dcf --- /dev/null +++ b/ets2panda/test/parser/ets/optional_field_interface.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 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 I +{ + field? : Object; +} + +class C implements I +{ + field_? : Object; + + get field() : Object | undefined { + return this.field_; + } + + set field(o : Object | undefined) { + this.field_ = o; + } +} diff --git a/ets2panda/test/parser/ets/optional_field_interfaceUnion-expected.txt b/ets2panda/test/parser/ets/optional_field_interfaceUnion-expected.txt new file mode 100644 index 0000000000..43a486273a --- /dev/null +++ b/ets2panda/test/parser/ets/optional_field_interfaceUnion-expected.txt @@ -0,0 +1,2731 @@ +{ + "type": "Program", + "statements": [ + { + "type": "TSInterfaceDeclaration", + "body": { + "type": "TSInterfaceBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 37 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "kind": "method", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 37 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "returnType": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 37 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "declare": true, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + "overloads": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 37 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "kind": "method", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 37 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [ + { + "type": "ETSParameterExpression", + "name": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 37 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + } + ], + "declare": true, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 38 + } + } + } + ], + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 37 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "kind": "method", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 37 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [ + { + "type": "ETSParameterExpression", + "name": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 37 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 38 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + } + ], + "declare": true, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 38 + } + } + } + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + "id": { + "type": "Identifier", + "name": "I", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "extends": [], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 21, + "column": 6 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "C", + "decorators": [], + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + "superClass": null, + "implements": [ + { + "type": "TSClassImplements", + "expression": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "I", + "decorators": [], + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 21, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 22, + "column": 2 + } + } + } + ], + "body": [ + { + "type": "ClassProperty", + "key": { + "type": "Identifier", + "name": "field_", + "decorators": [], + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 10 + } + } + }, + "accessibility": "public", + "static": false, + "readonly": false, + "declare": false, + "optional": true, + "computed": false, + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 22 + } + } + }, + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 22 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 23, + "column": 23 + }, + "end": { + "line": 23, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 23, + "column": 23 + }, + "end": { + "line": 23, + "column": 30 + } + } + }, + "loc": { + "start": { + "line": 23, + "column": 23 + }, + "end": { + "line": 23, + "column": 30 + } + } + } + ], + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 30 + } + } + }, + "definite": false, + "decorators": [], + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 30 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "field", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "get", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "field", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "returnType": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 24 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 33 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 35 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 35 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 25, + "column": 36 + }, + "end": { + "line": 25, + "column": 45 + } + } + } + ], + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 45 + } + } + }, + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "ReturnStatement", + "argument": { + "type": "MemberExpression", + "object": { + "type": "ThisExpression", + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "field_", + "decorators": [], + "loc": { + "start": { + "line": 26, + "column": 19 + }, + "end": { + "line": 26, + "column": 25 + } + } + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 25 + } + } + }, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 26 + } + } + } + ], + "loc": { + "start": { + "line": 25, + "column": 46 + }, + "end": { + "line": 27, + "column": 5 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 27, + "column": 5 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 27, + "column": 5 + } + } + }, + "overloads": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "field", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "set", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "field", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [ + { + "type": "ETSParameterExpression", + "name": { + "type": "Identifier", + "name": "o", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 29, + "column": 18 + }, + "end": { + "line": 29, + "column": 24 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 18 + }, + "end": { + "line": 29, + "column": 26 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 18 + }, + "end": { + "line": 29, + "column": 26 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 29, + "column": 27 + }, + "end": { + "line": 29, + "column": 33 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 27 + }, + "end": { + "line": 29, + "column": 35 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 27 + }, + "end": { + "line": 29, + "column": 35 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 29, + "column": 36 + }, + "end": { + "line": 29, + "column": 45 + } + } + } + ], + "loc": { + "start": { + "line": 29, + "column": 18 + }, + "end": { + "line": 29, + "column": 45 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 29, + "column": 14 + }, + "end": { + "line": 29, + "column": 45 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 14 + }, + "end": { + "line": 29, + "column": 45 + } + } + } + ], + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "object": { + "type": "ThisExpression", + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 11 + } + } + }, + "property": { + "type": "Identifier", + "name": "field_", + "decorators": [], + "loc": { + "start": { + "line": 30, + "column": 12 + }, + "end": { + "line": 30, + "column": 18 + } + } + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 18 + } + } + }, + "right": { + "type": "Identifier", + "name": "o", + "decorators": [], + "loc": { + "start": { + "line": 30, + "column": 21 + }, + "end": { + "line": 30, + "column": 22 + } + } + }, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 22 + } + } + }, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 23 + } + } + } + ], + "loc": { + "start": { + "line": 29, + "column": 47 + }, + "end": { + "line": 31, + "column": 5 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 31, + "column": 5 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 31, + "column": 5 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 31, + "column": 5 + } + } + } + ], + "decorators": [], + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 27, + "column": 5 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "constructor", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 32, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 32, + "column": 2 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 33, + "column": 1 + } + } +} diff --git a/ets2panda/test/parser/ets/optional_field_interfaceUnion.ets b/ets2panda/test/parser/ets/optional_field_interfaceUnion.ets new file mode 100644 index 0000000000..04a9e40c46 --- /dev/null +++ b/ets2panda/test/parser/ets/optional_field_interfaceUnion.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 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 I +{ + field? : Object | String | Number; +} + +class C implements I +{ + field_? : Object | String; + + get field() : Object | String | undefined { + return this.field_; + } + + set field(o : Object | String | undefined) { + this.field_ = o; + } +} diff --git a/ets2panda/test/parser/ets/optional_field_interfaceUnionNotCompatible-expected.txt b/ets2panda/test/parser/ets/optional_field_interfaceUnionNotCompatible-expected.txt new file mode 100644 index 0000000000..f7759e8239 --- /dev/null +++ b/ets2panda/test/parser/ets/optional_field_interfaceUnionNotCompatible-expected.txt @@ -0,0 +1,2363 @@ +{ + "type": "Program", + "statements": [ + { + "type": "TSInterfaceDeclaration", + "body": { + "type": "TSInterfaceBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "kind": "method", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "returnType": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "declare": true, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "overloads": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "kind": "method", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [ + { + "type": "ETSParameterExpression", + "name": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + } + ], + "declare": true, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 29 + } + } + } + ], + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "kind": "method", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [ + { + "type": "ETSParameterExpression", + "name": { + "type": "Identifier", + "name": "field", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 29 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 9 + } + } + } + ], + "declare": true, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 29 + } + } + } + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + "id": { + "type": "Identifier", + "name": "I", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "extends": [], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 21, + "column": 6 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "C", + "decorators": [], + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + "superClass": null, + "implements": [ + { + "type": "TSClassImplements", + "expression": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "I", + "decorators": [], + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 21, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 22, + "column": 2 + } + } + } + ], + "body": [ + { + "type": "ClassProperty", + "key": { + "type": "Identifier", + "name": "field_", + "decorators": [], + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 10 + } + } + }, + "accessibility": "public", + "static": false, + "readonly": false, + "declare": false, + "optional": true, + "computed": false, + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 22 + } + } + }, + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 22 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 23, + "column": 23 + }, + "end": { + "line": 23, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 23, + "column": 23 + }, + "end": { + "line": 23, + "column": 30 + } + } + }, + "loc": { + "start": { + "line": 23, + "column": 23 + }, + "end": { + "line": 23, + "column": 30 + } + } + } + ], + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 30 + } + } + }, + "definite": false, + "decorators": [], + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 30 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "field", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "get", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "field", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "returnType": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 24 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 33 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 35 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 35 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 25, + "column": 36 + }, + "end": { + "line": 25, + "column": 45 + } + } + } + ], + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 45 + } + } + }, + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "ReturnStatement", + "argument": { + "type": "MemberExpression", + "object": { + "type": "ThisExpression", + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "field_", + "decorators": [], + "loc": { + "start": { + "line": 26, + "column": 19 + }, + "end": { + "line": 26, + "column": 25 + } + } + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 25 + } + } + }, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 26 + } + } + } + ], + "loc": { + "start": { + "line": 25, + "column": 46 + }, + "end": { + "line": 27, + "column": 5 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 27, + "column": 5 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 27, + "column": 5 + } + } + }, + "overloads": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "field", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "set", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "field", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [ + { + "type": "ETSParameterExpression", + "name": { + "type": "Identifier", + "name": "o", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 29, + "column": 18 + }, + "end": { + "line": 29, + "column": 24 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 18 + }, + "end": { + "line": 29, + "column": 26 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 18 + }, + "end": { + "line": 29, + "column": 26 + } + } + }, + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 29, + "column": 27 + }, + "end": { + "line": 29, + "column": 33 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 27 + }, + "end": { + "line": 29, + "column": 35 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 27 + }, + "end": { + "line": 29, + "column": 35 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 29, + "column": 36 + }, + "end": { + "line": 29, + "column": 45 + } + } + } + ], + "loc": { + "start": { + "line": 29, + "column": 18 + }, + "end": { + "line": 29, + "column": 45 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 29, + "column": 14 + }, + "end": { + "line": 29, + "column": 45 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 14 + }, + "end": { + "line": 29, + "column": 45 + } + } + } + ], + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "object": { + "type": "ThisExpression", + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 11 + } + } + }, + "property": { + "type": "Identifier", + "name": "field_", + "decorators": [], + "loc": { + "start": { + "line": 30, + "column": 12 + }, + "end": { + "line": 30, + "column": 18 + } + } + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 18 + } + } + }, + "right": { + "type": "Identifier", + "name": "o", + "decorators": [], + "loc": { + "start": { + "line": 30, + "column": 21 + }, + "end": { + "line": 30, + "column": 22 + } + } + }, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 22 + } + } + }, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 23 + } + } + } + ], + "loc": { + "start": { + "line": 29, + "column": 47 + }, + "end": { + "line": 31, + "column": 5 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 31, + "column": 5 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 31, + "column": 5 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 31, + "column": 5 + } + } + } + ], + "decorators": [], + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 27, + "column": 5 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "constructor", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 32, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 32, + "column": 2 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 33, + "column": 1 + } + } +} +TypeError: field(): Object|undefined in C cannot override field(): undefined|String|Double in I because overriding return type is not compatible with the other return type. [optional_field_interfaceUnionNotCompatible.ets:25:13] diff --git a/ets2panda/test/parser/ets/optional_field_interfaceUnionNotCompatible.ets b/ets2panda/test/parser/ets/optional_field_interfaceUnionNotCompatible.ets new file mode 100644 index 0000000000..41117e20ac --- /dev/null +++ b/ets2panda/test/parser/ets/optional_field_interfaceUnionNotCompatible.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 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 I +{ + field? : String | Number; +} + +class C implements I +{ + field_? : Object | String; + + get field() : Object | String | undefined { + return this.field_; + } + + set field(o : Object | String | undefined) { + this.field_ = o; + } +} diff --git a/ets2panda/test/parser/ets/optional_field_variable-expected.txt b/ets2panda/test/parser/ets/optional_field_variable-expected.txt new file mode 100644 index 0000000000..897621b453 --- /dev/null +++ b/ets2panda/test/parser/ets/optional_field_variable-expected.txt @@ -0,0 +1,1080 @@ +{ + "type": "Program", + "statements": [ + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "goo", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 13 + } + } + }, + "kind": "method", + "accessibility": "public", + "static": true, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "goo", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 13 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "ReturnStatement", + "argument": { + "type": "ETSNewClassInstanceExpression", + "typeReference": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Int", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "arguments": [ + { + "type": "NumberLiteral", + "value": 3, + "loc": { + "start": { + "line": 18, + "column": 19 + }, + "end": { + "line": 18, + "column": 20 + } + } + } + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 22 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 22 + } + } + } + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 13 + } + } + }, + "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": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 13 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [ + { + "type": "ETSParameterExpression", + "name": { + "type": "Identifier", + "name": "param", + "typeAnnotation": { + "type": "ETSUnionType", + "types": [ + { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 21, + "column": 23 + }, + "end": { + "line": 21, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 23 + }, + "end": { + "line": 21, + "column": 30 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 23 + }, + "end": { + "line": 21, + "column": 30 + } + } + }, + { + "type": "ETSUndefinedType", + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 21, + "column": 20 + } + } + } + ], + "loc": { + "start": { + "line": 21, + "column": 23 + }, + "end": { + "line": 21, + "column": 30 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 30 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "var1", + "typeAnnotation": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 22 + } + } + }, + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 23 + } + } + }, + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 23 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 12 + } + } + }, + "init": null, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 12 + } + } + } + ], + "kind": "let", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 23 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "var2", + "decorators": [], + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 12 + } + } + }, + "init": { + "type": "ETSNewClassInstanceExpression", + "typeReference": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Object", + "decorators": [], + "loc": { + "start": { + "line": 24, + "column": 20 + }, + "end": { + "line": 24, + "column": 26 + } + } + }, + "loc": { + "start": { + "line": 24, + "column": 20 + }, + "end": { + "line": 24, + "column": 27 + } + } + }, + "loc": { + "start": { + "line": 24, + "column": 20 + }, + "end": { + "line": 24, + "column": 27 + } + } + }, + "arguments": [], + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 29 + } + } + } + ], + "kind": "let", + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 29 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "var3", + "decorators": [], + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 12 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "goo", + "decorators": [], + "loc": { + "start": { + "line": 25, + "column": 16 + }, + "end": { + "line": 25, + "column": 19 + } + } + }, + "arguments": [], + "optional": false, + "loc": { + "start": { + "line": 25, + "column": 16 + }, + "end": { + "line": 25, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 21 + } + } + } + ], + "kind": "let", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 22 + } + } + }, + { + "type": "ForUpdateStatement", + "init": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "i", + "typeAnnotation": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "Number", + "decorators": [], + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 24 + } + } + }, + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 26, + "column": 13 + }, + "end": { + "line": 26, + "column": 14 + } + } + }, + "init": { + "type": "NumberLiteral", + "value": 1, + "loc": { + "start": { + "line": 26, + "column": 27 + }, + "end": { + "line": 26, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 26, + "column": 13 + }, + "end": { + "line": 26, + "column": 28 + } + } + } + ], + "kind": "let", + "loc": { + "start": { + "line": 26, + "column": 9 + }, + "end": { + "line": 26, + "column": 28 + } + } + }, + "test": null, + "update": null, + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "BreakStatement", + "label": null, + "loc": { + "start": { + "line": 26, + "column": 35 + }, + "end": { + "line": 26, + "column": 41 + } + } + } + ], + "loc": { + "start": { + "line": 26, + "column": 33 + }, + "end": { + "line": 26, + "column": 43 + } + } + }, + "loc": { + "start": { + "line": 26, + "column": 4 + }, + "end": { + "line": 26, + "column": 43 + } + } + } + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 27, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 27, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 27, + "column": 2 + } + } + }, + "overloads": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 13 + } + } + }, + "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": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 13 + } + } + }, + "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": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "arguments": [ + { + "type": "UndefinedLiteral", + "value": undefined, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "optional": false, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 648, + "column": 1 + }, + "end": { + "line": 648, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "decorators": [], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 27, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 28, + "column": 1 + } + } +} diff --git a/ets2panda/test/parser/ets/optional_field_variable.ets b/ets2panda/test/parser/ets/optional_field_variable.ets new file mode 100644 index 0000000000..7eb207865e --- /dev/null +++ b/ets2panda/test/parser/ets/optional_field_variable.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2024 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 goo() +{ + return new Int(3); +} + +function foo(param? : Object) +{ + let var1? : Object; + let var2? = new Object(); + let var3? = goo(); + for (let i? : Number = 1;;) { break; } +} diff --git a/ets2panda/test/parser/ets/optional_field_variable_forof-expected.txt b/ets2panda/test/parser/ets/optional_field_variable_forof-expected.txt new file mode 100644 index 0000000000..4b4b81b7ce --- /dev/null +++ b/ets2panda/test/parser/ets/optional_field_variable_forof-expected.txt @@ -0,0 +1 @@ +SyntaxError: Optional variable is not allowed in for of statements [optional_field_variable_forof.ets:18:14] diff --git a/ets2panda/test/parser/ets/optional_field_variable_forof.ets b/ets2panda/test/parser/ets/optional_field_variable_forof.ets new file mode 100644 index 0000000000..ee5665fae8 --- /dev/null +++ b/ets2panda/test/parser/ets/optional_field_variable_forof.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2024 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(param? : Object) +{ + for (let i? of "blablabla") { } +} diff --git a/ets2panda/test/runtime/ets/optional_field.ets b/ets2panda/test/runtime/ets/optional_field.ets new file mode 100644 index 0000000000..010a6641ec --- /dev/null +++ b/ets2panda/test/runtime/ets/optional_field.ets @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2024 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 O = new Object(); +let I = new Int(3); + +class C +{ + field? : Object; + method(s: string) : int + { + return 1; + } + + method (s? : string) : int + { + return 2; + } +} + +function goo() +{ + return I; +} + +function main() : int +{ + let c = new C(); + let var1? : Object; + let var2? = O; + let var3? = goo(); + + assert(c.method('blablabla') == 1); + assert(c.method(undefined) == 2); + assert(c.method() == 2); + assert(c.field === undefined); + + assert(var1 === undefined); + assert(var2 === O); + assert(var3 === I); + + return 0; +} diff --git a/ets2panda/test/test-lists/ets-runtime/ets-runtime-ignored-AOT.txt b/ets2panda/test/test-lists/ets-runtime/ets-runtime-ignored-AOT.txt new file mode 100644 index 0000000000..155f8b5437 --- /dev/null +++ b/ets2panda/test/test-lists/ets-runtime/ets-runtime-ignored-AOT.txt @@ -0,0 +1,2 @@ +# Probably bug in the ark_aot #15822 +lambda-class-field.ets -- Gitee From 36fff36907b5253b22ac51cff4599fe16ffc8f21 Mon Sep 17 00:00:00 2001 From: Peter Siket Date: Tue, 10 Oct 2023 08:58:47 +0200 Subject: [PATCH 07/12] Implement local classes. Issue: #I8TF63 Internal issue: #13836 Change-Id: I6d2fef8b90c45622ecb91b951526db1505e350b0 Signed-off-by: Peter Siket --- ets2panda/BUILD.gn | 1 + ets2panda/CMakeLists.txt | 1 + ets2panda/checker/ETSAnalyzer.cpp | 24 +- ets2panda/checker/ETSAnalyzer.h | 2 + ets2panda/checker/ETSchecker.cpp | 16 +- ets2panda/checker/ETSchecker.h | 24 +- ets2panda/checker/checkerContext.h | 1 + ets2panda/checker/ets/function.cpp | 7 +- ets2panda/checker/ets/helpers.cpp | 114 +- ets2panda/checker/ets/object.cpp | 16 +- ets2panda/checker/ets/typeCreation.cpp | 14 +- ets2panda/compiler/base/lreference.cpp | 18 +- ets2panda/compiler/core/ETSCompiler.cpp | 11 +- ets2panda/compiler/core/ETSGen.cpp | 61 +- ets2panda/compiler/core/ETSGen.h | 11 +- .../lowering/ets/localClassLowering.cpp | 279 + .../lowering/ets/localClassLowering.h | 50 + ets2panda/compiler/lowering/phase.cpp | 3 + ets2panda/ir/base/classDefinition.cpp | 3 + ets2panda/ir/base/classDefinition.h | 71 +- .../ir/ets/etsNewClassInstanceExpression.h | 5 + ets2panda/parser/ETSparser.cpp | 29 +- ets2panda/parser/statementParser.cpp | 12 + .../ets/identifierReference1-expected.txt | 1967 +--- .../ets/identifierReference15-expected.txt | 893 +- .../ets/identifierReference16-expected.txt | 1397 +-- .../ets/identifierReference6-expected.txt | 576 +- .../ets/identifierReference7-expected.txt | 830 +- .../ets/invalidInheritance2-expected.txt | 751 +- .../ets/invalidPrivateAccess5-expected.txt | 1010 +- .../ets/invalidPrivateAccess6-expected.txt | 1539 +-- .../test/compiler/ets/override13-expected.txt | 2 +- ...staticInitializerInInnerClass-expected.txt | 687 +- .../test/parser/ets/StringFasta-expected.txt | 9691 +---------------- ...terface_enum_only_top_level_4-expected.txt | 442 +- .../ets/class_property_access-expected.txt | 786 +- .../parser/ets/declare_iface-expected.txt | 128 +- .../import_recursive-expected.txt | 211 +- .../subpackage_module_1-expected.txt | 320 +- .../subpackage_module_1-expected.txt | 292 +- .../test/parser/ets/interfaces-expected.txt | 128 +- ...class-access-modifier-private-expected.txt | 1 + .../local-class-access-modifier-private.ets | 22 + ...ass-access-modifier-protected-expected.txt | 1 + .../local-class-access-modifier-protected.ets | 21 + ...-class-access-modifier-public-expected.txt | 1 + .../local-class-access-modifier-public.ets | 21 + .../test/parser/ets/local-class-expected.txt | 425 + ...mber-access-modifier-private1-expected.txt | 1 + ...-class-member-access-modifier-private1.ets | 22 + ...mber-access-modifier-private2-expected.txt | 1 + ...-class-member-access-modifier-private2.ets | 22 + ...er-access-modifier-protected1-expected.txt | 1 + ...lass-member-access-modifier-protected1.ets | 22 + ...er-access-modifier-protected2-expected.txt | 1 + ...lass-member-access-modifier-protected2.ets | 22 + ...ember-access-modifier-public1-expected.txt | 1 + ...l-class-member-access-modifier-public1.ets | 22 + ...ember-access-modifier-public2-expected.txt | 1 + ...l-class-member-access-modifier-public2.ets | 22 + ets2panda/test/parser/ets/local-class.ets | 20 + ...rface-access-modifier-private-expected.txt | 1 + ...ocal-interface-access-modifier-private.ets | 21 + ...ace-access-modifier-protected-expected.txt | 1 + ...al-interface-access-modifier-protected.ets | 21 + ...erface-access-modifier-public-expected.txt | 1 + ...local-interface-access-modifier-public.ets | 21 + .../parser/ets/local-interface-expected.txt | 331 + ...mber-access-modifier-private1-expected.txt | 1 + ...erface-member-access-modifier-private1.ets | 22 + ...mber-access-modifier-private2-expected.txt | 1 + ...erface-member-access-modifier-private2.ets | 22 + ...er-access-modifier-protected1-expected.txt | 1 + ...face-member-access-modifier-protected1.ets | 22 + ...er-access-modifier-protected2-expected.txt | 1 + ...face-member-access-modifier-protected2.ets | 22 + ...ember-access-modifier-public1-expected.txt | 1 + ...terface-member-access-modifier-public1.ets | 22 + ...ember-access-modifier-public2-expected.txt | 1 + ...terface-member-access-modifier-public2.ets | 22 + ets2panda/test/parser/ets/local-interface.ets | 20 + .../ets/localClassIsPermitted-expected.txt | 501 +- .../test/parser/ets/named_types-expected.txt | 1087 +- .../ets/null-coalesc-negative-expected.txt | 166 +- .../parser/ets/test_interface-expected.txt | 128 +- ...mbda_in_body_capture_variable-expected.txt | 595 + .../ets/local-class-capture-boxing.ets | 218 + .../ets/local-class-capture-not-boxing.ets | 151 + .../ets/local-class-capture-parameter.ets | 39 + .../ets/local-class-in-local-class.ets | 54 + .../runtime/ets/local-class-mixed-capture.ets | 46 + .../local-class-modify-captured-parameter.ets | 41 + .../ets/local-class-standard-example1.ets | 49 + .../ets/local-class-standard-example2.ets | 82 + .../ets-runtime/ets-runtime-ignored.txt | 4 + ets2panda/varbinder/ETSBinder.cpp | 2 +- ets2panda/varbinder/recordTable.cpp | 20 +- ets2panda/varbinder/recordTable.h | 3 +- ets2panda/varbinder/scope.cpp | 80 +- ets2panda/varbinder/scope.h | 3 + 100 files changed, 5424 insertions(+), 21473 deletions(-) create mode 100644 ets2panda/compiler/lowering/ets/localClassLowering.cpp create mode 100644 ets2panda/compiler/lowering/ets/localClassLowering.h create mode 100644 ets2panda/test/parser/ets/local-class-access-modifier-private-expected.txt create mode 100644 ets2panda/test/parser/ets/local-class-access-modifier-private.ets create mode 100644 ets2panda/test/parser/ets/local-class-access-modifier-protected-expected.txt create mode 100644 ets2panda/test/parser/ets/local-class-access-modifier-protected.ets create mode 100644 ets2panda/test/parser/ets/local-class-access-modifier-public-expected.txt create mode 100644 ets2panda/test/parser/ets/local-class-access-modifier-public.ets create mode 100644 ets2panda/test/parser/ets/local-class-expected.txt create mode 100644 ets2panda/test/parser/ets/local-class-member-access-modifier-private1-expected.txt create mode 100644 ets2panda/test/parser/ets/local-class-member-access-modifier-private1.ets create mode 100644 ets2panda/test/parser/ets/local-class-member-access-modifier-private2-expected.txt create mode 100644 ets2panda/test/parser/ets/local-class-member-access-modifier-private2.ets create mode 100644 ets2panda/test/parser/ets/local-class-member-access-modifier-protected1-expected.txt create mode 100644 ets2panda/test/parser/ets/local-class-member-access-modifier-protected1.ets create mode 100644 ets2panda/test/parser/ets/local-class-member-access-modifier-protected2-expected.txt create mode 100644 ets2panda/test/parser/ets/local-class-member-access-modifier-protected2.ets create mode 100644 ets2panda/test/parser/ets/local-class-member-access-modifier-public1-expected.txt create mode 100644 ets2panda/test/parser/ets/local-class-member-access-modifier-public1.ets create mode 100644 ets2panda/test/parser/ets/local-class-member-access-modifier-public2-expected.txt create mode 100644 ets2panda/test/parser/ets/local-class-member-access-modifier-public2.ets create mode 100644 ets2panda/test/parser/ets/local-class.ets create mode 100644 ets2panda/test/parser/ets/local-interface-access-modifier-private-expected.txt create mode 100644 ets2panda/test/parser/ets/local-interface-access-modifier-private.ets create mode 100644 ets2panda/test/parser/ets/local-interface-access-modifier-protected-expected.txt create mode 100644 ets2panda/test/parser/ets/local-interface-access-modifier-protected.ets create mode 100644 ets2panda/test/parser/ets/local-interface-access-modifier-public-expected.txt create mode 100644 ets2panda/test/parser/ets/local-interface-access-modifier-public.ets create mode 100644 ets2panda/test/parser/ets/local-interface-expected.txt create mode 100644 ets2panda/test/parser/ets/local-interface-member-access-modifier-private1-expected.txt create mode 100644 ets2panda/test/parser/ets/local-interface-member-access-modifier-private1.ets create mode 100644 ets2panda/test/parser/ets/local-interface-member-access-modifier-private2-expected.txt create mode 100644 ets2panda/test/parser/ets/local-interface-member-access-modifier-private2.ets create mode 100644 ets2panda/test/parser/ets/local-interface-member-access-modifier-protected1-expected.txt create mode 100644 ets2panda/test/parser/ets/local-interface-member-access-modifier-protected1.ets create mode 100644 ets2panda/test/parser/ets/local-interface-member-access-modifier-protected2-expected.txt create mode 100644 ets2panda/test/parser/ets/local-interface-member-access-modifier-protected2.ets create mode 100644 ets2panda/test/parser/ets/local-interface-member-access-modifier-public1-expected.txt create mode 100644 ets2panda/test/parser/ets/local-interface-member-access-modifier-public1.ets create mode 100644 ets2panda/test/parser/ets/local-interface-member-access-modifier-public2-expected.txt create mode 100644 ets2panda/test/parser/ets/local-interface-member-access-modifier-public2.ets create mode 100644 ets2panda/test/parser/ets/local-interface.ets create mode 100644 ets2panda/test/runtime/ets/local-class-capture-boxing.ets create mode 100644 ets2panda/test/runtime/ets/local-class-capture-not-boxing.ets create mode 100644 ets2panda/test/runtime/ets/local-class-capture-parameter.ets create mode 100644 ets2panda/test/runtime/ets/local-class-in-local-class.ets create mode 100644 ets2panda/test/runtime/ets/local-class-mixed-capture.ets create mode 100644 ets2panda/test/runtime/ets/local-class-modify-captured-parameter.ets create mode 100644 ets2panda/test/runtime/ets/local-class-standard-example1.ets create mode 100644 ets2panda/test/runtime/ets/local-class-standard-example2.ets diff --git a/ets2panda/BUILD.gn b/ets2panda/BUILD.gn index e05b00f040..9f1c550824 100644 --- a/ets2panda/BUILD.gn +++ b/ets2panda/BUILD.gn @@ -164,6 +164,7 @@ libes2panda_sources = [ "compiler/lowering/ets/generateDeclarations.cpp", "compiler/lowering/ets/interfacePropertyDeclarations.cpp", "compiler/lowering/ets/lambdaLowering.cpp", + "compiler/lowering/ets/localClassLowering.cpp", "compiler/lowering/ets/objectIndexAccess.cpp", "compiler/lowering/ets/objectIterator.cpp", "compiler/lowering/ets/objectLiteralLowering.cpp", diff --git a/ets2panda/CMakeLists.txt b/ets2panda/CMakeLists.txt index 0d28088d95..5ddc010839 100644 --- a/ets2panda/CMakeLists.txt +++ b/ets2panda/CMakeLists.txt @@ -155,6 +155,7 @@ set(ES2PANDA_LIB_SRC compiler/lowering/ets/topLevelStmts/globalDeclTransformer.cpp compiler/lowering/ets/topLevelStmts/topLevelStmts.cpp compiler/lowering/ets/lambdaLowering.cpp + compiler/lowering/ets/localClassLowering.cpp compiler/lowering/ets/generateDeclarations.cpp compiler/lowering/ets/objectIndexAccess.cpp compiler/lowering/ets/objectIterator.cpp diff --git a/ets2panda/checker/ETSAnalyzer.cpp b/ets2panda/checker/ETSAnalyzer.cpp index 9259a20729..772af832e7 100644 --- a/ets2panda/checker/ETSAnalyzer.cpp +++ b/ets2panda/checker/ETSAnalyzer.cpp @@ -555,13 +555,18 @@ checker::Type *ETSAnalyzer::Check(ir::ETSNewArrayInstanceExpression *expr) const return expr->TsType(); } -checker::Type *ETSAnalyzer::Check(ir::ETSNewClassInstanceExpression *expr) const +void ETSAnalyzer::CheckLocalClassInstantiation(ir::ETSNewClassInstanceExpression *expr, ETSObjectType *calleeObj) const { ETSChecker *checker = GetETSChecker(); - auto *calleeType = GetCalleeType(checker, expr); - auto *calleeObj = calleeType->AsETSObjectType(); - expr->SetTsType(calleeObj); + ASSERT(calleeObj->GetDeclNode()->IsClassDefinition()); + if (calleeObj->GetDeclNode()->AsClassDefinition()->IsLocal()) { + checker->AddToLocalClassInstantiationList(expr); + } +} +void ETSAnalyzer::CheckInstantatedClass(ir::ETSNewClassInstanceExpression *expr, ETSObjectType *&calleeObj) const +{ + ETSChecker *checker = GetETSChecker(); if (expr->ClassDefinition() != nullptr) { if (!calleeObj->HasObjectFlag(checker::ETSObjectFlags::ABSTRACT) && calleeObj->GetDeclNode()->IsFinal()) { checker->ThrowTypeError({"Class ", calleeObj->Name(), " cannot be both 'abstract' and 'final'."}, @@ -582,6 +587,17 @@ checker::Type *ETSAnalyzer::Check(ir::ETSNewClassInstanceExpression *expr) const } else if (calleeObj->HasObjectFlag(checker::ETSObjectFlags::ABSTRACT)) { checker->ThrowTypeError({calleeObj->Name(), " is abstract therefore cannot be instantiated."}, expr->Start()); } +} + +checker::Type *ETSAnalyzer::Check(ir::ETSNewClassInstanceExpression *expr) const +{ + ETSChecker *checker = GetETSChecker(); + auto *calleeType = GetCalleeType(checker, expr); + auto *calleeObj = calleeType->AsETSObjectType(); + expr->SetTsType(calleeObj); + + CheckLocalClassInstantiation(expr, calleeObj); + CheckInstantatedClass(expr, calleeObj); if (calleeType->IsETSDynamicType() && !calleeType->AsETSDynamicType()->HasDecl()) { auto lang = calleeType->AsETSDynamicType()->Language(); diff --git a/ets2panda/checker/ETSAnalyzer.h b/ets2panda/checker/ETSAnalyzer.h index 4f63eeaed4..8350294baf 100644 --- a/ets2panda/checker/ETSAnalyzer.h +++ b/ets2panda/checker/ETSAnalyzer.h @@ -42,6 +42,8 @@ public: private: ETSChecker *GetETSChecker() const; + void CheckInstantatedClass(ir::ETSNewClassInstanceExpression *expr, ETSObjectType *&calleeObj) const; + void CheckLocalClassInstantiation(ir::ETSNewClassInstanceExpression *expr, ETSObjectType *calleeObj) const; void CheckMethodModifiers(ir::MethodDefinition *node) const; checker::Signature *ResolveSignature(ETSChecker *checker, ir::CallExpression *expr, checker::Type *calleeType, bool isFunctionalInterface, bool isUnionTypeWithFunctionalInterface) const; diff --git a/ets2panda/checker/ETSchecker.cpp b/ets2panda/checker/ETSchecker.cpp index bad4f1393e..89e2e4a9e5 100644 --- a/ets2panda/checker/ETSchecker.cpp +++ b/ets2panda/checker/ETSchecker.cpp @@ -136,6 +136,21 @@ void ETSChecker::InitializeBuiltin(varbinder::Variable *var, const util::StringV GetGlobalTypesHolder()->InitializeBuiltin(name, type); } +const ArenaList &ETSChecker::GetLocalClasses() const +{ + return localClasses_; +} + +const ArenaList &ETSChecker::GetLocalClassInstantiations() const +{ + return localClassInstantiations_; +} + +void ETSChecker::AddToLocalClassInstantiationList(ir::ETSNewClassInstanceExpression *newExpr) +{ + localClassInstantiations_.push_back(newExpr); +} + bool ETSChecker::StartChecker([[maybe_unused]] varbinder::VarBinder *varbinder, const CompilerOptions &options) { Initialize(varbinder); @@ -167,7 +182,6 @@ bool ETSChecker::StartChecker([[maybe_unused]] varbinder::VarBinder *varbinder, } CheckProgram(Program(), true); - BuildDynamicCallClass(true); BuildDynamicCallClass(false); diff --git a/ets2panda/checker/ETSchecker.h b/ets2panda/checker/ETSchecker.h index b90219d452..d853b84e44 100644 --- a/ets2panda/checker/ETSchecker.h +++ b/ets2panda/checker/ETSchecker.h @@ -61,6 +61,8 @@ public: // NOLINTNEXTLINE(readability-redundant-member-init) : Checker(), arrayTypes_(Allocator()->Adapter()), + localClasses_(Allocator()->Adapter()), + localClassInstantiations_(Allocator()->Adapter()), globalArraySignatures_(Allocator()->Adapter()), primitiveWrappers_(Allocator()), cachedComputedAbstracts_(Allocator()->Adapter()), @@ -158,6 +160,7 @@ public: void AddImplementedSignature(std::vector *implementedSignatures, varbinder::LocalVariable *function, ETSFunctionType *it); void CheckInnerClassMembers(const ETSObjectType *classType); + void CheckLocalClass(ir::ClassDefinition *classDef, CheckerStatus &checkerStatus); void CheckClassDefinition(ir::ClassDefinition *classDef); void FindAssignment(const ir::AstNode *node, const varbinder::LocalVariable *classVar, bool &initialized); void FindAssignments(const ir::AstNode *node, const varbinder::LocalVariable *classVar, bool &initialized); @@ -505,11 +508,13 @@ public: std::pair FindVariableInClassOrEnclosing( util::StringView name, const ETSObjectType *classType); varbinder::Variable *FindVariableInGlobal(const ir::Identifier *identifier); + void ExtraCheckForResolvedError(ir::Identifier *ident); void ValidateResolvedIdentifier(ir::Identifier *ident, varbinder::Variable *resolved); static bool IsVariableStatic(const varbinder::Variable *var); static bool IsVariableGetterSetter(const varbinder::Variable *var); bool IsSameDeclarationType(varbinder::LocalVariable *target, varbinder::LocalVariable *compare); - void SaveCapturedVariable(varbinder::Variable *var, const lexer::SourcePosition &pos); + void SaveCapturedVariable(varbinder::Variable *var, ir::Identifier *ident); + bool SaveCapturedVariableInLocalClass(varbinder::Variable *var, ir::Identifier *ident); void AddBoxingFlagToPrimitiveType(TypeRelation *relation, Type *target); void AddUnboxingFlagToPrimitiveType(TypeRelation *relation, Type *source, Type *self); void CheckUnboxedTypeWidenable(TypeRelation *relation, Type *target, Type *self); @@ -546,6 +551,7 @@ public: static ir::MethodDefinition *GenerateDefaultGetterSetter(ir::ClassProperty *field, varbinder::ClassScope *scope, bool isSetter, ETSChecker *checker); + bool IsInLocalClass(const ir::AstNode *node) const; // Exception ETSObjectType *CheckExceptionOrErrorType(checker::Type *type, lexer::SourcePosition pos); @@ -603,6 +609,12 @@ public: ETSObjectType *GetCachedFunctionlInterface(ir::ETSFunctionType *type); void CacheFunctionalInterface(ir::ETSFunctionType *type, ETSObjectType *ifaceType); + const ArenaList &GetLocalClasses() const; + const ArenaList &GetLocalClassInstantiations() const; + void AddToLocalClassInstantiationList(ir::ETSNewClassInstanceExpression *newExpr); + + ir::ETSParameterExpression *AddParam(varbinder::FunctionParamScope *paramScope, util::StringView name, + checker::Type *type); private: using ClassBuilder = std::function *)>; @@ -612,10 +624,11 @@ private: ArenaVector *, Type **)>; std::pair GetTargetIdentifierAndType(ir::Identifier *ident); - void ThrowError(ir::Identifier *ident); + [[noreturn]] void ThrowError(ir::Identifier *ident); void WrongContextErrorClassifyByType(ir::Identifier *ident, varbinder::Variable *resolved); void CheckEtsFunctionType(ir::Identifier *ident, ir::Identifier const *id, ir::TypeNode const *annotation); - void NotResolvedError(ir::Identifier *ident); + [[noreturn]] void NotResolvedError(ir::Identifier *ident, const varbinder::Variable *classVar, + const ETSObjectType *classType); void ValidateCallExpressionIdentifier(ir::Identifier *ident, Type *type); void ValidateNewClassInstanceIdentifier(ir::Identifier *ident, varbinder::Variable *resolved); void ValidateMemberIdentifier(ir::Identifier *ident, varbinder::Variable *resolved, Type *type); @@ -641,9 +654,6 @@ private: std::conditional_t CreateClassInitializer( varbinder::ClassScope *classScope, const ClassInitializerBuilder &builder, ETSObjectType *type = nullptr); - ir::ETSParameterExpression *AddParam(varbinder::FunctionParamScope *paramScope, util::StringView name, - checker::Type *type); - template ir::MethodDefinition *CreateClassMethod(varbinder::ClassScope *classScope, std::string_view name, ir::ModifierFlags modifierFlags, const MethodBuilder &builder); @@ -709,6 +719,8 @@ private: bool TryTransformingToStaticInvoke(ir::Identifier *ident, const Type *resolvedType); ArrayMap arrayTypes_; + ArenaList localClasses_; + ArenaList localClassInstantiations_; GlobalArraySignatureMap globalArraySignatures_; PrimitiveWrappers primitiveWrappers_; ComputedAbstracts cachedComputedAbstracts_; diff --git a/ets2panda/checker/checkerContext.h b/ets2panda/checker/checkerContext.h index 79c59a3fab..11ff0c4f3c 100644 --- a/ets2panda/checker/checkerContext.h +++ b/ets2panda/checker/checkerContext.h @@ -45,6 +45,7 @@ enum class CheckerStatus : uint32_t { IN_LAMBDA = 1U << 13U, IGNORE_VISIBILITY = 1U << 14U, IN_INSTANCE_EXTENSION_METHOD = 1U << 15U, + IN_LOCAL_CLASS = 1U << 16U }; DEFINE_BITOPS(CheckerStatus) diff --git a/ets2panda/checker/ets/function.cpp b/ets2panda/checker/ets/function.cpp index 2fa80607d5..438481b54f 100644 --- a/ets2panda/checker/ets/function.cpp +++ b/ets2panda/checker/ets/function.cpp @@ -1299,7 +1299,9 @@ void ETSChecker::CheckCapturedVariable(ir::AstNode *const node, varbinder::Varia void ETSChecker::CheckCapturedVariableInSubnodes(ir::AstNode *node, varbinder::Variable *var) { - node->Iterate([this, var](ir::AstNode *childNode) { CheckCapturedVariable(childNode, var); }); + if (!node->IsClassDefinition()) { + node->Iterate([this, var](ir::AstNode *childNode) { CheckCapturedVariable(childNode, var); }); + } } void ETSChecker::CheckCapturedVariables() @@ -2100,13 +2102,14 @@ ir::ClassProperty *ETSChecker::CreateLambdaCapturedField(const varbinder::Variab auto fieldCtx = varbinder::LexicalScope::Enter(VarBinder(), scope->InstanceFieldScope()); // Create the name for the synthetic property node - util::UString fieldName(util::StringView("field"), Allocator()); + util::UString fieldName(util::StringView("field#"), Allocator()); fieldName.Append(std::to_string(idx)); auto *fieldIdent = Allocator()->New(fieldName.View(), Allocator()); // Create the synthetic class property node auto *field = Allocator()->New(fieldIdent, nullptr, nullptr, ir::ModifierFlags::NONE, Allocator(), false); + fieldIdent->SetParent(field); // Add the declaration to the scope, and set the type based on the captured variable's scope auto [decl, var] = VarBinder()->NewVarDecl(pos, fieldIdent->Name()); diff --git a/ets2panda/checker/ets/helpers.cpp b/ets2panda/checker/ets/helpers.cpp index d730ca128f..a93bf9d545 100644 --- a/ets2panda/checker/ets/helpers.cpp +++ b/ets2panda/checker/ets/helpers.cpp @@ -520,16 +520,16 @@ void ETSChecker::CheckEtsFunctionType(ir::Identifier *const ident, ir::Identifie } } -void ETSChecker::NotResolvedError(ir::Identifier *const ident) +void ETSChecker::NotResolvedError(ir::Identifier *const ident, const varbinder::Variable *classVar, + const ETSObjectType *classType) { - const auto [class_var, class_type] = FindVariableInClassOrEnclosing(ident->Name(), Context().ContainingClass()); - if (class_var == nullptr) { + if (classVar == nullptr) { ThrowError(ident); } - if (IsVariableStatic(class_var)) { + if (IsVariableStatic(classVar)) { ThrowTypeError( - {"Static property '", ident->Name(), "' must be accessed through it's class '", class_type->Name(), "'"}, + {"Static property '", ident->Name(), "' must be accessed through it's class '", classType->Name(), "'"}, ident->Start()); } else { ThrowTypeError({"Property '", ident->Name(), "' must be accessed through 'this'"}, ident->Start()); @@ -645,10 +645,25 @@ bool ETSChecker::ValidateBinaryExpressionIdentifier(ir::Identifier *const ident, return isFinished; } +void ETSChecker::ExtraCheckForResolvedError(ir::Identifier *const ident) +{ + const auto [class_var, class_type] = FindVariableInClassOrEnclosing(ident->Name(), Context().ContainingClass()); + auto *parentClass = FindAncestorGivenByType(ident, ir::AstNodeType::CLASS_DEFINITION); + if (parentClass != nullptr && parentClass->AsClassDefinition()->IsLocal()) { + if (parentClass != class_type->GetDeclNode()) { + ThrowTypeError({"Property '", ident->Name(), "' of enclosing class '", class_type->Name(), + "' is not allowed to be captured from the local class '", + parentClass->AsClassDefinition()->Ident()->Name(), "'"}, + ident->Start()); + } + } + NotResolvedError(ident, class_var, class_type); +} + void ETSChecker::ValidateResolvedIdentifier(ir::Identifier *const ident, varbinder::Variable *const resolved) { if (resolved == nullptr) { - NotResolvedError(ident); + ExtraCheckForResolvedError(ident); } auto *const resolvedType = GetApparentType(GetTypeOfVariable(resolved)); @@ -698,8 +713,77 @@ void ETSChecker::ValidateResolvedIdentifier(ir::Identifier *const ident, varbind } } -void ETSChecker::SaveCapturedVariable(varbinder::Variable *const var, const lexer::SourcePosition &pos) +bool ETSChecker::SaveCapturedVariableInLocalClass(varbinder::Variable *const var, ir::Identifier *ident) +{ + const auto &pos = ident->Start(); + + if (!HasStatus(CheckerStatus::IN_LOCAL_CLASS)) { + return false; + } + + if (!var->HasFlag(varbinder::VariableFlags::LOCAL)) { + return false; + } + + LOG(DEBUG, ES2PANDA) << "Checking variable (line:" << pos.line << "): " << var->Name(); + auto *scopeIter = Scope(); + bool inStaticMethod = false; + + auto captureVariable = [this, var, ident, &scopeIter, &inStaticMethod, &pos]() { + if (inStaticMethod) { + ThrowTypeError({"Not allowed to capture variable '", var->Name(), "' in static method"}, pos); + } + if (scopeIter->Node()->AsClassDefinition()->CaptureVariable(var)) { + LOG(DEBUG, ES2PANDA) << " Captured in class:" << scopeIter->Node()->AsClassDefinition()->Ident()->Name(); + } + + auto *parent = ident->Parent(); + + if (parent->IsVariableDeclarator()) { + parent = parent->Parent()->Parent(); + } + + if (!(parent->IsUpdateExpression() || + (parent->IsAssignmentExpression() && parent->AsAssignmentExpression()->Left() == ident)) || + var->Declaration() == nullptr) { + return; + } + + if (var->Declaration()->IsParameterDecl()) { + LOG(DEBUG, ES2PANDA) << " - Modified parameter "; + if (!var->HasFlag(varbinder::VariableFlags::BOXED)) { + scopeIter->Node()->AsClassDefinition()->AddToLocalVariableIsNeeded(var); + } + } else { + var->AddFlag(varbinder::VariableFlags::BOXED); + } + }; + + while (scopeIter != var->GetScope()) { + if (scopeIter->Node() != nullptr) { + if (scopeIter->Node()->IsScriptFunction() && scopeIter->Node()->AsScriptFunction()->IsStatic()) { + inStaticMethod = true; + } + + if (scopeIter->Node()->IsClassDefinition()) { + captureVariable(); + return true; + } + } + scopeIter = scopeIter->Parent(); + } + + return false; +} + +void ETSChecker::SaveCapturedVariable(varbinder::Variable *const var, ir::Identifier *ident) { + const auto &pos = ident->Start(); + + if (SaveCapturedVariableInLocalClass(var, ident)) { + return; + } + if (!HasStatus(CheckerStatus::IN_LAMBDA)) { return; } @@ -728,7 +812,7 @@ Type *ETSChecker::ResolveIdentifier(ir::Identifier *const ident) { if (ident->Variable() != nullptr) { auto *const resolved = ident->Variable(); - SaveCapturedVariable(resolved, ident->Start()); + SaveCapturedVariable(resolved, ident); return GetTypeOfVariable(resolved); } @@ -742,7 +826,7 @@ Type *ETSChecker::ResolveIdentifier(ir::Identifier *const ident) ValidateResolvedIdentifier(ident, resolved); ValidatePropertyAccess(resolved, Context().ContainingClass(), ident->Start()); - SaveCapturedVariable(resolved, ident->Start()); + SaveCapturedVariable(resolved, ident); ident->SetVariable(resolved); return GetTypeOfVariable(resolved); @@ -2667,6 +2751,18 @@ void ETSChecker::ModifyPreferredType(ir::ArrayExpression *const arrayExpr, Type } } +bool ETSChecker::IsInLocalClass(const ir::AstNode *node) const +{ + while (node != nullptr) { + if (node->Type() == ir::AstNodeType::CLASS_DEFINITION) { + return node->AsClassDefinition()->IsLocal(); + } + node = node->Parent(); + } + + return false; +} + ir::Expression *ETSChecker::GenerateImplicitInstantiateArg(varbinder::LocalVariable *instantiateMethod, const std::string &className) { diff --git a/ets2panda/checker/ets/object.cpp b/ets2panda/checker/ets/object.cpp index d7c3f9dea3..82f9371201 100644 --- a/ets2panda/checker/ets/object.cpp +++ b/ets2panda/checker/ets/object.cpp @@ -814,12 +814,22 @@ void ETSChecker::AddImplementedSignature(std::vector *implementedSi } } +void ETSChecker::CheckLocalClass(ir::ClassDefinition *classDef, CheckerStatus &checkerStatus) +{ + if (classDef->IsLocal()) { + checkerStatus |= CheckerStatus::IN_LOCAL_CLASS; + if (!classDef->Parent()->Parent()->IsBlockStatement()) { + ThrowTypeError("Local classes must be defined between balanced braces", classDef->Start()); + } + localClasses_.push_back(classDef); + } +} + void ETSChecker::CheckClassDefinition(ir::ClassDefinition *classDef) { auto *classType = classDef->TsType()->AsETSObjectType(); - auto *enclosingClass = Context().ContainingClass(); auto newStatus = checker::CheckerStatus::IN_CLASS; - classType->SetEnclosingType(enclosingClass); + classType->SetEnclosingType(Context().ContainingClass()); if (classDef->IsInner()) { newStatus |= CheckerStatus::INNER_CLASS; @@ -828,6 +838,8 @@ void ETSChecker::CheckClassDefinition(ir::ClassDefinition *classDef) if (classDef->IsGlobal()) { classType->AddObjectFlag(checker::ETSObjectFlags::GLOBAL); + } else { + CheckLocalClass(classDef, newStatus); } checker::ScopeContext scopeCtx(this, classDef->Scope()); diff --git a/ets2panda/checker/ets/typeCreation.cpp b/ets2panda/checker/ets/typeCreation.cpp index 1b317b8e17..10b9b17bc4 100644 --- a/ets2panda/checker/ets/typeCreation.cpp +++ b/ets2panda/checker/ets/typeCreation.cpp @@ -25,6 +25,7 @@ #include "checker/types/ets/shortType.h" #include "generated/signatures.h" #include "ir/base/classDefinition.h" +#include "ir/statements/classDeclaration.h" #include "ir/base/scriptFunction.h" #include "ir/ets/etsScript.h" #include "ir/expressions/identifier.h" @@ -497,6 +498,14 @@ ETSObjectType *ETSChecker::CreateNewETSObjectType(util::StringView name, ir::Ast auto *containingObjType = util::Helpers::GetContainingObjectType(declNode->Parent()); + if (declNode->IsClassDefinition()) { + if (declNode->AsClassDefinition()->IsLocal()) { + util::UString localName(declNode->AsClassDefinition()->LocalPrefix(), Allocator()); + localName.Append(name); + assemblerName = localName.View(); + } + } + if (containingObjType != nullptr) { prefix = containingObjType->AssemblerName(); } else if (const auto *topStatement = declNode->GetTopStatement(); @@ -505,14 +514,13 @@ ETSObjectType *ETSChecker::CreateNewETSObjectType(util::StringView name, ir::Ast ASSERT(declNode->IsTSInterfaceDeclaration()); assemblerName = declNode->AsTSInterfaceDeclaration()->InternalName(); } else { - auto *program = static_cast(declNode->GetTopStatement())->Program(); - prefix = program->GetPackageName(); + prefix = static_cast(declNode->GetTopStatement())->Program()->GetPackageName(); } if (!prefix.Empty()) { util::UString fullPath(prefix, Allocator()); fullPath.Append('.'); - fullPath.Append(name); + fullPath.Append(assemblerName); assemblerName = fullPath.View(); } diff --git a/ets2panda/compiler/base/lreference.cpp b/ets2panda/compiler/base/lreference.cpp index 8b00d8c3c0..a047c992aa 100644 --- a/ets2panda/compiler/base/lreference.cpp +++ b/ets2panda/compiler/base/lreference.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 - 2023 Huawei Device Co., Ltd. + * Copyright (c) 2021 - 2024 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 @@ -208,14 +208,24 @@ ETSLReference::ETSLReference(CodeGen *cg, const ir::AstNode *node, ReferenceKind ETSLReference ETSLReference::Create(CodeGen *const cg, const ir::AstNode *const node, const bool isDeclaration) { if (node->Type() == ir::AstNodeType::IDENTIFIER) { + if (node->AsIdentifier()->Variable() != nullptr) { + auto *var = node->AsIdentifier()->Variable(); + varbinder::ConstScopeFindResult res; + res.name = var->Name(); + res.variable = var; + res.scope = var->GetScope(); + auto refKind = ReferenceKind::VAR_OR_GLOBAL; + if (var->HasFlag(varbinder::VariableFlags::PROPERTY)) { + refKind = ReferenceKind::FIELD; + } + return {cg, node, refKind, res, isDeclaration}; + } + const auto &name = node->AsIdentifier()->Name(); auto res = cg->Scope()->FindInFunctionScope(name, varbinder::ResolveBindingOptions::ALL); if (res.variable == nullptr) { res = cg->Scope()->FindInGlobal(name, varbinder::ResolveBindingOptions::ALL_VARIABLES | varbinder::ResolveBindingOptions::ALL_METHOD); - if (res.variable == nullptr) { - res.variable = node->AsIdentifier()->Variable(); - } } return {cg, node, ReferenceKind::VAR_OR_GLOBAL, res, isDeclaration}; diff --git a/ets2panda/compiler/core/ETSCompiler.cpp b/ets2panda/compiler/core/ETSCompiler.cpp index 11eb18a832..4c8b09f2bf 100644 --- a/ets2panda/compiler/core/ETSCompiler.cpp +++ b/ets2panda/compiler/core/ETSCompiler.cpp @@ -323,6 +323,7 @@ void ETSCompiler::Compile(const ir::ETSNewClassInstanceExpression *expr) const { ETSGen *etsg = GetETSGen(); if (expr->TsType()->IsETSDynamicType()) { + compiler::RegScope rs(etsg); auto objReg = etsg->AllocReg(); auto *name = expr->GetTypeRef()->AsETSTypeReference()->Part()->Name(); CreateDynamicObject(expr, etsg, objReg, name, expr->signature_, expr->GetArguments()); @@ -1558,10 +1559,7 @@ void ETSCompiler::Compile(const ir::BreakStatement *st) const CompileImpl(st, etsg); } -void ETSCompiler::Compile([[maybe_unused]] const ir::ClassDeclaration *st) const -{ - UNREACHABLE(); -} +void ETSCompiler::Compile([[maybe_unused]] const ir::ClassDeclaration *st) const {} static void CompileImpl(const ir::ContinueStatement *self, ETSGen *etsg) { @@ -2180,10 +2178,7 @@ void ETSCompiler::Compile([[maybe_unused]] const ir::TSInterfaceBody *expr) cons UNREACHABLE(); } -void ETSCompiler::Compile([[maybe_unused]] const ir::TSInterfaceDeclaration *st) const -{ - UNREACHABLE(); -} +void ETSCompiler::Compile([[maybe_unused]] const ir::TSInterfaceDeclaration *st) const {} void ETSCompiler::Compile([[maybe_unused]] const ir::TSInterfaceHeritage *expr) const { diff --git a/ets2panda/compiler/core/ETSGen.cpp b/ets2panda/compiler/core/ETSGen.cpp index 21128778cd..6b432dffd8 100644 --- a/ets2panda/compiler/core/ETSGen.cpp +++ b/ets2panda/compiler/core/ETSGen.cpp @@ -321,7 +321,7 @@ void ETSGen::LoadVar(const ir::AstNode *node, varbinder::Variable const *const v } case ReferenceKind::LOCAL: { LoadAccumulator(node, local->Vreg()); - SetAccumulatorType(var->TsType()); + SetAccumulatorType(TypeForVar(var)); break; } default: { @@ -346,7 +346,11 @@ void ETSGen::StoreVar(const ir::AstNode *node, const varbinder::ConstScopeFindRe break; } case ReferenceKind::FIELD: { - StoreProperty(node, result.variable->TsType(), GetThisReg(), result.name); + if (local->HasFlag(varbinder::VariableFlags::BOXED)) { + EmitPropertyBoxSet(node, result.variable->TsType(), GetThisReg(), result.name); + } else { + StoreProperty(node, result.variable->TsType(), GetThisReg(), result.name); + } break; } case ReferenceKind::LOCAL: { @@ -372,7 +376,9 @@ util::StringView ETSGen::FormClassPropReference(const checker::ETSObjectType *cl std::string fullName = classType->AssemblerName().Mutf8(); while (iter->EnclosingType() != nullptr) { auto enclosingName = iter->EnclosingType()->Name().Mutf8().append(".").append(fullName); - fullName = enclosingName; + if (iter->EnclosingType()->GetDeclNode()->Type() == ir::AstNodeType::IDENTIFIER) { + fullName = enclosingName; + } iter = iter->EnclosingType(); } @@ -1407,6 +1413,54 @@ void ETSGen::EmitLocalBoxSet(ir::AstNode const *node, varbinder::LocalVariable * SetAccumulatorType(Checker()->GetGlobalTypesHolder()->GlobalVoidType()); } +void ETSGen::EmitPropertyBoxSet(const ir::AstNode *const node, const checker::Type *propType, const VReg objectReg, + const util::StringView &name) +{ + const auto fullName = FormClassPropReference(GetVRegType(objectReg)->AsETSObjectType(), name); + const RegScope rs(this); + + auto inputValue = AllocReg(); + StoreAccumulator(node, inputValue); + + Ra().Emit(node, objectReg, fullName); + SetAccumulatorType(Checker()->GetGlobalTypesHolder()->GlobalETSObjectType()); + + auto field = AllocReg(); + StoreAccumulator(node, field); + LoadAccumulator(node, inputValue); + + switch (checker::ETSChecker::TypeKind(propType)) { + case checker::TypeFlag::ETS_BOOLEAN: + Ra().Emit(node, Signatures::BUILTIN_BOOLEAN_BOX_SET, field, 1); + break; + case checker::TypeFlag::BYTE: + Ra().Emit(node, Signatures::BUILTIN_BYTE_BOX_SET, field, 1); + break; + case checker::TypeFlag::CHAR: + Ra().Emit(node, Signatures::BUILTIN_CHAR_BOX_SET, field, 1); + break; + case checker::TypeFlag::SHORT: + Ra().Emit(node, Signatures::BUILTIN_SHORT_BOX_SET, field, 1); + break; + case checker::TypeFlag::INT: + Ra().Emit(node, Signatures::BUILTIN_INT_BOX_SET, field, 1); + break; + case checker::TypeFlag::LONG: + Ra().Emit(node, Signatures::BUILTIN_LONG_BOX_SET, field, 1); + break; + case checker::TypeFlag::FLOAT: + Ra().Emit(node, Signatures::BUILTIN_FLOAT_BOX_SET, field, 1); + break; + case checker::TypeFlag::DOUBLE: + Ra().Emit(node, Signatures::BUILTIN_DOUBLE_BOX_SET, field, 1); + break; + default: + Ra().Emit(node, Signatures::BUILTIN_BOX_SET, field, 1); + break; + } + SetAccumulatorType(Checker()->GetGlobalTypesHolder()->GlobalVoidType()); +} + void ETSGen::CastToBoolean([[maybe_unused]] const ir::AstNode *node) { auto typeKind = checker::ETSChecker::TypeKind(GetAccumulatorType()); @@ -1777,6 +1831,7 @@ void ETSGen::CastDynamicToObject(const ir::AstNode *node, const checker::Type *t // NOTE(vpukhov): #14626 remove, replace targetType with interface if (targetType->IsLambdaObject()) { + RegScope rs(this); VReg dynObjReg = AllocReg(); StoreAccumulator(node, dynObjReg); Ra().Emit(node, targetType->AsETSObjectType()->ConstructSignatures()[0]->InternalName(), diff --git a/ets2panda/compiler/core/ETSGen.h b/ets2panda/compiler/core/ETSGen.h index 76a55cea47..b5dc5befb4 100644 --- a/ets2panda/compiler/core/ETSGen.h +++ b/ets2panda/compiler/core/ETSGen.h @@ -396,6 +396,8 @@ public: void EmitLocalBoxCtor(ir::AstNode const *node); void EmitLocalBoxGet(ir::AstNode const *node, checker::Type const *contentType); void EmitLocalBoxSet(ir::AstNode const *node, varbinder::LocalVariable *lhsVar); + void EmitPropertyBoxSet(const ir::AstNode *node, const checker::Type *propType, VReg objectReg, + const util::StringView &name); void LoadArrayLength(const ir::AstNode *node, VReg arrayReg); void LoadArrayElement(const ir::AstNode *node, VReg objectReg); @@ -723,6 +725,7 @@ private: void BinaryDynamicStrictEquality(const ir::AstNode *node, VReg lhs, Label *ifFalse) { ASSERT(GetAccumulatorType()->IsETSDynamicType() && GetVRegType(lhs)->IsETSDynamicType()); + RegScope scope(this); Ra().Emit(node, Signatures::BUILTIN_JSRUNTIME_STRICT_EQUAL, lhs, MoveAccToReg(node)); Ra().Emit(node, ifFalse); } @@ -1009,18 +1012,18 @@ private: switch (arguments.size()) { case 0U: { - Ra().Emit(node, signature->InternalName(), dummyReg_, dummyReg_); + Ra().Emit(node, signature->InternalName(), dummyReg_, dummyReg_); break; } case 1U: { COMPILE_ARG(0); - Ra().Emit(node, signature->InternalName(), arg0, dummyReg_); + Ra().Emit(node, signature->InternalName(), arg0, dummyReg_); break; } case 2U: { COMPILE_ARG(0); COMPILE_ARG(1); - Ra().Emit(node, signature->InternalName(), arg0, arg1); + Ra().Emit(node, signature->InternalName(), arg0, arg1); break; } case 3U: { @@ -1035,7 +1038,7 @@ private: COMPILE_ARG(1); COMPILE_ARG(2); COMPILE_ARG(3); - Ra().Emit(node, signature->InternalName(), arg0, arg1, arg2, arg3); + Ra().Emit(node, signature->InternalName(), arg0, arg1, arg2, arg3); break; } default: { diff --git a/ets2panda/compiler/lowering/ets/localClassLowering.cpp b/ets2panda/compiler/lowering/ets/localClassLowering.cpp new file mode 100644 index 0000000000..0ddf07117c --- /dev/null +++ b/ets2panda/compiler/lowering/ets/localClassLowering.cpp @@ -0,0 +1,279 @@ +/* + * Copyright (c) 2023-2024 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. + */ + +#include "localClassLowering.h" +#include "checker/ETSchecker.h" +#include "varbinder/ETSBinder.h" +#include "../util.h" + +namespace ark::es2panda::compiler { + +std::string_view LocalClassConstructionPhase::Name() const +{ + return "LocalClassConstructionPhase"; +} + +void LocalClassConstructionPhase::ReplaceReferencesFromTheParametersToTheLocalVariavbles( + ir::ClassDefinition *classDef, const ArenaMap &newLocalVariablesMap, + const ArenaSet &initializers) +{ + // Replace the parameter variables with the newly created temporal variables and change all the references to + // the new temporal variable + for (auto boxedVarParamsIt = newLocalVariablesMap.begin(); boxedVarParamsIt != newLocalVariablesMap.end(); + ++boxedVarParamsIt) { + auto paramVar = boxedVarParamsIt->first; + auto newVar = boxedVarParamsIt->second; + + classDef->EraseCapturedVariable(paramVar); + classDef->CaptureVariable(newVar); + + auto *scope = paramVar->GetScope(); + scope = scope->AsFunctionParamScope()->GetFunctionScope(); + + auto *block = scope->AsFunctionScope()->Node()->AsScriptFunction()->Body()->AsBlockStatement(); + + block->IterateRecursively([&newLocalVariablesMap, &initializers](ir::AstNode *childNode) { + if (childNode->Type() != ir::AstNodeType::IDENTIFIER || + initializers.find(childNode->AsIdentifier()) != initializers.end()) { + return; + } + const auto &newMapIt = newLocalVariablesMap.find(childNode->AsIdentifier()->Variable()); + if (newMapIt != newLocalVariablesMap.end()) { + LOG(DEBUG, ES2PANDA) << " Remap param variable: " << childNode->AsIdentifier()->Name() + << " (identifier:" << (void *)childNode + << ") variable:" << (void *)childNode->AsIdentifier()->Variable() + << " -> temporal variable:" << (void *)newMapIt->second; + childNode->AsIdentifier()->SetVariable(newMapIt->second); + } + }); + } +} + +void LocalClassConstructionPhase::CreateTemporalLocalVariableForModifiedParameters(public_lib::Context *ctx, + ir::ClassDefinition *classDef) +{ + // Store the new variables created for the function parameters needed to be boxed + ArenaMap newLocalVariablesMap(ctx->allocator->Adapter()); + + // Store the new variables created for the function parameters needed to be boxed + ArenaSet initializers(ctx->allocator->Adapter()); + + // Create local variables for modified parameters since the parameters can not be boxed + for (auto var : classDef->CapturedVariables()) { + if (var->Declaration() != nullptr && var->Declaration()->IsParameterDecl() && + classDef->IsLocalVariableNeeded(var)) { + auto *scope = var->GetScope(); + ASSERT(scope->IsFunctionParamScope()); + scope = scope->AsFunctionParamScope()->GetFunctionScope(); + ASSERT(scope->AsFunctionScope()->Node()->IsScriptFunction()); + ASSERT(scope->AsFunctionScope()->Node()->AsScriptFunction()->Body()->IsBlockStatement()); + auto *param = var->Declaration()->AsParameterDecl(); + auto *block = scope->AsFunctionScope()->Node()->AsScriptFunction()->Body()->AsBlockStatement(); + + auto *newVarIdentifier = Gensym(ctx->allocator); + + auto *newVar = scope->AddDecl( + ctx->allocator, newVarIdentifier->Name(), varbinder::VariableFlags::LOCAL); + + newVarIdentifier->SetVariable(newVar); + newVar->SetTsType(var->TsType()); + newVar->AddFlag(varbinder::VariableFlags::BOXED); + + auto *initializer = ctx->allocator->New(param->Name(), ctx->allocator); + initializer->SetVariable(var); + initializer->SetTsType(var->TsType()); + + initializers.insert(initializer); + auto *declarator = ctx->allocator->New(ir::VariableDeclaratorFlag::LET, + newVarIdentifier, initializer); + + newVarIdentifier->SetParent(declarator); + initializer->SetParent(declarator); + + ArenaVector declarators(ctx->allocator->Adapter()); + declarators.push_back(declarator); + + auto *newVariableDeclaration = ctx->allocator->New( + ir::VariableDeclaration::VariableDeclarationKind::LET, ctx->allocator, std::move(declarators), false); + + declarator->SetParent(newVariableDeclaration); + newVariableDeclaration->SetParent(block); + block->Statements().insert(block->Statements().begin(), newVariableDeclaration); + + newLocalVariablesMap[var] = newVar; + } + } + + ReplaceReferencesFromTheParametersToTheLocalVariavbles(classDef, newLocalVariablesMap, initializers); +} + +void LocalClassConstructionPhase::CreateClassPropertiesForCapturedVariables( + public_lib::Context *ctx, ir::ClassDefinition *classDef, + ArenaMap &variableMap, + ArenaMap &propertyMap) +{ + checker::ETSChecker *const checker = ctx->checker->AsETSChecker(); + size_t idx = 0; + ArenaVector properties(ctx->allocator->Adapter()); + for (auto var : classDef->CapturedVariables()) { + ASSERT(classDef->Scope()->Type() == varbinder::ScopeType::CLASS); + auto *property = checker->CreateLambdaCapturedField( + var, reinterpret_cast(classDef->Scope()), idx, classDef->Start()); + LOG(DEBUG, ES2PANDA) << " - Creating property (" << property->Id()->Name() + << ") for captured variable: " << var->Name(); + properties.push_back(property); + variableMap[var] = property->Id()->Variable(); + propertyMap[var] = property; + idx++; + } + + classDef->AddProperties(std::move(properties)); +} + +void LocalClassConstructionPhase::ModifyConstructorParameters( + public_lib::Context *ctx, ir::ClassDefinition *classDef, + ArenaMap &variableMap, + ArenaMap ¶meterMap) + +{ + auto *classType = classDef->TsType()->AsETSObjectType(); + checker::ETSChecker *const checker = ctx->checker->AsETSChecker(); + + for (auto *signature : classType->ConstructSignatures()) { + LOG(DEBUG, ES2PANDA) << " - Modifying Constructor: " << signature->InternalName(); + auto constructor = signature->Function(); + auto ¶meters = constructor->Params(); + auto &sigParams = signature->Params(); + signature->GetSignatureInfo()->minArgCount += classDef->CapturedVariables().size(); + + ASSERT(signature == constructor->Signature()); + for (auto var : classDef->CapturedVariables()) { + auto *newParam = + checker->AddParam(constructor->Scope()->ParamScope(), var->Name(), checker->MaybeBoxedType(var)); + newParam->SetParent(constructor); + // NOTE(psiket) : Moving the parameter after the 'this'. Should modify the AddParam + // to be able to insert after the this. + auto ¶mScopeParams = constructor->Scope()->ParamScope()->Params(); + auto thisParamIt = ++paramScopeParams.begin(); + paramScopeParams.insert(thisParamIt, paramScopeParams.back()); + paramScopeParams.pop_back(); + + parameters.insert(parameters.begin(), newParam); + ASSERT(newParam->Variable()->Type() == varbinder::VariableType::LOCAL); + sigParams.insert(sigParams.begin(), newParam->Ident()->Variable()->AsLocalVariable()); + parameterMap[var] = newParam->Ident()->Variable()->AsLocalVariable(); + } + reinterpret_cast(checker->VarBinder())->BuildFunctionName(constructor); + LOG(DEBUG, ES2PANDA) << " Transformed Constructor: " << signature->InternalName(); + + auto *body = constructor->Body(); + ArenaVector initStatements(ctx->allocator->Adapter()); + for (auto var : classDef->CapturedVariables()) { + auto *propertyVar = variableMap[var]; + auto *initStatement = checker->CreateLambdaCtorFieldInit(propertyVar->Name(), propertyVar); + auto *fieldInit = initStatement->AsExpressionStatement()->GetExpression()->AsAssignmentExpression(); + auto *ctorParamVar = parameterMap[var]; + auto *fieldVar = variableMap[var]; + auto *leftHandSide = fieldInit->Left(); + leftHandSide->AsMemberExpression()->SetObjectType(classType); + leftHandSide->AsMemberExpression()->SetPropVar(fieldVar->AsLocalVariable()); + leftHandSide->AsMemberExpression()->SetIgnoreBox(); + leftHandSide->AsMemberExpression()->SetTsType(fieldVar->TsType()); + leftHandSide->AsMemberExpression()->Object()->SetTsType(classType); + fieldInit->Right()->AsIdentifier()->SetVariable(ctorParamVar); + fieldInit->Right()->SetTsType(ctorParamVar->TsType()); + initStatement->SetParent(body); + initStatements.push_back(initStatement); + } + auto &statements = body->AsBlockStatement()->Statements(); + statements.insert(statements.begin(), initStatements.begin(), initStatements.end()); + } +} + +void LocalClassConstructionPhase::RemapReferencesFromCapturedVariablesToClassProperties( + ir::ClassDefinition *classDef, ArenaMap &variableMap) +{ + auto *classType = classDef->TsType()->AsETSObjectType(); + auto remapCapturedVariables = [&variableMap](ir::AstNode *childNode) { + if (childNode->Type() == ir::AstNodeType::IDENTIFIER) { + LOG(DEBUG, ES2PANDA) << " checking var:" << (void *)childNode; + const auto &mapIt = variableMap.find(childNode->AsIdentifier()->Variable()); + if (mapIt != variableMap.end()) { + LOG(DEBUG, ES2PANDA) << " Remap: " << childNode->AsIdentifier()->Name() + << " (identifier:" << (void *)childNode + << ") variable:" << (void *)childNode->AsIdentifier()->Variable() + << " -> property variable:" << (void *)mapIt->second; + childNode->AsIdentifier()->SetVariable(mapIt->second); + } else { + } + } + }; + + for (auto *it : classDef->Body()) { + if (it->IsMethodDefinition() && !it->AsMethodDefinition()->IsConstructor()) { + LOG(DEBUG, ES2PANDA) << " - Rebinding variable rerferences in: " + << it->AsMethodDefinition()->Id()->Name().Mutf8().c_str(); + it->AsMethodDefinition()->Function()->Body()->IterateRecursively(remapCapturedVariables); + } + } + // Since the constructor with zero parameter is not listed in the class_def body the constructors + // processed separately + for (auto *signature : classType->ConstructSignatures()) { + auto *constructor = signature->Function(); + LOG(DEBUG, ES2PANDA) << " - Rebinding variable rerferences in: " << constructor->Id()->Name(); + constructor->Body()->IterateRecursively(remapCapturedVariables); + } +} + +bool LocalClassConstructionPhase::Perform(public_lib::Context *ctx, parser::Program * /*program*/) +{ + checker::ETSChecker *const checker = ctx->checker->AsETSChecker(); + for (auto *classDef : checker->GetLocalClasses()) { + LOG(DEBUG, ES2PANDA) << "Altering local class with the captured variables: " << classDef->InternalName(); + // Map the captured variable to the variable of the class property + ArenaMap variableMap(ctx->allocator->Adapter()); + // Map the captured variable to the class property + ArenaMap propertyMap(ctx->allocator->Adapter()); + // Map the captured variable to the constructor parameter + ArenaMap parameterMap(ctx->allocator->Adapter()); + + CreateTemporalLocalVariableForModifiedParameters(ctx, classDef); + CreateClassPropertiesForCapturedVariables(ctx, classDef, variableMap, propertyMap); + ModifyConstructorParameters(ctx, classDef, variableMap, parameterMap); + RemapReferencesFromCapturedVariablesToClassProperties(classDef, variableMap); + } + + // Alter the instantiations + for (auto *newExpr : checker->GetLocalClassInstantiations()) { + checker::Type *calleeType = newExpr->GetTypeRef()->Check(checker); + auto *calleeObj = calleeType->AsETSObjectType(); + auto *classDef = calleeObj->GetDeclNode()->AsClassDefinition(); + LOG(DEBUG, ES2PANDA) << "Instantiating local class: " << classDef->Ident()->Name(); + for (auto *var : classDef->CapturedVariables()) { + LOG(DEBUG, ES2PANDA) << " - Extending constructor argument with captured variable: " << var->Name(); + + auto *param = checker->AllocNode(var->Name(), ctx->allocator); + param->SetVariable(var); + param->SetIgnoreBox(); + param->SetTsType(checker->AsETSChecker()->MaybeBoxedType(param->Variable())); + param->SetParent(newExpr); + newExpr->AddToArgumentsFront(param); + } + } + + return true; +} + +} // namespace ark::es2panda::compiler diff --git a/ets2panda/compiler/lowering/ets/localClassLowering.h b/ets2panda/compiler/lowering/ets/localClassLowering.h new file mode 100644 index 0000000000..297ca7c0ed --- /dev/null +++ b/ets2panda/compiler/lowering/ets/localClassLowering.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2023-2024 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. + */ + +#ifndef ES2PANDA_COMPILER_LOWERING_LOCAL_CLASS_LOWERING_H +#define ES2PANDA_COMPILER_LOWERING_LOCAL_CLASS_LOWERING_H + +#include "compiler/lowering/phase.h" + +namespace ark::es2panda::compiler { + +class LocalClassConstructionPhase : public Phase { +public: + std::string_view Name() const override; + bool Perform(public_lib::Context *ctx, parser::Program *program) override; + +protected: + void ReplaceReferencesFromTheParametersToTheLocalVariavbles( + ir::ClassDefinition *classDef, + const ArenaMap &newLocalVariablesMap, + const ArenaSet &initializers); + + void CreateTemporalLocalVariableForModifiedParameters(public_lib::Context *ctx, ir::ClassDefinition *classDef); + + void CreateClassPropertiesForCapturedVariables(public_lib::Context *ctx, ir::ClassDefinition *classDef, + ArenaMap &variableMap, + ArenaMap &propertyMap); + + void ModifyConstructorParameters(public_lib::Context *ctx, ir::ClassDefinition *classDef, + ArenaMap &variableMap, + ArenaMap ¶meterMap); + + void RemapReferencesFromCapturedVariablesToClassProperties( + ir::ClassDefinition *classDef, ArenaMap &variableMap); +}; + +} // namespace ark::es2panda::compiler + +#endif diff --git a/ets2panda/compiler/lowering/phase.cpp b/ets2panda/compiler/lowering/phase.cpp index 347bb56933..d6f7b0594e 100644 --- a/ets2panda/compiler/lowering/phase.cpp +++ b/ets2panda/compiler/lowering/phase.cpp @@ -26,6 +26,7 @@ #include "compiler/lowering/ets/interfacePropertyDeclarations.h" #include "compiler/lowering/ets/objectIndexAccess.h" #include "compiler/lowering/ets/objectIterator.h" +#include "compiler/lowering/ets/localClassLowering.h" #include "compiler/lowering/ets/opAssignment.h" #include "compiler/lowering/ets/objectLiteralLowering.h" #include "compiler/lowering/ets/optionalLowering.h" @@ -69,6 +70,7 @@ static RecordLowering g_recordLowering; static StructLowering g_structLowering; static DefaultParameterLowering g_defaultParameterLowering; static TopLevelStatements g_topLevelStatements; +static LocalClassConstructionPhase g_localClassLowering; static PluginPhase g_pluginsAfterParse {"plugins-after-parse", ES2PANDA_STATE_PARSED, &util::Plugin::AfterParse}; static PluginPhase g_pluginsAfterCheck {"plugins-after-check", ES2PANDA_STATE_CHECKED, &util::Plugin::AfterCheck}; static PluginPhase g_pluginsAfterLowerings {"plugins-after-lowering", ES2PANDA_STATE_LOWERED, @@ -103,6 +105,7 @@ std::vector GetETSPhaseList() &g_tupleLowering, &g_unionLowering, &g_expandBracketsPhase, + &g_localClassLowering, &g_objectLiteralLowering, &g_pluginsAfterLowerings, }; diff --git a/ets2panda/ir/base/classDefinition.cpp b/ets2panda/ir/base/classDefinition.cpp index 63a0e697e2..ff13e4cb42 100644 --- a/ets2panda/ir/base/classDefinition.cpp +++ b/ets2panda/ir/base/classDefinition.cpp @@ -214,4 +214,7 @@ checker::Type *ClassDefinition::Check(checker::ETSChecker *checker) { return checker->GetAnalyzer()->Check(this); } + +int ClassDefinition::classCounter_ = 0; + } // namespace ark::es2panda::ir diff --git a/ets2panda/ir/base/classDefinition.h b/ets2panda/ir/base/classDefinition.h index c449678822..14e88c6602 100644 --- a/ets2panda/ir/base/classDefinition.h +++ b/ets2panda/ir/base/classDefinition.h @@ -19,6 +19,7 @@ #include "varbinder/scope.h" #include "varbinder/variable.h" #include "ir/astNode.h" +#include "ir/expressions/identifier.h" #include "util/bitset.h" #include "util/language.h" @@ -44,6 +45,7 @@ enum class ClassDefinitionModifiers : uint32_t { CLASS_DECL = 1U << 8U, INNER = 1U << 9U, FROM_EXTERNAL = 1U << 10U, + LOCAL = 1U << 11U, DECLARATION_ID_REQUIRED = DECLARATION | ID_REQUIRED }; @@ -72,7 +74,11 @@ public: superClass_(superClass), body_(std::move(body)), modifiers_(modifiers), - lang_(lang) + lang_(lang), + capturedVars_(body_.get_allocator()), + localVariableIsNeeded_(body_.get_allocator()), + localIndex_(classCounter_++), + localPrefix_("$" + std::to_string(localIndex_)) { } @@ -83,7 +89,11 @@ public: implements_(allocator->Adapter()), body_(std::move(body)), modifiers_(modifiers), - lang_(lang) + lang_(lang), + capturedVars_(allocator->Adapter()), + localVariableIsNeeded_(allocator->Adapter()), + localIndex_(classCounter_++), + localPrefix_("$" + std::to_string(localIndex_)) { } @@ -94,7 +104,12 @@ public: implements_(allocator->Adapter()), body_(allocator->Adapter()), modifiers_(modifiers), - lang_(lang) + lang_(lang), + capturedVars_(allocator->Adapter()), + localVariableIsNeeded_(allocator->Adapter()), + localIndex_(classCounter_++), + localPrefix_("$" + std::to_string(localIndex_)) + { } @@ -163,6 +178,11 @@ public: return (modifiers_ & ClassDefinitionModifiers::GLOBAL) != 0; } + [[nodiscard]] bool IsLocal() const noexcept + { + return (modifiers_ & ClassDefinitionModifiers::LOCAL) != 0; + } + [[nodiscard]] bool IsExtern() const noexcept { return (modifiers_ & ClassDefinitionModifiers::EXTERN) != 0; @@ -266,6 +286,46 @@ public: return superTypeParams_; } + [[nodiscard]] static int LocalTypeCounter() noexcept + { + return classCounter_; + } + + [[nodiscard]] int LocalIndex() const noexcept + { + return localIndex_; + } + + [[nodiscard]] const std::string &LocalPrefix() const noexcept + { + return localPrefix_; + } + + bool CaptureVariable(varbinder::Variable *var) + { + return capturedVars_.insert(var).second; + } + + bool AddToLocalVariableIsNeeded(varbinder::Variable *var) + { + return localVariableIsNeeded_.insert(var).second; + } + + bool IsLocalVariableNeeded(varbinder::Variable *var) const + { + return localVariableIsNeeded_.find(var) != localVariableIsNeeded_.end(); + } + + [[nodiscard]] const ArenaSet &CapturedVariables() const noexcept + { + return capturedVars_; + } + + bool EraseCapturedVariable(varbinder::Variable *var) + { + return capturedVars_.erase(var) != 0; + } + const FunctionExpression *Ctor() const; bool HasPrivateMethod() const; bool HasComputedInstanceField() const; @@ -301,6 +361,11 @@ private: ArenaVector body_; ClassDefinitionModifiers modifiers_; es2panda::Language lang_; + ArenaSet capturedVars_; + ArenaSet localVariableIsNeeded_; + static int classCounter_; + const int localIndex_ {}; + const std::string localPrefix_ {}; }; } // namespace ark::es2panda::ir diff --git a/ets2panda/ir/ets/etsNewClassInstanceExpression.h b/ets2panda/ir/ets/etsNewClassInstanceExpression.h index 2ce17a38e3..8a61de6288 100644 --- a/ets2panda/ir/ets/etsNewClassInstanceExpression.h +++ b/ets2panda/ir/ets/etsNewClassInstanceExpression.h @@ -85,6 +85,11 @@ public: signature_ = signature; } + void AddToArgumentsFront(ir::Expression *expr) + { + arguments_.insert(arguments_.begin(), expr); + } + [[nodiscard]] ETSNewClassInstanceExpression *Clone(ArenaAllocator *allocator, AstNode *parent) override; void TransformChildren(const NodeTransformer &cb) override; diff --git a/ets2panda/parser/ETSparser.cpp b/ets2panda/parser/ETSparser.cpp index e91a181b96..d9e9b6e02d 100644 --- a/ets2panda/parser/ETSparser.cpp +++ b/ets2panda/parser/ETSparser.cpp @@ -510,6 +510,12 @@ std::tuple ETSParser::ParseClassMemberAccessModifiers() UNREACHABLE(); } } + if (((GetContext().Status() & ParserStatus::FUNCTION) != 0) && + (accessFlag == ir::ModifierFlags::PUBLIC || accessFlag == ir::ModifierFlags::PRIVATE || + accessFlag == ir::ModifierFlags::PROTECTED)) { + ThrowSyntaxError("Local class declaration members can not have access modifies", + Lexer()->GetToken().Start()); + } Lexer()->NextToken(lexer::NextTokenFlags::KEYWORD_TO_IDENT); return {accessFlag, true}; @@ -1267,10 +1273,6 @@ ir::TSInterfaceDeclaration *ETSParser::ParseInterfaceBody(ir::Identifier *name, ir::Statement *ETSParser::ParseInterfaceDeclaration(bool isStatic) { - if ((GetContext().Status() & parser::ParserStatus::FUNCTION) != 0U) { - ThrowSyntaxError("Local interface declaration support is not yet implemented."); - } - lexer::SourcePosition interfaceStart = Lexer()->GetToken().Start(); Lexer()->NextToken(); // eat interface keyword @@ -1368,7 +1370,9 @@ ir::ClassDefinition *ETSParser::ParseClassDefinition(ir::ClassDefinitionModifier static bool IsInterfaceMethodModifier(lexer::TokenType type) { - return type == lexer::TokenType::KEYW_STATIC || type == lexer::TokenType::KEYW_PRIVATE; + // NOTE (psiket) Rewrite this + return type == lexer::TokenType::KEYW_STATIC || type == lexer::TokenType::KEYW_PRIVATE || + type == lexer::TokenType::KEYW_PROTECTED || type == lexer::TokenType::KEYW_PUBLIC; } ir::ModifierFlags ETSParser::ParseInterfaceMethodModifiers() @@ -1378,6 +1382,17 @@ ir::ModifierFlags ETSParser::ParseInterfaceMethodModifiers() while (IsInterfaceMethodModifier(Lexer()->GetToken().Type())) { ir::ModifierFlags currentFlag = ir::ModifierFlags::NONE; + if ((GetContext().Status() & ParserStatus::FUNCTION) != 0) { + if (Lexer()->GetToken().Type() == lexer::TokenType::KEYW_PUBLIC || + Lexer()->GetToken().Type() == lexer::TokenType::KEYW_PROTECTED || + Lexer()->GetToken().Type() == lexer::TokenType::KEYW_PRIVATE) { + ThrowSyntaxError("Local interface declaration members can not have access modifies", + Lexer()->GetToken().Start()); + } + } else if (Lexer()->GetToken().Type() == lexer::TokenType::KEYW_PUBLIC || + Lexer()->GetToken().Type() == lexer::TokenType::KEYW_PROTECTED) { + break; + } switch (Lexer()->GetToken().Type()) { case lexer::TokenType::KEYW_STATIC: { currentFlag = ir::ModifierFlags::STATIC; @@ -3788,7 +3803,9 @@ ir::ClassDeclaration *ETSParser::ParseClassStatement([[maybe_unused]] StatementP [[maybe_unused]] ir::ClassDefinitionModifiers modifiers, [[maybe_unused]] ir::ModifierFlags modFlags) { - ThrowSyntaxError("Illegal start of expression", Lexer()->GetToken().Start()); + return ParseClassDeclaration(modifiers | ir::ClassDefinitionModifiers::ID_REQUIRED | + ir::ClassDefinitionModifiers::CLASS_DECL | ir::ClassDefinitionModifiers::LOCAL, + modFlags); } // NOLINTNEXTLINE(google-default-arguments) diff --git a/ets2panda/parser/statementParser.cpp b/ets2panda/parser/statementParser.cpp index 34c53cd0af..5f652a1f39 100644 --- a/ets2panda/parser/statementParser.cpp +++ b/ets2panda/parser/statementParser.cpp @@ -619,6 +619,18 @@ ir::Statement *ParserImpl::ParseExpressionStatement(StatementParsingFlags flags) const auto startPos = lexer_->Save(); ParserStatus savedStatus = context_.Status(); + auto tokenType = lexer_->GetToken().Type(); + if (tokenType == lexer::TokenType::KEYW_PUBLIC || tokenType == lexer::TokenType::KEYW_PRIVATE || + tokenType == lexer::TokenType::KEYW_PROTECTED) { + lexer_->NextToken(); + if (lexer_->GetToken().Type() == lexer::TokenType::KEYW_CLASS || + lexer_->GetToken().Type() == lexer::TokenType::KEYW_INTERFACE) { + ThrowSyntaxError("A local class or interface declaration can not have access modifier", + startPos.GetToken().Start()); + } + lexer_->Rewind(startPos); + } + if (lexer_->GetToken().IsAsyncModifier()) { lexer_->NextToken(); diff --git a/ets2panda/test/compiler/ets/identifierReference1-expected.txt b/ets2panda/test/compiler/ets/identifierReference1-expected.txt index 5a98acf91b..df7fd437f9 100644 --- a/ets2panda/test/compiler/ets/identifierReference1-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference1-expected.txt @@ -1,1966 +1 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "B", - "decorators": [], - "loc": { - "start": { - "line": 9, - "column": 12 - }, - "end": { - "line": 9, - "column": 13 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "b", - "decorators": [], - "loc": { - "start": { - "line": 10, - "column": 3 - }, - "end": { - "line": 10, - "column": 4 - } - } - }, - "value": { - "type": "NumberLiteral", - "value": 2, - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 13 - } - } - }, - "accessibility": "public", - "static": false, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "c", - "decorators": [], - "loc": { - "start": { - "line": 11, - "column": 10 - }, - "end": { - "line": 11, - "column": 11 - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [ - { - "type": "Identifier", - "name": "a", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 11, - "column": 17 - }, - "end": { - "line": 11, - "column": 20 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 11, - "column": 14 - }, - "end": { - "line": 11, - "column": 20 - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 11, - "column": 25 - }, - "end": { - "line": 11, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 11, - "column": 13 - }, - "end": { - "line": 11, - "column": 29 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 12, - "column": 3 - }, - "end": { - "line": 12, - "column": 6 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 12, - "column": 3 - }, - "end": { - "line": 12, - "column": 6 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "Identifier", - "name": "a", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 12, - "column": 10 - }, - "end": { - "line": 12, - "column": 13 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 12, - "column": 7 - }, - "end": { - "line": 12, - "column": 13 - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 12, - "column": 16 - }, - "end": { - "line": 12, - "column": 20 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 12, - "column": 21 - }, - "end": { - "line": 14, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 14, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 14, - "column": 4 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 12, - "column": 3 - }, - "end": { - "line": 14, - "column": 4 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 15, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 15, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 15, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "A", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 7 - }, - "end": { - "line": 17, - "column": 8 - } - } - }, - "superClass": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "B", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 17 - }, - "end": { - "line": 17, - "column": 18 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 17 - }, - "end": { - "line": 17, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 17 - }, - "end": { - "line": 17, - "column": 20 - } - } - }, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 3 - }, - "end": { - "line": 18, - "column": 6 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 3 - }, - "end": { - "line": 18, - "column": 6 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "Identifier", - "name": "a", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 10 - }, - "end": { - "line": 18, - "column": 13 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 7 - }, - "end": { - "line": 18, - "column": 13 - } - } - }, - { - "type": "Identifier", - "name": "b", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 21 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 15 - }, - "end": { - "line": 18, - "column": 21 - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 18, - "column": 24 - }, - "end": { - "line": 18, - "column": 28 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "b", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 5 - }, - "end": { - "line": 19, - "column": 6 - } - } - }, - "right": { - "type": "NumberLiteral", - "value": 3, - "loc": { - "start": { - "line": 19, - "column": 9 - }, - "end": { - "line": 19, - "column": 10 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 5 - }, - "end": { - "line": 19, - "column": 10 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 5 - }, - "end": { - "line": 19, - "column": 11 - } - } - } - ], - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 20, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 6 - }, - "end": { - "line": 20, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 6 - }, - "end": { - "line": 20, - "column": 4 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 3 - }, - "end": { - "line": 20, - "column": 4 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 10 - }, - "end": { - "line": 22, - "column": 13 - } - } - }, - "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": 22, - "column": 10 - }, - "end": { - "line": 22, - "column": 13 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 22, - "column": 17 - }, - "end": { - "line": 22, - "column": 21 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "A", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 5 - }, - "end": { - "line": 23, - "column": 6 - } - } - }, - "property": { - "type": "Identifier", - "name": "c", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 7 - }, - "end": { - "line": 23, - "column": 8 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 23, - "column": 5 - }, - "end": { - "line": 23, - "column": 8 - } - } - }, - "right": { - "type": "Identifier", - "name": "bar", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 11 - }, - "end": { - "line": 23, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 5 - }, - "end": { - "line": 23, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 5 - }, - "end": { - "line": 23, - "column": 15 - } - } - } - ], - "loc": { - "start": { - "line": 22, - "column": 22 - }, - "end": { - "line": 24, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 13 - }, - "end": { - "line": 24, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 13 - }, - "end": { - "line": 24, - "column": 4 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 3 - }, - "end": { - "line": 24, - "column": 4 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "baz", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 6 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "baz", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 6 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 26, - "column": 10 - }, - "end": { - "line": 26, - "column": 14 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "ThisExpression", - "loc": { - "start": { - "line": 27, - "column": 5 - }, - "end": { - "line": 27, - "column": 9 - } - } - }, - "property": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 10 - }, - "end": { - "line": 27, - "column": 13 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 27, - "column": 5 - }, - "end": { - "line": 27, - "column": 13 - } - } - }, - "arguments": [ - { - "type": "NumberLiteral", - "value": 1, - "loc": { - "start": { - "line": 27, - "column": 14 - }, - "end": { - "line": 27, - "column": 15 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 27, - "column": 5 - }, - "end": { - "line": 27, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 5 - }, - "end": { - "line": 27, - "column": 17 - } - } - } - ], - "loc": { - "start": { - "line": 26, - "column": 15 - }, - "end": { - "line": 28, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 6 - }, - "end": { - "line": 28, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 6 - }, - "end": { - "line": 28, - "column": 4 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 28, - "column": 4 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "C", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 9 - }, - "end": { - "line": 30, - "column": 10 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 5 - }, - "end": { - "line": 31, - "column": 8 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 5 - }, - "end": { - "line": 31, - "column": 8 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 31, - "column": 12 - }, - "end": { - "line": 31, - "column": 16 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "MemberExpression", - "object": { - "type": "ThisExpression", - "loc": { - "start": { - "line": 32, - "column": 7 - }, - "end": { - "line": 32, - "column": 11 - } - } - }, - "property": { - "type": "Identifier", - "name": "b", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 12 - }, - "end": { - "line": 32, - "column": 13 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 32, - "column": 7 - }, - "end": { - "line": 32, - "column": 13 - } - } - }, - "right": { - "type": "NumberLiteral", - "value": 4, - "loc": { - "start": { - "line": 32, - "column": 16 - }, - "end": { - "line": 32, - "column": 17 - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 7 - }, - "end": { - "line": 32, - "column": 17 - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 7 - }, - "end": { - "line": 32, - "column": 18 - } - } - } - ], - "loc": { - "start": { - "line": 31, - "column": 17 - }, - "end": { - "line": 33, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 8 - }, - "end": { - "line": 33, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 8 - }, - "end": { - "line": 33, - "column": 6 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 5 - }, - "end": { - "line": 33, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 34, - "column": 4 - }, - "end": { - "line": 34, - "column": 4 - } - } - } - ], - "loc": { - "start": { - "line": 30, - "column": 11 - }, - "end": { - "line": 34, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 3 - }, - "end": { - "line": 34, - "column": 4 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 35, - "column": 2 - }, - "end": { - "line": 35, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 35, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 1 - }, - "end": { - "line": 35, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "value": { - "type": "Identifier", - "name": "max", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSFunctionType", - "params": [ - { - "type": "Identifier", - "name": "a", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "name": "b", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "b", - "decorators": [], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - "value": { - "type": "StringLiteral", - "value": "foo", - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "String", - "decorators": [], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "bar", - "decorators": [], - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "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": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "Identifier", - "name": "a", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 21 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 21 - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 28 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 5, - "column": 29 - }, - "end": { - "line": 7, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 7, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 7, - "column": 2 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 7, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 36, - "column": 1 - } - } -} -TypeError: Property 'b' does not exist on type 'C' [identifierReference1.ets:32:12] +SyntaxError: Local type declaration (class, struct, interface and enum) support is not yet implemented. [identifierReference1.ets:45:3] diff --git a/ets2panda/test/compiler/ets/identifierReference15-expected.txt b/ets2panda/test/compiler/ets/identifierReference15-expected.txt index 888dd8d8b5..f90eb8dfdd 100644 --- a/ets2panda/test/compiler/ets/identifierReference15-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference15-expected.txt @@ -1,892 +1 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "A", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "Identifier", - "name": "a", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 13 - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - "overloads": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 14 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 6, - "column": 15 - }, - "end": { - "line": 8, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 8, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 8, - "column": 4 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 8, - "column": 4 - } - } - } - ], - "decorators": [], - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "B", - "decorators": [], - "loc": { - "start": { - "line": 10, - "column": 9 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 11, - "column": 5 - }, - "end": { - "line": 11, - "column": 8 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 11, - "column": 5 - }, - "end": { - "line": 11, - "column": 8 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "Identifier", - "name": "a", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 11, - "column": 12 - }, - "end": { - "line": 11, - "column": 15 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 11, - "column": 9 - }, - "end": { - "line": 11, - "column": 15 - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 11, - "column": 18 - }, - "end": { - "line": 11, - "column": 22 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 11, - "column": 23 - }, - "end": { - "line": 13, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 13, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 13, - "column": 6 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 11, - "column": 5 - }, - "end": { - "line": 13, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "baz", - "decorators": [], - "loc": { - "start": { - "line": 15, - "column": 5 - }, - "end": { - "line": 15, - "column": 8 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "baz", - "decorators": [], - "loc": { - "start": { - "line": 15, - "column": 5 - }, - "end": { - "line": 15, - "column": 8 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 15, - "column": 12 - }, - "end": { - "line": 15, - "column": 16 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "ThisExpression", - "loc": { - "start": { - "line": 16, - "column": 7 - }, - "end": { - "line": 16, - "column": 11 - } - } - }, - "property": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 12 - }, - "end": { - "line": 16, - "column": 15 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 16, - "column": 7 - }, - "end": { - "line": 16, - "column": 15 - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 16, - "column": 7 - }, - "end": { - "line": 16, - "column": 17 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 7 - }, - "end": { - "line": 16, - "column": 18 - } - } - } - ], - "loc": { - "start": { - "line": 15, - "column": 17 - }, - "end": { - "line": 17, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 15, - "column": 8 - }, - "end": { - "line": 17, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 15, - "column": 8 - }, - "end": { - "line": 17, - "column": 6 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 15, - "column": 5 - }, - "end": { - "line": 17, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 4 - } - } - } - ], - "loc": { - "start": { - "line": 10, - "column": 11 - }, - "end": { - "line": 18, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 10, - "column": 3 - }, - "end": { - "line": 18, - "column": 4 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 2 - }, - "end": { - "line": 19, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "body": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 20, - "column": 1 - } - } -} -TypeError: No matching call signature [identifierReference15.ets:16:7] +SyntaxError: Local type declaration (class, struct, interface and enum) support is not yet implemented. [identifierReference15.ets:25:3] diff --git a/ets2panda/test/compiler/ets/identifierReference16-expected.txt b/ets2panda/test/compiler/ets/identifierReference16-expected.txt index a94ef69ecf..292343f60c 100644 --- a/ets2panda/test/compiler/ets/identifierReference16-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference16-expected.txt @@ -1,1396 +1 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "B", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "Identifier", - "name": "a", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 13 - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 5, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 5, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "C", - "decorators": [], - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 13 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 9, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 9, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "A", - "decorators": [], - "loc": { - "start": { - "line": 11, - "column": 7 - }, - "end": { - "line": 11, - "column": 8 - } - } - }, - "superClass": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "B", - "decorators": [], - "loc": { - "start": { - "line": 11, - "column": 17 - }, - "end": { - "line": 11, - "column": 18 - } - } - }, - "loc": { - "start": { - "line": 11, - "column": 17 - }, - "end": { - "line": 11, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 11, - "column": 17 - }, - "end": { - "line": 11, - "column": 20 - } - } - }, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 12, - "column": 3 - }, - "end": { - "line": 12, - "column": 6 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 12, - "column": 3 - }, - "end": { - "line": 12, - "column": 6 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "Identifier", - "name": "a", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 12, - "column": 10 - }, - "end": { - "line": 12, - "column": 13 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 12, - "column": 7 - }, - "end": { - "line": 12, - "column": 13 - } - } - }, - { - "type": "Identifier", - "name": "b", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 12, - "column": 18 - }, - "end": { - "line": 12, - "column": 21 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 12, - "column": 15 - }, - "end": { - "line": 12, - "column": 21 - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 28 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 12, - "column": 29 - }, - "end": { - "line": 14, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 14, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 14, - "column": 4 - } - } - }, - "overloads": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 3 - }, - "end": { - "line": 16, - "column": 6 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 3 - }, - "end": { - "line": 16, - "column": 6 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 10 - }, - "end": { - "line": 16, - "column": 14 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 16, - "column": 15 - }, - "end": { - "line": 18, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 6 - }, - "end": { - "line": 18, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 6 - }, - "end": { - "line": 18, - "column": 4 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 3 - }, - "end": { - "line": 18, - "column": 4 - } - } - } - ], - "decorators": [], - "loc": { - "start": { - "line": 12, - "column": 3 - }, - "end": { - "line": 14, - "column": 4 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "D", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 9 - }, - "end": { - "line": 20, - "column": 10 - } - } - }, - "superClass": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "C", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 19 - }, - "end": { - "line": 20, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 19 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 19 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 5 - }, - "end": { - "line": 21, - "column": 8 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 5 - }, - "end": { - "line": 21, - "column": 8 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 21, - "column": 12 - }, - "end": { - "line": 21, - "column": 16 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 21, - "column": 17 - }, - "end": { - "line": 23, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 8 - }, - "end": { - "line": 23, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 8 - }, - "end": { - "line": 23, - "column": 6 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 5 - }, - "end": { - "line": 23, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "baz", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 5 - }, - "end": { - "line": 25, - "column": 8 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "baz", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 5 - }, - "end": { - "line": 25, - "column": 8 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 25, - "column": 12 - }, - "end": { - "line": 25, - "column": 16 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "ThisExpression", - "loc": { - "start": { - "line": 26, - "column": 7 - }, - "end": { - "line": 26, - "column": 11 - } - } - }, - "property": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 12 - }, - "end": { - "line": 26, - "column": 15 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 26, - "column": 7 - }, - "end": { - "line": 26, - "column": 15 - } - } - }, - "arguments": [ - { - "type": "NumberLiteral", - "value": 1, - "loc": { - "start": { - "line": 26, - "column": 16 - }, - "end": { - "line": 26, - "column": 17 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 26, - "column": 7 - }, - "end": { - "line": 26, - "column": 18 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 7 - }, - "end": { - "line": 26, - "column": 19 - } - } - } - ], - "loc": { - "start": { - "line": 25, - "column": 17 - }, - "end": { - "line": 27, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 27, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 27, - "column": 6 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 5 - }, - "end": { - "line": 27, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 4 - }, - "end": { - "line": 28, - "column": 4 - } - } - } - ], - "loc": { - "start": { - "line": 20, - "column": 21 - }, - "end": { - "line": 28, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 3 - }, - "end": { - "line": 28, - "column": 4 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 11, - "column": 19 - }, - "end": { - "line": 29, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 11, - "column": 1 - }, - "end": { - "line": 29, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "body": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 30, - "column": 1 - } - } -} -TypeError: No matching call signature [identifierReference16.ets:26:7] +SyntaxError: Local type declaration (class, struct, interface and enum) support is not yet implemented. [identifierReference16.ets:35:3] diff --git a/ets2panda/test/compiler/ets/identifierReference6-expected.txt b/ets2panda/test/compiler/ets/identifierReference6-expected.txt index f2cea78672..f1e23a8849 100644 --- a/ets2panda/test/compiler/ets/identifierReference6-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference6-expected.txt @@ -1,575 +1 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "A", - "decorators": [], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 4 - } - } - }, - "value": { - "type": "NumberLiteral", - "value": 2, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - "accessibility": "public", - "static": false, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "B", - "decorators": [], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 17 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "++", - "prefix": false, - "argument": { - "type": "MemberExpression", - "object": { - "type": "ThisExpression", - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 11 - } - } - }, - "property": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 13 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 13 - } - } - }, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 15 - } - } - }, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 16 - } - } - } - ], - "loc": { - "start": { - "line": 6, - "column": 17 - }, - "end": { - "line": 8, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 8, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 8, - "column": 6 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 8, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 4 - } - } - } - ], - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 9, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 9, - "column": 4 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 10, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 10, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "body": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 11, - "column": 1 - } - } -} -TypeError: 'this' cannot be referenced from a static context [identifierReference6.ets:7:7] +SyntaxError: Local type declaration (class, struct, interface and enum) support is not yet implemented. [identifierReference6.ets:19:10] diff --git a/ets2panda/test/compiler/ets/identifierReference7-expected.txt b/ets2panda/test/compiler/ets/identifierReference7-expected.txt index 5ff90818b1..c1c52eb11f 100644 --- a/ets2panda/test/compiler/ets/identifierReference7-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference7-expected.txt @@ -1,829 +1 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "C", - "decorators": [], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 4 - } - } - }, - "accessibility": "public", - "static": false, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Object", - "decorators": [], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 12 - } - } - }, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 4, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 4, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "A", - "decorators": [], - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 7, - "column": 3 - }, - "end": { - "line": 7, - "column": 4 - } - } - }, - "value": { - "type": "NumberLiteral", - "value": 2, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 13 - } - } - }, - "accessibility": "public", - "static": false, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 9 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "B", - "decorators": [], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 10 - } - } - }, - "superClass": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "C", - "decorators": [], - "loc": { - "start": { - "line": 9, - "column": 19 - }, - "end": { - "line": 9, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 9, - "column": 19 - }, - "end": { - "line": 9, - "column": 22 - } - } - }, - "loc": { - "start": { - "line": 9, - "column": 19 - }, - "end": { - "line": 9, - "column": 22 - } - } - }, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 10, - "column": 5 - }, - "end": { - "line": 10, - "column": 8 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 10, - "column": 5 - }, - "end": { - "line": 10, - "column": 8 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 16 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "++", - "prefix": false, - "argument": { - "type": "MemberExpression", - "object": { - "type": "ThisExpression", - "loc": { - "start": { - "line": 11, - "column": 7 - }, - "end": { - "line": 11, - "column": 11 - } - } - }, - "property": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 11, - "column": 12 - }, - "end": { - "line": 11, - "column": 13 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 11, - "column": 7 - }, - "end": { - "line": 11, - "column": 13 - } - } - }, - "loc": { - "start": { - "line": 11, - "column": 7 - }, - "end": { - "line": 11, - "column": 15 - } - } - }, - "loc": { - "start": { - "line": 11, - "column": 7 - }, - "end": { - "line": 11, - "column": 16 - } - } - } - ], - "loc": { - "start": { - "line": 10, - "column": 17 - }, - "end": { - "line": 12, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 10, - "column": 8 - }, - "end": { - "line": 12, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 10, - "column": 8 - }, - "end": { - "line": 12, - "column": 6 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 10, - "column": 5 - }, - "end": { - "line": 12, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 13, - "column": 4 - }, - "end": { - "line": 13, - "column": 4 - } - } - } - ], - "loc": { - "start": { - "line": 9, - "column": 21 - }, - "end": { - "line": 13, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 9, - "column": 3 - }, - "end": { - "line": 13, - "column": 4 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 14, - "column": 2 - }, - "end": { - "line": 14, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 14, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 14, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "body": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 15, - "column": 1 - } - } -} -TypeError: Bad operand type, the type of the operand must be numeric type. [identifierReference7.ets:11:7] +SyntaxError: Local type declaration (class, struct, interface and enum) support is not yet implemented. [identifierReference7.ets:23:3] diff --git a/ets2panda/test/compiler/ets/invalidInheritance2-expected.txt b/ets2panda/test/compiler/ets/invalidInheritance2-expected.txt index cd295e75f1..de48ad4ea2 100644 --- a/ets2panda/test/compiler/ets/invalidInheritance2-expected.txt +++ b/ets2panda/test/compiler/ets/invalidInheritance2-expected.txt @@ -1,750 +1 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "A", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "value": { - "type": "NumberLiteral", - "value": 1, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "accessibility": "public", - "static": false, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "B", - "decorators": [], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "superClass": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "A", - "decorators": [], - "loc": { - "start": { - "line": 5, - "column": 22 - }, - "end": { - "line": 5, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 5, - "column": 22 - }, - "end": { - "line": 5, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 5, - "column": 22 - }, - "end": { - "line": 5, - "column": 25 - } - } - }, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "C", - "decorators": [], - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 8 - } - } - }, - "superClass": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "B", - "decorators": [], - "loc": { - "start": { - "line": 8, - "column": 17 - }, - "end": { - "line": 8, - "column": 18 - } - } - }, - "loc": { - "start": { - "line": 8, - "column": 17 - }, - "end": { - "line": 8, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 8, - "column": 17 - }, - "end": { - "line": 8, - "column": 20 - } - } - }, - "implements": [], - "body": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 9, - "column": 11 - }, - "end": { - "line": 9, - "column": 12 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 11, - "column": 6 - }, - "end": { - "line": 11, - "column": 6 - } - } - } - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 11, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 9, - "column": 5 - }, - "end": { - "line": 11, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 8, - "column": 19 - }, - "end": { - "line": 12, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 12, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "body": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 13, - "column": 1 - } - } -} -TypeError: Cannot inherit from class B, because class a is inherited with a different declaration type [invalidInheritance2.ets:8:17] +SyntaxError: Local type declaration (class, struct, interface and enum) support is not yet implemented. [invalidInheritance2.ets:24:5] diff --git a/ets2panda/test/compiler/ets/invalidPrivateAccess5-expected.txt b/ets2panda/test/compiler/ets/invalidPrivateAccess5-expected.txt index 545b5159fd..93ceff48c7 100644 --- a/ets2panda/test/compiler/ets/invalidPrivateAccess5-expected.txt +++ b/ets2panda/test/compiler/ets/invalidPrivateAccess5-expected.txt @@ -1,1009 +1 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "Outer", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "Base", - "decorators": [], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 18 - } - } - }, - "kind": "method", - "accessibility": "private", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 18 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 26 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 3, - "column": 27 - }, - "end": { - "line": 3, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 29 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 29 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 6 - } - } - } - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "Derived", - "decorators": [], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 18 - } - } - }, - "superClass": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Base", - "decorators": [], - "loc": { - "start": { - "line": 6, - "column": 27 - }, - "end": { - "line": 6, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 6, - "column": 27 - }, - "end": { - "line": 6, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 6, - "column": 27 - }, - "end": { - "line": 6, - "column": 33 - } - } - }, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 12 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 12 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 7, - "column": 16 - }, - "end": { - "line": 7, - "column": 20 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "base", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Base", - "decorators": [], - "loc": { - "start": { - "line": 8, - "column": 23 - }, - "end": { - "line": 8, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 8, - "column": 23 - }, - "end": { - "line": 8, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 8, - "column": 23 - }, - "end": { - "line": 8, - "column": 29 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 8, - "column": 17 - }, - "end": { - "line": 8, - "column": 21 - } - } - }, - "init": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Base", - "decorators": [], - "loc": { - "start": { - "line": 8, - "column": 34 - }, - "end": { - "line": 8, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 8, - "column": 34 - }, - "end": { - "line": 8, - "column": 39 - } - } - }, - "loc": { - "start": { - "line": 8, - "column": 34 - }, - "end": { - "line": 8, - "column": 39 - } - } - }, - "arguments": [], - "loc": { - "start": { - "line": 8, - "column": 30 - }, - "end": { - "line": 8, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 8, - "column": 17 - }, - "end": { - "line": 8, - "column": 41 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 8, - "column": 41 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "base", - "decorators": [], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 17 - } - } - }, - "property": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 19 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 19 - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 22 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "ThisExpression", - "loc": { - "start": { - "line": 10, - "column": 13 - }, - "end": { - "line": 10, - "column": 17 - } - } - }, - "property": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 10, - "column": 18 - }, - "end": { - "line": 10, - "column": 19 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 10, - "column": 13 - }, - "end": { - "line": 10, - "column": 19 - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 10, - "column": 13 - }, - "end": { - "line": 10, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 10, - "column": 13 - }, - "end": { - "line": 10, - "column": 22 - } - } - } - ], - "loc": { - "start": { - "line": 7, - "column": 21 - }, - "end": { - "line": 11, - "column": 10 - } - } - }, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 11, - "column": 10 - } - } - }, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 11, - "column": 10 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 11, - "column": 10 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 6 - } - } - } - ], - "loc": { - "start": { - "line": 6, - "column": 32 - }, - "end": { - "line": 12, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 12, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 13, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 13, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "body": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 14, - "column": 1 - } - } -} -TypeError: Signature a(): void is not visible here. [invalidPrivateAccess5.ets:10:13] +SyntaxError: Local type declaration (class, struct, interface and enum) support is not yet implemented. [invalidPrivateAccess5.ets:17:5] diff --git a/ets2panda/test/compiler/ets/invalidPrivateAccess6-expected.txt b/ets2panda/test/compiler/ets/invalidPrivateAccess6-expected.txt index 7fa94c600b..d70beb714c 100644 --- a/ets2panda/test/compiler/ets/invalidPrivateAccess6-expected.txt +++ b/ets2panda/test/compiler/ets/invalidPrivateAccess6-expected.txt @@ -1,1538 +1 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "Outer", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "A", - "decorators": [], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 18 - } - } - }, - "value": { - "type": "NumberLiteral", - "value": 12, - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - "accessibility": "private", - "static": false, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 6 - } - } - } - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "B", - "decorators": [], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 12 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 12 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 12 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 7, - "column": 16 - }, - "end": { - "line": 7, - "column": 20 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "a", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "A", - "decorators": [], - "loc": { - "start": { - "line": 8, - "column": 20 - }, - "end": { - "line": 8, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 8, - "column": 20 - }, - "end": { - "line": 8, - "column": 23 - } - } - }, - "loc": { - "start": { - "line": 8, - "column": 20 - }, - "end": { - "line": 8, - "column": 23 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 8, - "column": 17 - }, - "end": { - "line": 8, - "column": 18 - } - } - }, - "init": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "A", - "decorators": [], - "loc": { - "start": { - "line": 8, - "column": 28 - }, - "end": { - "line": 8, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 8, - "column": 28 - }, - "end": { - "line": 8, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 8, - "column": 28 - }, - "end": { - "line": 8, - "column": 30 - } - } - }, - "arguments": [], - "loc": { - "start": { - "line": 8, - "column": 24 - }, - "end": { - "line": 8, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 8, - "column": 17 - }, - "end": { - "line": 8, - "column": 32 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 8, - "column": 32 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 14 - } - } - }, - "property": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 9, - "column": 15 - }, - "end": { - "line": 9, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 16 - } - } - }, - "right": { - "type": "NumberLiteral", - "value": 13, - "loc": { - "start": { - "line": 9, - "column": 19 - }, - "end": { - "line": 9, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 22 - } - } - } - ], - "loc": { - "start": { - "line": 7, - "column": 21 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 11, - "column": 6 - }, - "end": { - "line": 11, - "column": 6 - } - } - } - ], - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 11, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 11, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 12, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 12, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "C", - "decorators": [], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 8 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "c", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 13 - }, - "end": { - "line": 16, - "column": 14 - } - } - }, - "value": { - "type": "NumberLiteral", - "value": 12, - "loc": { - "start": { - "line": 16, - "column": 22 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, - "accessibility": "private", - "static": false, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 16, - "column": 16 - }, - "end": { - "line": 16, - "column": 19 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 2 - }, - "end": { - "line": 17, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 15, - "column": 9 - }, - "end": { - "line": 17, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 15, - "column": 1 - }, - "end": { - "line": 17, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "D", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 7 - }, - "end": { - "line": 19, - "column": 8 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 5 - }, - "end": { - "line": 20, - "column": 8 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 5 - }, - "end": { - "line": 20, - "column": 8 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 20, - "column": 12 - }, - "end": { - "line": 20, - "column": 16 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "c", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "C", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 16 - }, - "end": { - "line": 21, - "column": 17 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 16 - }, - "end": { - "line": 21, - "column": 19 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 16 - }, - "end": { - "line": 21, - "column": 19 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 13 - }, - "end": { - "line": 21, - "column": 14 - } - } - }, - "init": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "C", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 26 - } - } - }, - "arguments": [], - "loc": { - "start": { - "line": 21, - "column": 20 - }, - "end": { - "line": 21, - "column": 28 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 13 - }, - "end": { - "line": 21, - "column": 28 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 21, - "column": 9 - }, - "end": { - "line": 21, - "column": 28 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "c", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 10 - } - } - }, - "property": { - "type": "Identifier", - "name": "c", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 11 - }, - "end": { - "line": 22, - "column": 12 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 12 - } - } - }, - "right": { - "type": "NumberLiteral", - "value": 13, - "loc": { - "start": { - "line": 22, - "column": 15 - }, - "end": { - "line": 22, - "column": 17 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 17 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 18 - } - } - } - ], - "loc": { - "start": { - "line": 20, - "column": 17 - }, - "end": { - "line": 23, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 8 - }, - "end": { - "line": 23, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 8 - }, - "end": { - "line": 23, - "column": 6 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 5 - }, - "end": { - "line": 23, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 2 - }, - "end": { - "line": 24, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 19, - "column": 9 - }, - "end": { - "line": 24, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 1 - }, - "end": { - "line": 24, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "body": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 25, - "column": 1 - } - } -} -TypeError: Property c is not visible here. [invalidPrivateAccess6.ets:22:11] +SyntaxError: Local type declaration (class, struct, interface and enum) support is not yet implemented. [invalidPrivateAccess6.ets:17:5] diff --git a/ets2panda/test/compiler/ets/override13-expected.txt b/ets2panda/test/compiler/ets/override13-expected.txt index 6d19ccb713..36b7fc2bb3 100644 --- a/ets2panda/test/compiler/ets/override13-expected.txt +++ b/ets2panda/test/compiler/ets/override13-expected.txt @@ -1618,4 +1618,4 @@ } } } -TypeError: fn2(t: Object): String in B cannot override fn2(t: T): T in A because overriding return type is not compatible with the other return type. [override13.ets:25:15] +TypeError: Cannot access property of non-object or non-enum type [override13.ets:25:52] diff --git a/ets2panda/test/compiler/ets/staticInitializerInInnerClass-expected.txt b/ets2panda/test/compiler/ets/staticInitializerInInnerClass-expected.txt index 5834ed9c38..f5c2bf1123 100644 --- a/ets2panda/test/compiler/ets/staticInitializerInInnerClass-expected.txt +++ b/ets2panda/test/compiler/ets/staticInitializerInInnerClass-expected.txt @@ -1,686 +1 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "Outer", - "decorators": [], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "Inner", - "decorators": [], - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassStaticBlock", - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": true, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 10 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 6 - } - } - } - ], - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 7, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 7, - "column": 6 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "Inner2", - "decorators": [], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 24 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassStaticBlock", - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": true, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 12, - "column": 9 - }, - "end": { - "line": 12, - "column": 10 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 6 - } - } - } - ], - "loc": { - "start": { - "line": 9, - "column": 25 - }, - "end": { - "line": 13, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 9, - "column": 12 - }, - "end": { - "line": 13, - "column": 6 - } - } - }, - { - "type": "ClassStaticBlock", - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": true, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 5 - }, - "end": { - "line": 17, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 2 - }, - "end": { - "line": 18, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 18, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 18, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "body": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 19, - "column": 1 - } - } -} -TypeError: Static initializer is not allowed in inner class. [staticInitializerInInnerClass.ets:6:9] +SyntaxError: Local type declaration (class, struct, interface and enum) support is not yet implemented. [staticInitializerInInnerClass.ets:17:5] diff --git a/ets2panda/test/parser/ets/StringFasta-expected.txt b/ets2panda/test/parser/ets/StringFasta-expected.txt index da90de55e7..0c8c91c32c 100644 --- a/ets2panda/test/parser/ets/StringFasta-expected.txt +++ b/ets2panda/test/parser/ets/StringFasta-expected.txt @@ -1,9690 +1 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "StringFasta", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 19 - }, - "end": { - "line": 16, - "column": 30 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "ALU", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, - "value": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "StringLiteral", - "value": "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG", - "loc": { - "start": { - "line": 17, - "column": 36 - }, - "end": { - "line": 17, - "column": 80 - } - } - }, - "right": { - "type": "StringLiteral", - "value": "GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA", - "loc": { - "start": { - "line": 17, - "column": 83 - }, - "end": { - "line": 17, - "column": 127 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 36 - }, - "end": { - "line": 17, - "column": 127 - } - } - }, - "right": { - "type": "StringLiteral", - "value": "CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT", - "loc": { - "start": { - "line": 17, - "column": 130 - }, - "end": { - "line": 17, - "column": 174 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 36 - }, - "end": { - "line": 17, - "column": 174 - } - } - }, - "right": { - "type": "StringLiteral", - "value": "ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA", - "loc": { - "start": { - "line": 17, - "column": 177 - }, - "end": { - "line": 17, - "column": 221 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 36 - }, - "end": { - "line": 17, - "column": 221 - } - } - }, - "right": { - "type": "StringLiteral", - "value": "GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG", - "loc": { - "start": { - "line": 17, - "column": 224 - }, - "end": { - "line": 17, - "column": 268 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 36 - }, - "end": { - "line": 17, - "column": 268 - } - } - }, - "right": { - "type": "StringLiteral", - "value": "AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC", - "loc": { - "start": { - "line": 17, - "column": 271 - }, - "end": { - "line": 17, - "column": 315 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 36 - }, - "end": { - "line": 17, - "column": 315 - } - } - }, - "right": { - "type": "StringLiteral", - "value": "AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA", - "loc": { - "start": { - "line": 17, - "column": 318 - }, - "end": { - "line": 17, - "column": 355 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 36 - }, - "end": { - "line": 17, - "column": 355 - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "String", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 12 - }, - "end": { - "line": 18, - "column": 15 - } - } - }, - "value": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "HashMap", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 46 - }, - "end": { - "line": 18, - "column": 53 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 46 - }, - "end": { - "line": 18, - "column": 54 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 46 - }, - "end": { - "line": 18, - "column": 54 - } - } - }, - "arguments": [], - "loc": { - "start": { - "line": 18, - "column": 42 - }, - "end": { - "line": 18, - "column": 56 - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "HashMap", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 25 - } - } - }, - "typeParams": { - "type": "TSTypeParameterInstantiation", - "params": [ - { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Char", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 31 - } - } - }, - { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Double", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 39 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 39 - } - } - } - ], - "loc": { - "start": { - "line": 18, - "column": 25 - }, - "end": { - "line": 18, - "column": 39 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 41 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "HomoSap", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 12 - }, - "end": { - "line": 19, - "column": 19 - } - } - }, - "value": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "HashMap", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 50 - }, - "end": { - "line": 19, - "column": 57 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 50 - }, - "end": { - "line": 19, - "column": 58 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 50 - }, - "end": { - "line": 19, - "column": 58 - } - } - }, - "arguments": [], - "loc": { - "start": { - "line": 19, - "column": 46 - }, - "end": { - "line": 19, - "column": 60 - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "HashMap", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 22 - }, - "end": { - "line": 19, - "column": 29 - } - } - }, - "typeParams": { - "type": "TSTypeParameterInstantiation", - "params": [ - { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Char", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 30 - }, - "end": { - "line": 19, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 30 - }, - "end": { - "line": 19, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 30 - }, - "end": { - "line": 19, - "column": 35 - } - } - }, - { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Double", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 36 - }, - "end": { - "line": 19, - "column": 42 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 36 - }, - "end": { - "line": 19, - "column": 43 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 36 - }, - "end": { - "line": 19, - "column": 43 - } - } - } - ], - "loc": { - "start": { - "line": 19, - "column": 29 - }, - "end": { - "line": 19, - "column": 43 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 22 - }, - "end": { - "line": 19, - "column": 45 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 22 - }, - "end": { - "line": 19, - "column": 45 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "ClassStaticBlock", - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": true, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 9 - }, - "end": { - "line": 21, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 13 - }, - "end": { - "line": 21, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 21, - "column": 9 - }, - "end": { - "line": 21, - "column": 16 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "a", - "loc": { - "start": { - "line": 21, - "column": 17 - }, - "end": { - "line": 21, - "column": 20 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.2, - "loc": { - "start": { - "line": 21, - "column": 22 - }, - "end": { - "line": 21, - "column": 25 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 21, - "column": 9 - }, - "end": { - "line": 21, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 9 - }, - "end": { - "line": 21, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 13 - }, - "end": { - "line": 22, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 16 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "c", - "loc": { - "start": { - "line": 22, - "column": 17 - }, - "end": { - "line": 22, - "column": 20 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.2, - "loc": { - "start": { - "line": 22, - "column": 22 - }, - "end": { - "line": 22, - "column": 25 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 13 - }, - "end": { - "line": 23, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 16 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "g", - "loc": { - "start": { - "line": 23, - "column": 17 - }, - "end": { - "line": 23, - "column": 20 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.2, - "loc": { - "start": { - "line": 23, - "column": 22 - }, - "end": { - "line": 23, - "column": 25 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 9 - }, - "end": { - "line": 24, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 13 - }, - "end": { - "line": 24, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 24, - "column": 9 - }, - "end": { - "line": 24, - "column": 16 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "t", - "loc": { - "start": { - "line": 24, - "column": 17 - }, - "end": { - "line": 24, - "column": 20 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.2, - "loc": { - "start": { - "line": 24, - "column": 22 - }, - "end": { - "line": 24, - "column": 25 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 24, - "column": 9 - }, - "end": { - "line": 24, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 24, - "column": 9 - }, - "end": { - "line": 24, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 9 - }, - "end": { - "line": 25, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 13 - }, - "end": { - "line": 25, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 25, - "column": 9 - }, - "end": { - "line": 25, - "column": 16 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "B", - "loc": { - "start": { - "line": 25, - "column": 17 - }, - "end": { - "line": 25, - "column": 20 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.2, - "loc": { - "start": { - "line": 25, - "column": 22 - }, - "end": { - "line": 25, - "column": 25 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 25, - "column": 9 - }, - "end": { - "line": 25, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 25, - "column": 9 - }, - "end": { - "line": 25, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 9 - }, - "end": { - "line": 26, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 13 - }, - "end": { - "line": 26, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 26, - "column": 9 - }, - "end": { - "line": 26, - "column": 16 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "D", - "loc": { - "start": { - "line": 26, - "column": 17 - }, - "end": { - "line": 26, - "column": 20 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.2, - "loc": { - "start": { - "line": 26, - "column": 22 - }, - "end": { - "line": 26, - "column": 25 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 26, - "column": 9 - }, - "end": { - "line": 26, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 26, - "column": 9 - }, - "end": { - "line": 26, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 27, - "column": 13 - }, - "end": { - "line": 27, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 16 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "H", - "loc": { - "start": { - "line": 27, - "column": 17 - }, - "end": { - "line": 27, - "column": 20 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.2, - "loc": { - "start": { - "line": 27, - "column": 22 - }, - "end": { - "line": 27, - "column": 25 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 9 - }, - "end": { - "line": 28, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 13 - }, - "end": { - "line": 28, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 28, - "column": 9 - }, - "end": { - "line": 28, - "column": 16 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "K", - "loc": { - "start": { - "line": 28, - "column": 17 - }, - "end": { - "line": 28, - "column": 20 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.2, - "loc": { - "start": { - "line": 28, - "column": 22 - }, - "end": { - "line": 28, - "column": 25 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 28, - "column": 9 - }, - "end": { - "line": 28, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 28, - "column": 9 - }, - "end": { - "line": 28, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 9 - }, - "end": { - "line": 29, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 29, - "column": 13 - }, - "end": { - "line": 29, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 29, - "column": 9 - }, - "end": { - "line": 29, - "column": 16 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "M", - "loc": { - "start": { - "line": 29, - "column": 17 - }, - "end": { - "line": 29, - "column": 20 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.2, - "loc": { - "start": { - "line": 29, - "column": 22 - }, - "end": { - "line": 29, - "column": 25 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 29, - "column": 9 - }, - "end": { - "line": 29, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 29, - "column": 9 - }, - "end": { - "line": 29, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 9 - }, - "end": { - "line": 30, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 13 - }, - "end": { - "line": 30, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 30, - "column": 9 - }, - "end": { - "line": 30, - "column": 16 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "N", - "loc": { - "start": { - "line": 30, - "column": 17 - }, - "end": { - "line": 30, - "column": 20 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.2, - "loc": { - "start": { - "line": 30, - "column": 22 - }, - "end": { - "line": 30, - "column": 25 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 30, - "column": 9 - }, - "end": { - "line": 30, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 9 - }, - "end": { - "line": 30, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 9 - }, - "end": { - "line": 31, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 13 - }, - "end": { - "line": 31, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 31, - "column": 9 - }, - "end": { - "line": 31, - "column": 16 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "R", - "loc": { - "start": { - "line": 31, - "column": 17 - }, - "end": { - "line": 31, - "column": 20 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.2, - "loc": { - "start": { - "line": 31, - "column": 22 - }, - "end": { - "line": 31, - "column": 25 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 31, - "column": 9 - }, - "end": { - "line": 31, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 9 - }, - "end": { - "line": 31, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 9 - }, - "end": { - "line": 32, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 32, - "column": 13 - }, - "end": { - "line": 32, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 32, - "column": 9 - }, - "end": { - "line": 32, - "column": 16 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "S", - "loc": { - "start": { - "line": 32, - "column": 17 - }, - "end": { - "line": 32, - "column": 20 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.2, - "loc": { - "start": { - "line": 32, - "column": 22 - }, - "end": { - "line": 32, - "column": 25 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 32, - "column": 9 - }, - "end": { - "line": 32, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 32, - "column": 9 - }, - "end": { - "line": 32, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 33, - "column": 9 - }, - "end": { - "line": 33, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 33, - "column": 13 - }, - "end": { - "line": 33, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 33, - "column": 9 - }, - "end": { - "line": 33, - "column": 16 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "V", - "loc": { - "start": { - "line": 33, - "column": 17 - }, - "end": { - "line": 33, - "column": 20 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.2, - "loc": { - "start": { - "line": 33, - "column": 22 - }, - "end": { - "line": 33, - "column": 25 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 33, - "column": 9 - }, - "end": { - "line": 33, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 33, - "column": 9 - }, - "end": { - "line": 33, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 34, - "column": 9 - }, - "end": { - "line": 34, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 34, - "column": 13 - }, - "end": { - "line": 34, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 34, - "column": 9 - }, - "end": { - "line": 34, - "column": 16 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "W", - "loc": { - "start": { - "line": 34, - "column": 17 - }, - "end": { - "line": 34, - "column": 20 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.2, - "loc": { - "start": { - "line": 34, - "column": 22 - }, - "end": { - "line": 34, - "column": 25 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 34, - "column": 9 - }, - "end": { - "line": 34, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 34, - "column": 9 - }, - "end": { - "line": 34, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 35, - "column": 9 - }, - "end": { - "line": 35, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 35, - "column": 13 - }, - "end": { - "line": 35, - "column": 16 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 35, - "column": 9 - }, - "end": { - "line": 35, - "column": 16 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "Y", - "loc": { - "start": { - "line": 35, - "column": 17 - }, - "end": { - "line": 35, - "column": 20 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.2, - "loc": { - "start": { - "line": 35, - "column": 22 - }, - "end": { - "line": 35, - "column": 25 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 35, - "column": 9 - }, - "end": { - "line": 35, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 35, - "column": 9 - }, - "end": { - "line": 35, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "HomoSap", - "decorators": [], - "loc": { - "start": { - "line": 36, - "column": 9 - }, - "end": { - "line": 36, - "column": 16 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 20 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 36, - "column": 9 - }, - "end": { - "line": 36, - "column": 20 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "a", - "loc": { - "start": { - "line": 36, - "column": 21 - }, - "end": { - "line": 36, - "column": 24 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.302955, - "loc": { - "start": { - "line": 36, - "column": 26 - }, - "end": { - "line": 36, - "column": 41 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 36, - "column": 9 - }, - "end": { - "line": 36, - "column": 42 - } - } - }, - "loc": { - "start": { - "line": 36, - "column": 9 - }, - "end": { - "line": 36, - "column": 43 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "HomoSap", - "decorators": [], - "loc": { - "start": { - "line": 37, - "column": 9 - }, - "end": { - "line": 37, - "column": 16 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 20 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 37, - "column": 9 - }, - "end": { - "line": 37, - "column": 20 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "c", - "loc": { - "start": { - "line": 37, - "column": 21 - }, - "end": { - "line": 37, - "column": 24 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.197988, - "loc": { - "start": { - "line": 37, - "column": 26 - }, - "end": { - "line": 37, - "column": 41 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 37, - "column": 9 - }, - "end": { - "line": 37, - "column": 42 - } - } - }, - "loc": { - "start": { - "line": 37, - "column": 9 - }, - "end": { - "line": 37, - "column": 43 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "HomoSap", - "decorators": [], - "loc": { - "start": { - "line": 38, - "column": 9 - }, - "end": { - "line": 38, - "column": 16 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 20 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 38, - "column": 9 - }, - "end": { - "line": 38, - "column": 20 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "g", - "loc": { - "start": { - "line": 38, - "column": 21 - }, - "end": { - "line": 38, - "column": 24 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.197547, - "loc": { - "start": { - "line": 38, - "column": 26 - }, - "end": { - "line": 38, - "column": 41 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 38, - "column": 9 - }, - "end": { - "line": 38, - "column": 42 - } - } - }, - "loc": { - "start": { - "line": 38, - "column": 9 - }, - "end": { - "line": 38, - "column": 43 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "HomoSap", - "decorators": [], - "loc": { - "start": { - "line": 39, - "column": 9 - }, - "end": { - "line": 39, - "column": 16 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 39, - "column": 17 - }, - "end": { - "line": 39, - "column": 20 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 39, - "column": 9 - }, - "end": { - "line": 39, - "column": 20 - } - } - }, - "arguments": [ - { - "type": "CharLiteral", - "value": "t", - "loc": { - "start": { - "line": 39, - "column": 21 - }, - "end": { - "line": 39, - "column": 24 - } - } - }, - { - "type": "NumberLiteral", - "value": 0.301509, - "loc": { - "start": { - "line": 39, - "column": 26 - }, - "end": { - "line": 39, - "column": 41 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 39, - "column": 9 - }, - "end": { - "line": 39, - "column": 42 - } - } - }, - "loc": { - "start": { - "line": 39, - "column": 9 - }, - "end": { - "line": 39, - "column": 43 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 40, - "column": 5 - }, - "end": { - "line": 40, - "column": 6 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "Random", - "decorators": [], - "loc": { - "start": { - "line": 41, - "column": 23 - }, - "end": { - "line": 41, - "column": 29 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "last", - "decorators": [], - "loc": { - "start": { - "line": 42, - "column": 16 - }, - "end": { - "line": 42, - "column": 20 - } - } - }, - "value": { - "type": "NumberLiteral", - "value": 42, - "loc": { - "start": { - "line": 42, - "column": 29 - }, - "end": { - "line": 42, - "column": 31 - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 42, - "column": 23 - }, - "end": { - "line": 42, - "column": 26 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "A", - "decorators": [], - "loc": { - "start": { - "line": 43, - "column": 16 - }, - "end": { - "line": 43, - "column": 17 - } - } - }, - "value": { - "type": "NumberLiteral", - "value": 3877, - "loc": { - "start": { - "line": 43, - "column": 26 - }, - "end": { - "line": 43, - "column": 30 - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 43, - "column": 20 - }, - "end": { - "line": 43, - "column": 23 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "C", - "decorators": [], - "loc": { - "start": { - "line": 44, - "column": 16 - }, - "end": { - "line": 44, - "column": 17 - } - } - }, - "value": { - "type": "NumberLiteral", - "value": 29573, - "loc": { - "start": { - "line": 44, - "column": 26 - }, - "end": { - "line": 44, - "column": 31 - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 44, - "column": 20 - }, - "end": { - "line": 44, - "column": 23 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "M", - "decorators": [], - "loc": { - "start": { - "line": 45, - "column": 16 - }, - "end": { - "line": 45, - "column": 17 - } - } - }, - "value": { - "type": "NumberLiteral", - "value": 139968, - "loc": { - "start": { - "line": 45, - "column": 26 - }, - "end": { - "line": 45, - "column": 32 - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 45, - "column": 20 - }, - "end": { - "line": 45, - "column": 23 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "rand", - "decorators": [], - "loc": { - "start": { - "line": 46, - "column": 23 - }, - "end": { - "line": 46, - "column": 27 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "rand", - "decorators": [], - "loc": { - "start": { - "line": 46, - "column": 23 - }, - "end": { - "line": 46, - "column": 27 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "Identifier", - "name": "max", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 46, - "column": 34 - }, - "end": { - "line": 46, - "column": 40 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 46, - "column": 28 - }, - "end": { - "line": 46, - "column": 40 - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 46, - "column": 43 - }, - "end": { - "line": 46, - "column": 49 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "last", - "decorators": [], - "loc": { - "start": { - "line": 47, - "column": 13 - }, - "end": { - "line": 47, - "column": 17 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "%", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "Identifier", - "name": "last", - "decorators": [], - "loc": { - "start": { - "line": 47, - "column": 21 - }, - "end": { - "line": 47, - "column": 25 - } - } - }, - "right": { - "type": "Identifier", - "name": "A", - "decorators": [], - "loc": { - "start": { - "line": 47, - "column": 28 - }, - "end": { - "line": 47, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 47, - "column": 21 - }, - "end": { - "line": 47, - "column": 29 - } - } - }, - "right": { - "type": "Identifier", - "name": "C", - "decorators": [], - "loc": { - "start": { - "line": 47, - "column": 32 - }, - "end": { - "line": 47, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 47, - "column": 20 - }, - "end": { - "line": 47, - "column": 34 - } - } - }, - "right": { - "type": "Identifier", - "name": "M", - "decorators": [], - "loc": { - "start": { - "line": 47, - "column": 37 - }, - "end": { - "line": 47, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 47, - "column": 20 - }, - "end": { - "line": 47, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 47, - "column": 13 - }, - "end": { - "line": 47, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 47, - "column": 13 - }, - "end": { - "line": 47, - "column": 39 - } - } - }, - { - "type": "ReturnStatement", - "argument": { - "type": "BinaryExpression", - "operator": "/", - "left": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "Identifier", - "name": "max", - "decorators": [], - "loc": { - "start": { - "line": 48, - "column": 20 - }, - "end": { - "line": 48, - "column": 23 - } - } - }, - "right": { - "type": "Identifier", - "name": "last", - "decorators": [], - "loc": { - "start": { - "line": 48, - "column": 26 - }, - "end": { - "line": 48, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 48, - "column": 20 - }, - "end": { - "line": 48, - "column": 30 - } - } - }, - "right": { - "type": "Identifier", - "name": "M", - "decorators": [], - "loc": { - "start": { - "line": 48, - "column": 33 - }, - "end": { - "line": 48, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 48, - "column": 20 - }, - "end": { - "line": 48, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 48, - "column": 13 - }, - "end": { - "line": 48, - "column": 35 - } - } - } - ], - "loc": { - "start": { - "line": 46, - "column": 50 - }, - "end": { - "line": 49, - "column": 10 - } - } - }, - "loc": { - "start": { - "line": 46, - "column": 27 - }, - "end": { - "line": 49, - "column": 10 - } - } - }, - "loc": { - "start": { - "line": 46, - "column": 27 - }, - "end": { - "line": 49, - "column": 10 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 46, - "column": 9 - }, - "end": { - "line": 49, - "column": 10 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 50, - "column": 6 - }, - "end": { - "line": 50, - "column": 6 - } - } - } - ], - "loc": { - "start": { - "line": 41, - "column": 31 - }, - "end": { - "line": 50, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 41, - "column": 17 - }, - "end": { - "line": 50, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "makeCumulative", - "decorators": [], - "loc": { - "start": { - "line": 52, - "column": 12 - }, - "end": { - "line": 52, - "column": 26 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "makeCumulative", - "decorators": [], - "loc": { - "start": { - "line": 52, - "column": 12 - }, - "end": { - "line": 52, - "column": 26 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "Identifier", - "name": "table", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "HashMap", - "decorators": [], - "loc": { - "start": { - "line": 52, - "column": 35 - }, - "end": { - "line": 52, - "column": 42 - } - } - }, - "typeParams": { - "type": "TSTypeParameterInstantiation", - "params": [ - { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Char", - "decorators": [], - "loc": { - "start": { - "line": 52, - "column": 43 - }, - "end": { - "line": 52, - "column": 47 - } - } - }, - "loc": { - "start": { - "line": 52, - "column": 43 - }, - "end": { - "line": 52, - "column": 48 - } - } - }, - "loc": { - "start": { - "line": 52, - "column": 43 - }, - "end": { - "line": 52, - "column": 48 - } - } - }, - { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Double", - "decorators": [], - "loc": { - "start": { - "line": 52, - "column": 49 - }, - "end": { - "line": 52, - "column": 55 - } - } - }, - "loc": { - "start": { - "line": 52, - "column": 49 - }, - "end": { - "line": 52, - "column": 56 - } - } - }, - "loc": { - "start": { - "line": 52, - "column": 49 - }, - "end": { - "line": 52, - "column": 56 - } - } - } - ], - "loc": { - "start": { - "line": 52, - "column": 42 - }, - "end": { - "line": 52, - "column": 56 - } - } - }, - "loc": { - "start": { - "line": 52, - "column": 35 - }, - "end": { - "line": 52, - "column": 57 - } - } - }, - "loc": { - "start": { - "line": 52, - "column": 35 - }, - "end": { - "line": 52, - "column": 57 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 52, - "column": 27 - }, - "end": { - "line": 52, - "column": 57 - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 52, - "column": 59 - }, - "end": { - "line": 52, - "column": 63 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "last", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Char", - "decorators": [], - "loc": { - "start": { - "line": 53, - "column": 20 - }, - "end": { - "line": 53, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 53, - "column": 20 - }, - "end": { - "line": 53, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 53, - "column": 20 - }, - "end": { - "line": 53, - "column": 26 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 53, - "column": 13 - }, - "end": { - "line": 53, - "column": 17 - } - } - }, - "init": { - "type": "NullLiteral", - "value": null, - "loc": { - "start": { - "line": 53, - "column": 27 - }, - "end": { - "line": 53, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 53, - "column": 13 - }, - "end": { - "line": 53, - "column": 31 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 53, - "column": 9 - }, - "end": { - "line": 53, - "column": 32 - } - } - }, - { - "type": "ForOfStatement", - "await": false, - "left": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "entry", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "TSQualifiedName", - "left": { - "type": "Identifier", - "name": "HashMap", - "decorators": [], - "loc": { - "start": { - "line": 54, - "column": 26 - }, - "end": { - "line": 54, - "column": 33 - } - } - }, - "right": { - "type": "Identifier", - "name": "Entry", - "decorators": [], - "loc": { - "start": { - "line": 54, - "column": 34 - }, - "end": { - "line": 54, - "column": 39 - } - } - }, - "loc": { - "start": { - "line": 54, - "column": 26 - }, - "end": { - "line": 54, - "column": 40 - } - } - }, - "typeParams": { - "type": "TSTypeParameterInstantiation", - "params": [ - { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Char", - "decorators": [], - "loc": { - "start": { - "line": 54, - "column": 40 - }, - "end": { - "line": 54, - "column": 44 - } - } - }, - "loc": { - "start": { - "line": 54, - "column": 40 - }, - "end": { - "line": 54, - "column": 45 - } - } - }, - "loc": { - "start": { - "line": 54, - "column": 40 - }, - "end": { - "line": 54, - "column": 45 - } - } - }, - { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Double", - "decorators": [], - "loc": { - "start": { - "line": 54, - "column": 46 - }, - "end": { - "line": 54, - "column": 52 - } - } - }, - "loc": { - "start": { - "line": 54, - "column": 46 - }, - "end": { - "line": 54, - "column": 53 - } - } - }, - "loc": { - "start": { - "line": 54, - "column": 46 - }, - "end": { - "line": 54, - "column": 53 - } - } - } - ], - "loc": { - "start": { - "line": 54, - "column": 39 - }, - "end": { - "line": 54, - "column": 53 - } - } - }, - "loc": { - "start": { - "line": 54, - "column": 26 - }, - "end": { - "line": 54, - "column": 56 - } - } - }, - "loc": { - "start": { - "line": 54, - "column": 26 - }, - "end": { - "line": 54, - "column": 56 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 54, - "column": 18 - }, - "end": { - "line": 54, - "column": 23 - } - } - }, - "init": null, - "loc": { - "start": { - "line": 54, - "column": 18 - }, - "end": { - "line": 54, - "column": 23 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 54, - "column": 14 - }, - "end": { - "line": 54, - "column": 23 - } - } - }, - "right": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "table", - "decorators": [], - "loc": { - "start": { - "line": 54, - "column": 57 - }, - "end": { - "line": 54, - "column": 62 - } - } - }, - "property": { - "type": "Identifier", - "name": "entrySet", - "decorators": [], - "loc": { - "start": { - "line": 54, - "column": 63 - }, - "end": { - "line": 54, - "column": 71 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 54, - "column": 57 - }, - "end": { - "line": 54, - "column": 71 - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 54, - "column": 57 - }, - "end": { - "line": 54, - "column": 73 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "c", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Char", - "decorators": [], - "loc": { - "start": { - "line": 55, - "column": 21 - }, - "end": { - "line": 55, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 55, - "column": 21 - }, - "end": { - "line": 55, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 55, - "column": 21 - }, - "end": { - "line": 55, - "column": 27 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 55, - "column": 17 - }, - "end": { - "line": 55, - "column": 18 - } - } - }, - "init": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "entry", - "decorators": [], - "loc": { - "start": { - "line": 55, - "column": 28 - }, - "end": { - "line": 55, - "column": 33 - } - } - }, - "property": { - "type": "Identifier", - "name": "getKey", - "decorators": [], - "loc": { - "start": { - "line": 55, - "column": 34 - }, - "end": { - "line": 55, - "column": 40 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 55, - "column": 28 - }, - "end": { - "line": 55, - "column": 40 - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 55, - "column": 28 - }, - "end": { - "line": 55, - "column": 42 - } - } - }, - "loc": { - "start": { - "line": 55, - "column": 17 - }, - "end": { - "line": 55, - "column": 42 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 55, - "column": 13 - }, - "end": { - "line": 55, - "column": 43 - } - } - }, - { - "type": "IfStatement", - "test": { - "type": "BinaryExpression", - "operator": "!=", - "left": { - "type": "Identifier", - "name": "last", - "decorators": [], - "loc": { - "start": { - "line": 56, - "column": 17 - }, - "end": { - "line": 56, - "column": 21 - } - } - }, - "right": { - "type": "NullLiteral", - "value": null, - "loc": { - "start": { - "line": 56, - "column": 25 - }, - "end": { - "line": 56, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 56, - "column": 17 - }, - "end": { - "line": 56, - "column": 29 - } - } - }, - "consequent": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "table", - "decorators": [], - "loc": { - "start": { - "line": 57, - "column": 17 - }, - "end": { - "line": 57, - "column": 22 - } - } - }, - "property": { - "type": "Identifier", - "name": "put", - "decorators": [], - "loc": { - "start": { - "line": 57, - "column": 23 - }, - "end": { - "line": 57, - "column": 26 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 57, - "column": 17 - }, - "end": { - "line": 57, - "column": 26 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "c", - "decorators": [], - "loc": { - "start": { - "line": 57, - "column": 27 - }, - "end": { - "line": 57, - "column": 28 - } - } - }, - { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "entry", - "decorators": [], - "loc": { - "start": { - "line": 57, - "column": 30 - }, - "end": { - "line": 57, - "column": 35 - } - } - }, - "property": { - "type": "Identifier", - "name": "getValue", - "decorators": [], - "loc": { - "start": { - "line": 57, - "column": 36 - }, - "end": { - "line": 57, - "column": 44 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 57, - "column": 30 - }, - "end": { - "line": 57, - "column": 44 - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 57, - "column": 30 - }, - "end": { - "line": 57, - "column": 46 - } - } - }, - "right": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "table", - "decorators": [], - "loc": { - "start": { - "line": 57, - "column": 49 - }, - "end": { - "line": 57, - "column": 54 - } - } - }, - "property": { - "type": "Identifier", - "name": "get", - "decorators": [], - "loc": { - "start": { - "line": 57, - "column": 55 - }, - "end": { - "line": 57, - "column": 58 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 57, - "column": 49 - }, - "end": { - "line": 57, - "column": 58 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "last", - "decorators": [], - "loc": { - "start": { - "line": 57, - "column": 59 - }, - "end": { - "line": 57, - "column": 63 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 57, - "column": 49 - }, - "end": { - "line": 57, - "column": 64 - } - } - }, - "loc": { - "start": { - "line": 57, - "column": 30 - }, - "end": { - "line": 57, - "column": 64 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 57, - "column": 17 - }, - "end": { - "line": 57, - "column": 65 - } - } - }, - "loc": { - "start": { - "line": 57, - "column": 17 - }, - "end": { - "line": 57, - "column": 66 - } - } - } - ], - "loc": { - "start": { - "line": 56, - "column": 31 - }, - "end": { - "line": 58, - "column": 14 - } - } - }, - "alternate": null, - "loc": { - "start": { - "line": 56, - "column": 13 - }, - "end": { - "line": 58, - "column": 14 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "last", - "decorators": [], - "loc": { - "start": { - "line": 59, - "column": 13 - }, - "end": { - "line": 59, - "column": 17 - } - } - }, - "right": { - "type": "Identifier", - "name": "c", - "decorators": [], - "loc": { - "start": { - "line": 59, - "column": 20 - }, - "end": { - "line": 59, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 59, - "column": 13 - }, - "end": { - "line": 59, - "column": 21 - } - } - }, - "loc": { - "start": { - "line": 59, - "column": 13 - }, - "end": { - "line": 59, - "column": 22 - } - } - } - ], - "loc": { - "start": { - "line": 54, - "column": 74 - }, - "end": { - "line": 60, - "column": 10 - } - } - }, - "loc": { - "start": { - "line": 54, - "column": 9 - }, - "end": { - "line": 60, - "column": 10 - } - } - } - ], - "loc": { - "start": { - "line": 52, - "column": 64 - }, - "end": { - "line": 61, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 52, - "column": 26 - }, - "end": { - "line": 61, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 52, - "column": 26 - }, - "end": { - "line": 61, - "column": 6 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 52, - "column": 5 - }, - "end": { - "line": 61, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "fastaRepeat", - "decorators": [], - "loc": { - "start": { - "line": 62, - "column": 12 - }, - "end": { - "line": 62, - "column": 23 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "fastaRepeat", - "decorators": [], - "loc": { - "start": { - "line": 62, - "column": 12 - }, - "end": { - "line": 62, - "column": 23 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "Identifier", - "name": "n", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 62, - "column": 28 - }, - "end": { - "line": 62, - "column": 31 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 62, - "column": 24 - }, - "end": { - "line": 62, - "column": 31 - } - } - }, - { - "type": "Identifier", - "name": "seq", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "String", - "decorators": [], - "loc": { - "start": { - "line": 62, - "column": 39 - }, - "end": { - "line": 62, - "column": 45 - } - } - }, - "loc": { - "start": { - "line": 62, - "column": 39 - }, - "end": { - "line": 62, - "column": 46 - } - } - }, - "loc": { - "start": { - "line": 62, - "column": 39 - }, - "end": { - "line": 62, - "column": 46 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 62, - "column": 33 - }, - "end": { - "line": 62, - "column": 46 - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 62, - "column": 48 - }, - "end": { - "line": 62, - "column": 51 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "seqi", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 63, - "column": 20 - }, - "end": { - "line": 63, - "column": 23 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 63, - "column": 13 - }, - "end": { - "line": 63, - "column": 17 - } - } - }, - "init": { - "type": "NumberLiteral", - "value": 0, - "loc": { - "start": { - "line": 63, - "column": 26 - }, - "end": { - "line": 63, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 63, - "column": 13 - }, - "end": { - "line": 63, - "column": 27 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 63, - "column": 9 - }, - "end": { - "line": 63, - "column": 28 - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "lenOut", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 64, - "column": 22 - }, - "end": { - "line": 64, - "column": 25 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 64, - "column": 13 - }, - "end": { - "line": 64, - "column": 19 - } - } - }, - "init": { - "type": "NumberLiteral", - "value": 60, - "loc": { - "start": { - "line": 64, - "column": 28 - }, - "end": { - "line": 64, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 64, - "column": 13 - }, - "end": { - "line": 64, - "column": 30 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 64, - "column": 9 - }, - "end": { - "line": 64, - "column": 31 - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "ret", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 65, - "column": 19 - }, - "end": { - "line": 65, - "column": 22 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 65, - "column": 13 - }, - "end": { - "line": 65, - "column": 16 - } - } - }, - "init": { - "type": "NumberLiteral", - "value": 0, - "loc": { - "start": { - "line": 65, - "column": 25 - }, - "end": { - "line": 65, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 65, - "column": 13 - }, - "end": { - "line": 65, - "column": 26 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 65, - "column": 9 - }, - "end": { - "line": 65, - "column": 27 - } - } - }, - { - "type": "WhileStatement", - "test": { - "type": "BinaryExpression", - "operator": ">", - "left": { - "type": "Identifier", - "name": "n", - "decorators": [], - "loc": { - "start": { - "line": 66, - "column": 15 - }, - "end": { - "line": 66, - "column": 16 - } - } - }, - "right": { - "type": "NumberLiteral", - "value": 0, - "loc": { - "start": { - "line": 66, - "column": 19 - }, - "end": { - "line": 66, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 66, - "column": 15 - }, - "end": { - "line": 66, - "column": 20 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "IfStatement", - "test": { - "type": "BinaryExpression", - "operator": "<", - "left": { - "type": "Identifier", - "name": "n", - "decorators": [], - "loc": { - "start": { - "line": 68, - "column": 17 - }, - "end": { - "line": 68, - "column": 18 - } - } - }, - "right": { - "type": "Identifier", - "name": "lenOut", - "decorators": [], - "loc": { - "start": { - "line": 68, - "column": 21 - }, - "end": { - "line": 68, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 68, - "column": 17 - }, - "end": { - "line": 68, - "column": 27 - } - } - }, - "consequent": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "lenOut", - "decorators": [], - "loc": { - "start": { - "line": 69, - "column": 17 - }, - "end": { - "line": 69, - "column": 23 - } - } - }, - "right": { - "type": "Identifier", - "name": "n", - "decorators": [], - "loc": { - "start": { - "line": 69, - "column": 26 - }, - "end": { - "line": 69, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 69, - "column": 17 - }, - "end": { - "line": 69, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 69, - "column": 17 - }, - "end": { - "line": 69, - "column": 28 - } - } - } - ], - "loc": { - "start": { - "line": 68, - "column": 29 - }, - "end": { - "line": 70, - "column": 14 - } - } - }, - "alternate": null, - "loc": { - "start": { - "line": 68, - "column": 13 - }, - "end": { - "line": 70, - "column": 14 - } - } - }, - { - "type": "IfStatement", - "test": { - "type": "BinaryExpression", - "operator": "<", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Identifier", - "name": "seqi", - "decorators": [], - "loc": { - "start": { - "line": 71, - "column": 17 - }, - "end": { - "line": 71, - "column": 21 - } - } - }, - "right": { - "type": "Identifier", - "name": "lenOut", - "decorators": [], - "loc": { - "start": { - "line": 71, - "column": 24 - }, - "end": { - "line": 71, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 71, - "column": 17 - }, - "end": { - "line": 71, - "column": 30 - } - } - }, - "right": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "seq", - "decorators": [], - "loc": { - "start": { - "line": 71, - "column": 33 - }, - "end": { - "line": 71, - "column": 36 - } - } - }, - "property": { - "type": "Identifier", - "name": "length", - "decorators": [], - "loc": { - "start": { - "line": 71, - "column": 37 - }, - "end": { - "line": 71, - "column": 43 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 71, - "column": 33 - }, - "end": { - "line": 71, - "column": 43 - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 71, - "column": 33 - }, - "end": { - "line": 71, - "column": 45 - } - } - }, - "loc": { - "start": { - "line": 71, - "column": 17 - }, - "end": { - "line": 71, - "column": 45 - } - } - }, - "consequent": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "+=", - "left": { - "type": "Identifier", - "name": "ret", - "decorators": [], - "loc": { - "start": { - "line": 72, - "column": 17 - }, - "end": { - "line": 72, - "column": 20 - } - } - }, - "right": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "seq", - "decorators": [], - "loc": { - "start": { - "line": 72, - "column": 24 - }, - "end": { - "line": 72, - "column": 27 - } - } - }, - "property": { - "type": "Identifier", - "name": "substring", - "decorators": [], - "loc": { - "start": { - "line": 72, - "column": 28 - }, - "end": { - "line": 72, - "column": 37 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 72, - "column": 24 - }, - "end": { - "line": 72, - "column": 37 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "seqi", - "decorators": [], - "loc": { - "start": { - "line": 72, - "column": 38 - }, - "end": { - "line": 72, - "column": 42 - } - } - }, - { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Identifier", - "name": "seqi", - "decorators": [], - "loc": { - "start": { - "line": 72, - "column": 44 - }, - "end": { - "line": 72, - "column": 48 - } - } - }, - "right": { - "type": "Identifier", - "name": "lenOut", - "decorators": [], - "loc": { - "start": { - "line": 72, - "column": 51 - }, - "end": { - "line": 72, - "column": 57 - } - } - }, - "loc": { - "start": { - "line": 72, - "column": 44 - }, - "end": { - "line": 72, - "column": 57 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 72, - "column": 24 - }, - "end": { - "line": 72, - "column": 58 - } - } - }, - "property": { - "type": "Identifier", - "name": "length", - "decorators": [], - "loc": { - "start": { - "line": 72, - "column": 59 - }, - "end": { - "line": 72, - "column": 65 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 72, - "column": 24 - }, - "end": { - "line": 72, - "column": 65 - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 72, - "column": 24 - }, - "end": { - "line": 72, - "column": 67 - } - } - }, - "loc": { - "start": { - "line": 72, - "column": 17 - }, - "end": { - "line": 72, - "column": 67 - } - } - }, - "loc": { - "start": { - "line": 72, - "column": 17 - }, - "end": { - "line": 72, - "column": 68 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "+=", - "left": { - "type": "Identifier", - "name": "seqi", - "decorators": [], - "loc": { - "start": { - "line": 73, - "column": 17 - }, - "end": { - "line": 73, - "column": 21 - } - } - }, - "right": { - "type": "Identifier", - "name": "lenOut", - "decorators": [], - "loc": { - "start": { - "line": 73, - "column": 25 - }, - "end": { - "line": 73, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 73, - "column": 17 - }, - "end": { - "line": 73, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 73, - "column": 17 - }, - "end": { - "line": 73, - "column": 32 - } - } - } - ], - "loc": { - "start": { - "line": 71, - "column": 47 - }, - "end": { - "line": 74, - "column": 14 - } - } - }, - "alternate": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "s", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "String", - "decorators": [], - "loc": { - "start": { - "line": 76, - "column": 25 - }, - "end": { - "line": 76, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 76, - "column": 25 - }, - "end": { - "line": 76, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 76, - "column": 25 - }, - "end": { - "line": 76, - "column": 33 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 76, - "column": 21 - }, - "end": { - "line": 76, - "column": 22 - } - } - }, - "init": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "seq", - "decorators": [], - "loc": { - "start": { - "line": 76, - "column": 34 - }, - "end": { - "line": 76, - "column": 37 - } - } - }, - "property": { - "type": "Identifier", - "name": "substring", - "decorators": [], - "loc": { - "start": { - "line": 76, - "column": 38 - }, - "end": { - "line": 76, - "column": 47 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 76, - "column": 34 - }, - "end": { - "line": 76, - "column": 47 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "seqi", - "decorators": [], - "loc": { - "start": { - "line": 76, - "column": 48 - }, - "end": { - "line": 76, - "column": 52 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 76, - "column": 34 - }, - "end": { - "line": 76, - "column": 53 - } - } - }, - "loc": { - "start": { - "line": 76, - "column": 21 - }, - "end": { - "line": 76, - "column": 53 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 76, - "column": 17 - }, - "end": { - "line": 76, - "column": 54 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "seqi", - "decorators": [], - "loc": { - "start": { - "line": 77, - "column": 17 - }, - "end": { - "line": 77, - "column": 21 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "-", - "left": { - "type": "Identifier", - "name": "lenOut", - "decorators": [], - "loc": { - "start": { - "line": 77, - "column": 24 - }, - "end": { - "line": 77, - "column": 30 - } - } - }, - "right": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "s", - "decorators": [], - "loc": { - "start": { - "line": 77, - "column": 33 - }, - "end": { - "line": 77, - "column": 34 - } - } - }, - "property": { - "type": "Identifier", - "name": "length", - "decorators": [], - "loc": { - "start": { - "line": 77, - "column": 35 - }, - "end": { - "line": 77, - "column": 41 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 77, - "column": 33 - }, - "end": { - "line": 77, - "column": 41 - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 77, - "column": 33 - }, - "end": { - "line": 77, - "column": 43 - } - } - }, - "loc": { - "start": { - "line": 77, - "column": 24 - }, - "end": { - "line": 77, - "column": 43 - } - } - }, - "loc": { - "start": { - "line": 77, - "column": 17 - }, - "end": { - "line": 77, - "column": 43 - } - } - }, - "loc": { - "start": { - "line": 77, - "column": 17 - }, - "end": { - "line": 77, - "column": 44 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "+=", - "left": { - "type": "Identifier", - "name": "ret", - "decorators": [], - "loc": { - "start": { - "line": 78, - "column": 17 - }, - "end": { - "line": 78, - "column": 20 - } - } - }, - "right": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Identifier", - "name": "s", - "decorators": [], - "loc": { - "start": { - "line": 78, - "column": 25 - }, - "end": { - "line": 78, - "column": 26 - } - } - }, - "right": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "seq", - "decorators": [], - "loc": { - "start": { - "line": 78, - "column": 29 - }, - "end": { - "line": 78, - "column": 32 - } - } - }, - "property": { - "type": "Identifier", - "name": "substring", - "decorators": [], - "loc": { - "start": { - "line": 78, - "column": 33 - }, - "end": { - "line": 78, - "column": 42 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 78, - "column": 29 - }, - "end": { - "line": 78, - "column": 42 - } - } - }, - "arguments": [ - { - "type": "NumberLiteral", - "value": 0, - "loc": { - "start": { - "line": 78, - "column": 43 - }, - "end": { - "line": 78, - "column": 44 - } - } - }, - { - "type": "Identifier", - "name": "seqi", - "decorators": [], - "loc": { - "start": { - "line": 78, - "column": 46 - }, - "end": { - "line": 78, - "column": 50 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 78, - "column": 29 - }, - "end": { - "line": 78, - "column": 51 - } - } - }, - "loc": { - "start": { - "line": 78, - "column": 24 - }, - "end": { - "line": 78, - "column": 52 - } - } - }, - "property": { - "type": "Identifier", - "name": "length", - "decorators": [], - "loc": { - "start": { - "line": 78, - "column": 53 - }, - "end": { - "line": 78, - "column": 59 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 78, - "column": 24 - }, - "end": { - "line": 78, - "column": 59 - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 78, - "column": 24 - }, - "end": { - "line": 78, - "column": 61 - } - } - }, - "loc": { - "start": { - "line": 78, - "column": 17 - }, - "end": { - "line": 78, - "column": 61 - } - } - }, - "loc": { - "start": { - "line": 78, - "column": 17 - }, - "end": { - "line": 78, - "column": 62 - } - } - } - ], - "loc": { - "start": { - "line": 75, - "column": 18 - }, - "end": { - "line": 79, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 71, - "column": 13 - }, - "end": { - "line": 79, - "column": 14 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "-=", - "left": { - "type": "Identifier", - "name": "n", - "decorators": [], - "loc": { - "start": { - "line": 80, - "column": 13 - }, - "end": { - "line": 80, - "column": 14 - } - } - }, - "right": { - "type": "Identifier", - "name": "lenOut", - "decorators": [], - "loc": { - "start": { - "line": 80, - "column": 18 - }, - "end": { - "line": 80, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 80, - "column": 13 - }, - "end": { - "line": 80, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 80, - "column": 13 - }, - "end": { - "line": 80, - "column": 25 - } - } - } - ], - "loc": { - "start": { - "line": 67, - "column": 9 - }, - "end": { - "line": 81, - "column": 10 - } - } - }, - "loc": { - "start": { - "line": 66, - "column": 9 - }, - "end": { - "line": 81, - "column": 10 - } - } - }, - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "ret", - "decorators": [], - "loc": { - "start": { - "line": 82, - "column": 16 - }, - "end": { - "line": 82, - "column": 19 - } - } - }, - "loc": { - "start": { - "line": 82, - "column": 9 - }, - "end": { - "line": 82, - "column": 20 - } - } - } - ], - "loc": { - "start": { - "line": 62, - "column": 52 - }, - "end": { - "line": 83, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 62, - "column": 23 - }, - "end": { - "line": 83, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 62, - "column": 23 - }, - "end": { - "line": 83, - "column": 6 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 62, - "column": 5 - }, - "end": { - "line": 83, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "fastaRandom", - "decorators": [], - "loc": { - "start": { - "line": 84, - "column": 12 - }, - "end": { - "line": 84, - "column": 23 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": true, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "fastaRandom", - "decorators": [], - "loc": { - "start": { - "line": 84, - "column": 12 - }, - "end": { - "line": 84, - "column": 23 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "Identifier", - "name": "n", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 84, - "column": 28 - }, - "end": { - "line": 84, - "column": 31 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 84, - "column": 24 - }, - "end": { - "line": 84, - "column": 31 - } - } - }, - { - "type": "Identifier", - "name": "table", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "HashMap", - "decorators": [], - "loc": { - "start": { - "line": 84, - "column": 41 - }, - "end": { - "line": 84, - "column": 48 - } - } - }, - "typeParams": { - "type": "TSTypeParameterInstantiation", - "params": [ - { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Char", - "decorators": [], - "loc": { - "start": { - "line": 84, - "column": 49 - }, - "end": { - "line": 84, - "column": 53 - } - } - }, - "loc": { - "start": { - "line": 84, - "column": 49 - }, - "end": { - "line": 84, - "column": 54 - } - } - }, - "loc": { - "start": { - "line": 84, - "column": 49 - }, - "end": { - "line": 84, - "column": 54 - } - } - }, - { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Double", - "decorators": [], - "loc": { - "start": { - "line": 84, - "column": 55 - }, - "end": { - "line": 84, - "column": 61 - } - } - }, - "loc": { - "start": { - "line": 84, - "column": 55 - }, - "end": { - "line": 84, - "column": 62 - } - } - }, - "loc": { - "start": { - "line": 84, - "column": 55 - }, - "end": { - "line": 84, - "column": 62 - } - } - } - ], - "loc": { - "start": { - "line": 84, - "column": 48 - }, - "end": { - "line": 84, - "column": 62 - } - } - }, - "loc": { - "start": { - "line": 84, - "column": 41 - }, - "end": { - "line": 84, - "column": 63 - } - } - }, - "loc": { - "start": { - "line": 84, - "column": 41 - }, - "end": { - "line": 84, - "column": 63 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 84, - "column": 33 - }, - "end": { - "line": 84, - "column": 63 - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 84, - "column": 65 - }, - "end": { - "line": 84, - "column": 68 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "line", - "typeAnnotation": { - "type": "TSArrayType", - "elementType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 85, - "column": 20 - }, - "end": { - "line": 85, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 85, - "column": 27 - }, - "end": { - "line": 85, - "column": 28 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 85, - "column": 13 - }, - "end": { - "line": 85, - "column": 17 - } - } - }, - "init": { - "type": "ETSNewArrayInstanceExpression", - "typeReference": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 85, - "column": 33 - }, - "end": { - "line": 85, - "column": 37 - } - } - }, - "dimension": { - "type": "NumberLiteral", - "value": 60, - "loc": { - "start": { - "line": 85, - "column": 38 - }, - "end": { - "line": 85, - "column": 40 - } - } - }, - "loc": { - "start": { - "line": 85, - "column": 29 - }, - "end": { - "line": 85, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 85, - "column": 13 - }, - "end": { - "line": 85, - "column": 41 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 85, - "column": 9 - }, - "end": { - "line": 85, - "column": 42 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "makeCumulative", - "decorators": [], - "loc": { - "start": { - "line": 86, - "column": 9 - }, - "end": { - "line": 86, - "column": 23 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "table", - "decorators": [], - "loc": { - "start": { - "line": 86, - "column": 24 - }, - "end": { - "line": 86, - "column": 29 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 86, - "column": 9 - }, - "end": { - "line": 86, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 86, - "column": 9 - }, - "end": { - "line": 86, - "column": 31 - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "ret", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 87, - "column": 19 - }, - "end": { - "line": 87, - "column": 22 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 87, - "column": 13 - }, - "end": { - "line": 87, - "column": 16 - } - } - }, - "init": { - "type": "NumberLiteral", - "value": 0, - "loc": { - "start": { - "line": 87, - "column": 25 - }, - "end": { - "line": 87, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 87, - "column": 13 - }, - "end": { - "line": 87, - "column": 26 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 87, - "column": 9 - }, - "end": { - "line": 87, - "column": 27 - } - } - }, - { - "type": "WhileStatement", - "test": { - "type": "BinaryExpression", - "operator": ">", - "left": { - "type": "Identifier", - "name": "n", - "decorators": [], - "loc": { - "start": { - "line": 88, - "column": 15 - }, - "end": { - "line": 88, - "column": 16 - } - } - }, - "right": { - "type": "NumberLiteral", - "value": 0, - "loc": { - "start": { - "line": 88, - "column": 19 - }, - "end": { - "line": 88, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 88, - "column": 15 - }, - "end": { - "line": 88, - "column": 20 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "IfStatement", - "test": { - "type": "BinaryExpression", - "operator": "<", - "left": { - "type": "Identifier", - "name": "n", - "decorators": [], - "loc": { - "start": { - "line": 90, - "column": 17 - }, - "end": { - "line": 90, - "column": 18 - } - } - }, - "right": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "line", - "decorators": [], - "loc": { - "start": { - "line": 90, - "column": 21 - }, - "end": { - "line": 90, - "column": 25 - } - } - }, - "property": { - "type": "Identifier", - "name": "length", - "decorators": [], - "loc": { - "start": { - "line": 90, - "column": 26 - }, - "end": { - "line": 90, - "column": 32 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 90, - "column": 21 - }, - "end": { - "line": 90, - "column": 32 - } - } - }, - "loc": { - "start": { - "line": 90, - "column": 17 - }, - "end": { - "line": 90, - "column": 32 - } - } - }, - "consequent": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "line", - "decorators": [], - "loc": { - "start": { - "line": 91, - "column": 17 - }, - "end": { - "line": 91, - "column": 21 - } - } - }, - "right": { - "type": "ETSNewArrayInstanceExpression", - "typeReference": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 91, - "column": 28 - }, - "end": { - "line": 91, - "column": 32 - } - } - }, - "dimension": { - "type": "Identifier", - "name": "n", - "decorators": [], - "loc": { - "start": { - "line": 91, - "column": 33 - }, - "end": { - "line": 91, - "column": 34 - } - } - }, - "loc": { - "start": { - "line": 91, - "column": 24 - }, - "end": { - "line": 91, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 91, - "column": 17 - }, - "end": { - "line": 91, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 91, - "column": 17 - }, - "end": { - "line": 91, - "column": 36 - } - } - } - ], - "loc": { - "start": { - "line": 90, - "column": 34 - }, - "end": { - "line": 92, - "column": 14 - } - } - }, - "alternate": null, - "loc": { - "start": { - "line": 90, - "column": 13 - }, - "end": { - "line": 92, - "column": 14 - } - } - }, - { - "type": "ForUpdateStatement", - "init": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "i", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 93, - "column": 26 - }, - "end": { - "line": 93, - "column": 29 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 93, - "column": 22 - }, - "end": { - "line": 93, - "column": 23 - } - } - }, - "init": { - "type": "NumberLiteral", - "value": 0, - "loc": { - "start": { - "line": 93, - "column": 32 - }, - "end": { - "line": 93, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 93, - "column": 22 - }, - "end": { - "line": 93, - "column": 33 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 93, - "column": 18 - }, - "end": { - "line": 93, - "column": 33 - } - } - }, - "test": { - "type": "BinaryExpression", - "operator": "<", - "left": { - "type": "Identifier", - "name": "i", - "decorators": [], - "loc": { - "start": { - "line": 93, - "column": 35 - }, - "end": { - "line": 93, - "column": 36 - } - } - }, - "right": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "line", - "decorators": [], - "loc": { - "start": { - "line": 93, - "column": 39 - }, - "end": { - "line": 93, - "column": 43 - } - } - }, - "property": { - "type": "Identifier", - "name": "length", - "decorators": [], - "loc": { - "start": { - "line": 93, - "column": 44 - }, - "end": { - "line": 93, - "column": 50 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 93, - "column": 39 - }, - "end": { - "line": 93, - "column": 50 - } - } - }, - "loc": { - "start": { - "line": 93, - "column": 35 - }, - "end": { - "line": 93, - "column": 50 - } - } - }, - "update": { - "type": "UpdateExpression", - "operator": "++", - "prefix": false, - "argument": { - "type": "Identifier", - "name": "i", - "decorators": [], - "loc": { - "start": { - "line": 93, - "column": 52 - }, - "end": { - "line": 93, - "column": 53 - } - } - }, - "loc": { - "start": { - "line": 93, - "column": 52 - }, - "end": { - "line": 93, - "column": 55 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "r", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 94, - "column": 25 - }, - "end": { - "line": 94, - "column": 31 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 94, - "column": 21 - }, - "end": { - "line": 94, - "column": 22 - } - } - }, - "init": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "Random", - "decorators": [], - "loc": { - "start": { - "line": 94, - "column": 34 - }, - "end": { - "line": 94, - "column": 40 - } - } - }, - "property": { - "type": "Identifier", - "name": "rand", - "decorators": [], - "loc": { - "start": { - "line": 94, - "column": 41 - }, - "end": { - "line": 94, - "column": 45 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 94, - "column": 34 - }, - "end": { - "line": 94, - "column": 45 - } - } - }, - "arguments": [ - { - "type": "NumberLiteral", - "value": 1, - "loc": { - "start": { - "line": 94, - "column": 46 - }, - "end": { - "line": 94, - "column": 47 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 94, - "column": 34 - }, - "end": { - "line": 94, - "column": 48 - } - } - }, - "loc": { - "start": { - "line": 94, - "column": 21 - }, - "end": { - "line": 94, - "column": 48 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 94, - "column": 17 - }, - "end": { - "line": 94, - "column": 49 - } - } - }, - { - "type": "ForOfStatement", - "await": false, - "left": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "entry", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "TSQualifiedName", - "left": { - "type": "Identifier", - "name": "HashMap", - "decorators": [], - "loc": { - "start": { - "line": 95, - "column": 34 - }, - "end": { - "line": 95, - "column": 41 - } - } - }, - "right": { - "type": "Identifier", - "name": "Entry", - "decorators": [], - "loc": { - "start": { - "line": 95, - "column": 42 - }, - "end": { - "line": 95, - "column": 47 - } - } - }, - "loc": { - "start": { - "line": 95, - "column": 34 - }, - "end": { - "line": 95, - "column": 48 - } - } - }, - "typeParams": { - "type": "TSTypeParameterInstantiation", - "params": [ - { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Char", - "decorators": [], - "loc": { - "start": { - "line": 95, - "column": 48 - }, - "end": { - "line": 95, - "column": 52 - } - } - }, - "loc": { - "start": { - "line": 95, - "column": 48 - }, - "end": { - "line": 95, - "column": 53 - } - } - }, - "loc": { - "start": { - "line": 95, - "column": 48 - }, - "end": { - "line": 95, - "column": 53 - } - } - }, - { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Double", - "decorators": [], - "loc": { - "start": { - "line": 95, - "column": 54 - }, - "end": { - "line": 95, - "column": 60 - } - } - }, - "loc": { - "start": { - "line": 95, - "column": 54 - }, - "end": { - "line": 95, - "column": 61 - } - } - }, - "loc": { - "start": { - "line": 95, - "column": 54 - }, - "end": { - "line": 95, - "column": 61 - } - } - } - ], - "loc": { - "start": { - "line": 95, - "column": 47 - }, - "end": { - "line": 95, - "column": 61 - } - } - }, - "loc": { - "start": { - "line": 95, - "column": 34 - }, - "end": { - "line": 95, - "column": 64 - } - } - }, - "loc": { - "start": { - "line": 95, - "column": 34 - }, - "end": { - "line": 95, - "column": 64 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 95, - "column": 26 - }, - "end": { - "line": 95, - "column": 31 - } - } - }, - "init": null, - "loc": { - "start": { - "line": 95, - "column": 26 - }, - "end": { - "line": 95, - "column": 31 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 95, - "column": 22 - }, - "end": { - "line": 95, - "column": 31 - } - } - }, - "right": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "table", - "decorators": [], - "loc": { - "start": { - "line": 95, - "column": 65 - }, - "end": { - "line": 95, - "column": 70 - } - } - }, - "property": { - "type": "Identifier", - "name": "entrySet", - "decorators": [], - "loc": { - "start": { - "line": 95, - "column": 71 - }, - "end": { - "line": 95, - "column": 79 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 95, - "column": 65 - }, - "end": { - "line": 95, - "column": 79 - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 95, - "column": 65 - }, - "end": { - "line": 95, - "column": 81 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "c", - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "Char", - "decorators": [], - "loc": { - "start": { - "line": 96, - "column": 29 - }, - "end": { - "line": 96, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 96, - "column": 29 - }, - "end": { - "line": 96, - "column": 35 - } - } - }, - "loc": { - "start": { - "line": 96, - "column": 29 - }, - "end": { - "line": 96, - "column": 35 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 96, - "column": 25 - }, - "end": { - "line": 96, - "column": 26 - } - } - }, - "init": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "entry", - "decorators": [], - "loc": { - "start": { - "line": 96, - "column": 36 - }, - "end": { - "line": 96, - "column": 41 - } - } - }, - "property": { - "type": "Identifier", - "name": "getKey", - "decorators": [], - "loc": { - "start": { - "line": 96, - "column": 42 - }, - "end": { - "line": 96, - "column": 48 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 96, - "column": 36 - }, - "end": { - "line": 96, - "column": 48 - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 96, - "column": 36 - }, - "end": { - "line": 96, - "column": 50 - } - } - }, - "loc": { - "start": { - "line": 96, - "column": 25 - }, - "end": { - "line": 96, - "column": 50 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 96, - "column": 21 - }, - "end": { - "line": 96, - "column": 51 - } - } - }, - { - "type": "IfStatement", - "test": { - "type": "BinaryExpression", - "operator": "<", - "left": { - "type": "Identifier", - "name": "r", - "decorators": [], - "loc": { - "start": { - "line": 97, - "column": 25 - }, - "end": { - "line": 97, - "column": 26 - } - } - }, - "right": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "entry", - "decorators": [], - "loc": { - "start": { - "line": 97, - "column": 29 - }, - "end": { - "line": 97, - "column": 34 - } - } - }, - "property": { - "type": "Identifier", - "name": "getValue", - "decorators": [], - "loc": { - "start": { - "line": 97, - "column": 35 - }, - "end": { - "line": 97, - "column": 43 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 97, - "column": 29 - }, - "end": { - "line": 97, - "column": 43 - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 97, - "column": 29 - }, - "end": { - "line": 97, - "column": 45 - } - } - }, - "loc": { - "start": { - "line": 97, - "column": 25 - }, - "end": { - "line": 97, - "column": 45 - } - } - }, - "consequent": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "line", - "decorators": [], - "loc": { - "start": { - "line": 98, - "column": 25 - }, - "end": { - "line": 98, - "column": 29 - } - } - }, - "property": { - "type": "Identifier", - "name": "i", - "decorators": [], - "loc": { - "start": { - "line": 98, - "column": 30 - }, - "end": { - "line": 98, - "column": 31 - } - } - }, - "computed": true, - "optional": false, - "loc": { - "start": { - "line": 98, - "column": 25 - }, - "end": { - "line": 98, - "column": 32 - } - } - }, - "right": { - "type": "Identifier", - "name": "c", - "decorators": [], - "loc": { - "start": { - "line": 98, - "column": 35 - }, - "end": { - "line": 98, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 98, - "column": 25 - }, - "end": { - "line": 98, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 98, - "column": 25 - }, - "end": { - "line": 98, - "column": 37 - } - } - }, - { - "type": "BreakStatement", - "label": null, - "loc": { - "start": { - "line": 99, - "column": 25 - }, - "end": { - "line": 99, - "column": 31 - } - } - } - ], - "loc": { - "start": { - "line": 97, - "column": 47 - }, - "end": { - "line": 100, - "column": 22 - } - } - }, - "alternate": null, - "loc": { - "start": { - "line": 97, - "column": 21 - }, - "end": { - "line": 100, - "column": 22 - } - } - } - ], - "loc": { - "start": { - "line": 95, - "column": 82 - }, - "end": { - "line": 101, - "column": 18 - } - } - }, - "loc": { - "start": { - "line": 95, - "column": 17 - }, - "end": { - "line": 101, - "column": 18 - } - } - } - ], - "loc": { - "start": { - "line": 93, - "column": 57 - }, - "end": { - "line": 102, - "column": 14 - } - } - }, - "loc": { - "start": { - "line": 93, - "column": 13 - }, - "end": { - "line": 102, - "column": 14 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "+=", - "left": { - "type": "Identifier", - "name": "ret", - "decorators": [], - "loc": { - "start": { - "line": 103, - "column": 13 - }, - "end": { - "line": 103, - "column": 16 - } - } - }, - "right": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "String", - "decorators": [], - "loc": { - "start": { - "line": 103, - "column": 24 - }, - "end": { - "line": 103, - "column": 30 - } - } - }, - "loc": { - "start": { - "line": 103, - "column": 24 - }, - "end": { - "line": 103, - "column": 31 - } - } - }, - "loc": { - "start": { - "line": 103, - "column": 24 - }, - "end": { - "line": 103, - "column": 31 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "line", - "decorators": [], - "loc": { - "start": { - "line": 103, - "column": 31 - }, - "end": { - "line": 103, - "column": 35 - } - } - } - ], - "loc": { - "start": { - "line": 103, - "column": 20 - }, - "end": { - "line": 103, - "column": 37 - } - } - }, - "property": { - "type": "Identifier", - "name": "length", - "decorators": [], - "loc": { - "start": { - "line": 103, - "column": 37 - }, - "end": { - "line": 103, - "column": 43 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 103, - "column": 20 - }, - "end": { - "line": 103, - "column": 43 - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 103, - "column": 20 - }, - "end": { - "line": 103, - "column": 45 - } - } - }, - "loc": { - "start": { - "line": 103, - "column": 13 - }, - "end": { - "line": 103, - "column": 45 - } - } - }, - "loc": { - "start": { - "line": 103, - "column": 13 - }, - "end": { - "line": 103, - "column": 46 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "-=", - "left": { - "type": "Identifier", - "name": "n", - "decorators": [], - "loc": { - "start": { - "line": 104, - "column": 13 - }, - "end": { - "line": 104, - "column": 14 - } - } - }, - "right": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "line", - "decorators": [], - "loc": { - "start": { - "line": 104, - "column": 18 - }, - "end": { - "line": 104, - "column": 22 - } - } - }, - "property": { - "type": "Identifier", - "name": "length", - "decorators": [], - "loc": { - "start": { - "line": 104, - "column": 23 - }, - "end": { - "line": 104, - "column": 29 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 104, - "column": 18 - }, - "end": { - "line": 104, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 104, - "column": 13 - }, - "end": { - "line": 104, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 104, - "column": 13 - }, - "end": { - "line": 104, - "column": 30 - } - } - } - ], - "loc": { - "start": { - "line": 89, - "column": 9 - }, - "end": { - "line": 105, - "column": 10 - } - } - }, - "loc": { - "start": { - "line": 88, - "column": 9 - }, - "end": { - "line": 105, - "column": 10 - } - } - }, - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "ret", - "decorators": [], - "loc": { - "start": { - "line": 106, - "column": 16 - }, - "end": { - "line": 106, - "column": 19 - } - } - }, - "loc": { - "start": { - "line": 106, - "column": 9 - }, - "end": { - "line": 106, - "column": 20 - } - } - } - ], - "loc": { - "start": { - "line": 84, - "column": 69 - }, - "end": { - "line": 107, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 84, - "column": 23 - }, - "end": { - "line": 107, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 84, - "column": 23 - }, - "end": { - "line": 107, - "column": 6 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 84, - "column": 5 - }, - "end": { - "line": 107, - "column": 6 - } - } - }, - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "count", - "decorators": [], - "loc": { - "start": { - "line": 108, - "column": 5 - }, - "end": { - "line": 108, - "column": 10 - } - } - }, - "value": { - "type": "NumberLiteral", - "value": 7, - "loc": { - "start": { - "line": 108, - "column": 19 - }, - "end": { - "line": 108, - "column": 20 - } - } - }, - "accessibility": "public", - "static": false, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 108, - "column": 13 - }, - "end": { - "line": 108, - "column": 16 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "expected", - "decorators": [], - "loc": { - "start": { - "line": 109, - "column": 21 - }, - "end": { - "line": 109, - "column": 29 - } - } - }, - "value": { - "type": "NumberLiteral", - "value": 1456000, - "loc": { - "start": { - "line": 109, - "column": 38 - }, - "end": { - "line": 109, - "column": 45 - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 109, - "column": 32 - }, - "end": { - "line": 109, - "column": 35 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "run", - "decorators": [], - "loc": { - "start": { - "line": 110, - "column": 17 - }, - "end": { - "line": 110, - "column": 20 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "run", - "decorators": [], - "loc": { - "start": { - "line": 110, - "column": 17 - }, - "end": { - "line": 110, - "column": 20 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 110, - "column": 24 - }, - "end": { - "line": 110, - "column": 28 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "ret", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 111, - "column": 19 - }, - "end": { - "line": 111, - "column": 22 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 111, - "column": 13 - }, - "end": { - "line": 111, - "column": 16 - } - } - }, - "init": { - "type": "NumberLiteral", - "value": 0, - "loc": { - "start": { - "line": 111, - "column": 25 - }, - "end": { - "line": 111, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 111, - "column": 13 - }, - "end": { - "line": 111, - "column": 26 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 111, - "column": 9 - }, - "end": { - "line": 111, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "+=", - "left": { - "type": "Identifier", - "name": "ret", - "decorators": [], - "loc": { - "start": { - "line": 112, - "column": 9 - }, - "end": { - "line": 112, - "column": 12 - } - } - }, - "right": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "fastaRepeat", - "decorators": [], - "loc": { - "start": { - "line": 112, - "column": 16 - }, - "end": { - "line": 112, - "column": 27 - } - } - }, - "arguments": [ - { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "NumberLiteral", - "value": 2, - "loc": { - "start": { - "line": 112, - "column": 28 - }, - "end": { - "line": 112, - "column": 29 - } - } - }, - "right": { - "type": "Identifier", - "name": "count", - "decorators": [], - "loc": { - "start": { - "line": 112, - "column": 32 - }, - "end": { - "line": 112, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 112, - "column": 28 - }, - "end": { - "line": 112, - "column": 37 - } - } - }, - "right": { - "type": "NumberLiteral", - "value": 100000, - "loc": { - "start": { - "line": 112, - "column": 40 - }, - "end": { - "line": 112, - "column": 46 - } - } - }, - "loc": { - "start": { - "line": 112, - "column": 28 - }, - "end": { - "line": 112, - "column": 46 - } - } - }, - { - "type": "Identifier", - "name": "ALU", - "decorators": [], - "loc": { - "start": { - "line": 112, - "column": 48 - }, - "end": { - "line": 112, - "column": 51 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 112, - "column": 16 - }, - "end": { - "line": 112, - "column": 52 - } - } - }, - "loc": { - "start": { - "line": 112, - "column": 9 - }, - "end": { - "line": 112, - "column": 52 - } - } - }, - "loc": { - "start": { - "line": 112, - "column": 9 - }, - "end": { - "line": 112, - "column": 53 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "+=", - "left": { - "type": "Identifier", - "name": "ret", - "decorators": [], - "loc": { - "start": { - "line": 113, - "column": 9 - }, - "end": { - "line": 113, - "column": 12 - } - } - }, - "right": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "fastaRandom", - "decorators": [], - "loc": { - "start": { - "line": 113, - "column": 16 - }, - "end": { - "line": 113, - "column": 27 - } - } - }, - "arguments": [ - { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "NumberLiteral", - "value": 3, - "loc": { - "start": { - "line": 113, - "column": 28 - }, - "end": { - "line": 113, - "column": 29 - } - } - }, - "right": { - "type": "Identifier", - "name": "count", - "decorators": [], - "loc": { - "start": { - "line": 113, - "column": 32 - }, - "end": { - "line": 113, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 113, - "column": 28 - }, - "end": { - "line": 113, - "column": 37 - } - } - }, - "right": { - "type": "NumberLiteral", - "value": 1000, - "loc": { - "start": { - "line": 113, - "column": 40 - }, - "end": { - "line": 113, - "column": 44 - } - } - }, - "loc": { - "start": { - "line": 113, - "column": 28 - }, - "end": { - "line": 113, - "column": 44 - } - } - }, - { - "type": "Identifier", - "name": "IUB", - "decorators": [], - "loc": { - "start": { - "line": 113, - "column": 46 - }, - "end": { - "line": 113, - "column": 49 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 113, - "column": 16 - }, - "end": { - "line": 113, - "column": 50 - } - } - }, - "loc": { - "start": { - "line": 113, - "column": 9 - }, - "end": { - "line": 113, - "column": 50 - } - } - }, - "loc": { - "start": { - "line": 113, - "column": 9 - }, - "end": { - "line": 113, - "column": 51 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "+=", - "left": { - "type": "Identifier", - "name": "ret", - "decorators": [], - "loc": { - "start": { - "line": 114, - "column": 9 - }, - "end": { - "line": 114, - "column": 12 - } - } - }, - "right": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "fastaRandom", - "decorators": [], - "loc": { - "start": { - "line": 114, - "column": 16 - }, - "end": { - "line": 114, - "column": 27 - } - } - }, - "arguments": [ - { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "NumberLiteral", - "value": 5, - "loc": { - "start": { - "line": 114, - "column": 28 - }, - "end": { - "line": 114, - "column": 29 - } - } - }, - "right": { - "type": "Identifier", - "name": "count", - "decorators": [], - "loc": { - "start": { - "line": 114, - "column": 32 - }, - "end": { - "line": 114, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 114, - "column": 28 - }, - "end": { - "line": 114, - "column": 37 - } - } - }, - "right": { - "type": "NumberLiteral", - "value": 1000, - "loc": { - "start": { - "line": 114, - "column": 40 - }, - "end": { - "line": 114, - "column": 44 - } - } - }, - "loc": { - "start": { - "line": 114, - "column": 28 - }, - "end": { - "line": 114, - "column": 44 - } - } - }, - { - "type": "Identifier", - "name": "HomoSap", - "decorators": [], - "loc": { - "start": { - "line": 114, - "column": 46 - }, - "end": { - "line": 114, - "column": 53 - } - } - } - ], - "optional": false, - "loc": { - "start": { - "line": 114, - "column": 16 - }, - "end": { - "line": 114, - "column": 54 - } - } - }, - "loc": { - "start": { - "line": 114, - "column": 9 - }, - "end": { - "line": 114, - "column": 54 - } - } - }, - "loc": { - "start": { - "line": 114, - "column": 9 - }, - "end": { - "line": 114, - "column": 55 - } - } - }, - { - "type": "AssertStatement", - "test": { - "type": "BinaryExpression", - "operator": "==", - "left": { - "type": "Identifier", - "name": "ret", - "decorators": [], - "loc": { - "start": { - "line": 116, - "column": 16 - }, - "end": { - "line": 116, - "column": 19 - } - } - }, - "right": { - "type": "MemberExpression", - "object": { - "type": "ThisExpression", - "loc": { - "start": { - "line": 116, - "column": 23 - }, - "end": { - "line": 116, - "column": 27 - } - } - }, - "property": { - "type": "Identifier", - "name": "expected", - "decorators": [], - "loc": { - "start": { - "line": 116, - "column": 28 - }, - "end": { - "line": 116, - "column": 36 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 116, - "column": 23 - }, - "end": { - "line": 116, - "column": 36 - } - } - }, - "loc": { - "start": { - "line": 116, - "column": 16 - }, - "end": { - "line": 116, - "column": 36 - } - } - }, - "second": { - "type": "StringLiteral", - "value": "Incorrect result", - "loc": { - "start": { - "line": 116, - "column": 38 - }, - "end": { - "line": 116, - "column": 56 - } - } - }, - "loc": { - "start": { - "line": 116, - "column": 9 - }, - "end": { - "line": 116, - "column": 57 - } - } - } - ], - "loc": { - "start": { - "line": 110, - "column": 29 - }, - "end": { - "line": 117, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 110, - "column": 20 - }, - "end": { - "line": 117, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 110, - "column": 20 - }, - "end": { - "line": 117, - "column": 6 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 110, - "column": 5 - }, - "end": { - "line": 117, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 118, - "column": 2 - }, - "end": { - "line": 118, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 32 - }, - "end": { - "line": 118, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 13 - }, - "end": { - "line": 118, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "main", - "decorators": [], - "loc": { - "start": { - "line": 120, - "column": 10 - }, - "end": { - "line": 120, - "column": 14 - } - } - }, - "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": 120, - "column": 10 - }, - "end": { - "line": 120, - "column": 14 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 120, - "column": 18 - }, - "end": { - "line": 120, - "column": 22 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 121, - "column": 7 - }, - "end": { - "line": 121, - "column": 8 - } - } - }, - "init": { - "type": "ETSNewClassInstanceExpression", - "typeReference": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "StringFasta", - "decorators": [], - "loc": { - "start": { - "line": 121, - "column": 15 - }, - "end": { - "line": 121, - "column": 26 - } - } - }, - "loc": { - "start": { - "line": 121, - "column": 15 - }, - "end": { - "line": 121, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 121, - "column": 15 - }, - "end": { - "line": 121, - "column": 27 - } - } - }, - "arguments": [], - "loc": { - "start": { - "line": 121, - "column": 11 - }, - "end": { - "line": 121, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 121, - "column": 7 - }, - "end": { - "line": 121, - "column": 27 - } - } - } - ], - "kind": "let", - "loc": { - "start": { - "line": 121, - "column": 3 - }, - "end": { - "line": 121, - "column": 27 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "a", - "decorators": [], - "loc": { - "start": { - "line": 122, - "column": 3 - }, - "end": { - "line": 122, - "column": 4 - } - } - }, - "property": { - "type": "Identifier", - "name": "run", - "decorators": [], - "loc": { - "start": { - "line": 122, - "column": 5 - }, - "end": { - "line": 122, - "column": 8 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 122, - "column": 3 - }, - "end": { - "line": 122, - "column": 8 - } - } - }, - "arguments": [], - "optional": false, - "loc": { - "start": { - "line": 122, - "column": 3 - }, - "end": { - "line": 122, - "column": 10 - } - } - }, - "loc": { - "start": { - "line": 122, - "column": 3 - }, - "end": { - "line": 122, - "column": 11 - } - } - } - ], - "loc": { - "start": { - "line": 120, - "column": 23 - }, - "end": { - "line": 123, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 120, - "column": 14 - }, - "end": { - "line": 123, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 120, - "column": 14 - }, - "end": { - "line": 123, - "column": 2 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 120, - "column": 1 - }, - "end": { - "line": 123, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 124, - "column": 1 - } - } -} -SyntaxError: Cannot find type 'HashMap'. [StringFasta.ets:18:46] +SyntaxError: Local type declaration (class, struct, interface and enum) support is not yet implemented. [StringFasta.ets:41:12] diff --git a/ets2panda/test/parser/ets/class_interface_enum_only_top_level_4-expected.txt b/ets2panda/test/parser/ets/class_interface_enum_only_top_level_4-expected.txt index 5c83602e3c..c64c5168b0 100644 --- a/ets2panda/test/parser/ets/class_interface_enum_only_top_level_4-expected.txt +++ b/ets2panda/test/parser/ets/class_interface_enum_only_top_level_4-expected.txt @@ -1 +1,441 @@ -SyntaxError: Local interface declaration support is not yet implemented. [class_interface_enum_only_top_level_4.ets:18:3] +{ + "type": "Program", + "statements": [ + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "main", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "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": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "returnType": { + "type": "ETSPrimitiveType", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 23 + } + } + }, + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "TSInterfaceDeclaration", + "body": { + "type": "TSInterfaceBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 8 + } + } + }, + "kind": "method", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 8 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [ + { + "type": "ETSParameterExpression", + "name": { + "type": "Identifier", + "name": "a", + "typeAnnotation": { + "type": "ETSPrimitiveType", + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 15 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 15 + } + } + }, + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 15 + } + } + } + ], + "returnType": { + "type": "ETSPrimitiveType", + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 19, + "column": 21 + } + } + }, + "declare": true, + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 21 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 22 + } + } + } + ], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 20, + "column": 4 + } + } + }, + "id": { + "type": "Identifier", + "name": "C", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 14 + } + } + }, + "extends": [], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 21, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 21, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 22, + "column": 1 + } + } +} diff --git a/ets2panda/test/parser/ets/class_property_access-expected.txt b/ets2panda/test/parser/ets/class_property_access-expected.txt index b10c7fcfb9..0d95692993 100644 --- a/ets2panda/test/parser/ets/class_property_access-expected.txt +++ b/ets2panda/test/parser/ets/class_property_access-expected.txt @@ -1,785 +1 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "outer", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 7 - }, - "end": { - "line": 16, - "column": 12 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 17, - "column": 10 - }, - "end": { - "line": 17, - "column": 13 - } - } - }, - "value": { - "type": "NumberLiteral", - "value": 1, - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 27 - } - } - }, - "accessibility": "public", - "static": true, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 17, - "column": 15 - }, - "end": { - "line": 17, - "column": 21 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "inner", - "decorators": [], - "loc": { - "start": { - "line": 18, - "column": 9 - }, - "end": { - "line": 18, - "column": 14 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "getFoo", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 5 - }, - "end": { - "line": 19, - "column": 11 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "getFoo", - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 5 - }, - "end": { - "line": 19, - "column": 11 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 19, - "column": 15 - }, - "end": { - "line": 19, - "column": 21 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ReturnStatement", - "argument": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "outer", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 16 - }, - "end": { - "line": 20, - "column": 21 - } - } - }, - "property": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 22 - }, - "end": { - "line": 20, - "column": 25 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 20, - "column": 16 - }, - "end": { - "line": 20, - "column": 25 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 9 - }, - "end": { - "line": 20, - "column": 26 - } - } - } - ], - "loc": { - "start": { - "line": 19, - "column": 22 - }, - "end": { - "line": 21, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 11 - }, - "end": { - "line": 21, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 19, - "column": 11 - }, - "end": { - "line": 21, - "column": 6 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 19, - "column": 5 - }, - "end": { - "line": 21, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "setFoo", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 5 - }, - "end": { - "line": 22, - "column": 11 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "setFoo", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 5 - }, - "end": { - "line": 22, - "column": 11 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [ - { - "type": "Identifier", - "name": "arg", - "typeAnnotation": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 22, - "column": 17 - }, - "end": { - "line": 22, - "column": 23 - } - } - }, - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 12 - }, - "end": { - "line": 22, - "column": 23 - } - } - } - ], - "returnType": { - "type": "ETSPrimitiveType", - "loc": { - "start": { - "line": 22, - "column": 26 - }, - "end": { - "line": 22, - "column": 30 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "MemberExpression", - "object": { - "type": "Identifier", - "name": "outer", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 14 - } - } - }, - "property": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 15 - }, - "end": { - "line": 23, - "column": 18 - } - } - }, - "computed": false, - "optional": false, - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 18 - } - } - }, - "right": { - "type": "Identifier", - "name": "arg", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 21 - }, - "end": { - "line": 23, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 24 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 25 - } - } - } - ], - "loc": { - "start": { - "line": 22, - "column": 31 - }, - "end": { - "line": 24, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 11 - }, - "end": { - "line": 24, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 11 - }, - "end": { - "line": 24, - "column": 6 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 5 - }, - "end": { - "line": 24, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 25, - "column": 4 - }, - "end": { - "line": 25, - "column": 4 - } - } - } - ], - "loc": { - "start": { - "line": 18, - "column": 15 - }, - "end": { - "line": 25, - "column": 4 - } - } - }, - "loc": { - "start": { - "line": 18, - "column": 3 - }, - "end": { - "line": 25, - "column": 4 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 2 - }, - "end": { - "line": 26, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 16, - "column": 13 - }, - "end": { - "line": 26, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 1 - }, - "end": { - "line": 26, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "body": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 27, - "column": 1 - } - } -} +SyntaxError: Local type declaration (class, struct, interface and enum) support is not yet implemented. [class_property_access.ets:18:3] diff --git a/ets2panda/test/parser/ets/declare_iface-expected.txt b/ets2panda/test/parser/ets/declare_iface-expected.txt index 22390e70af..fc771425b9 100644 --- a/ets2panda/test/parser/ets/declare_iface-expected.txt +++ b/ets2panda/test/parser/ets/declare_iface-expected.txt @@ -32,23 +32,23 @@ }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, @@ -97,23 +97,23 @@ }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, @@ -224,23 +224,23 @@ }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, @@ -289,23 +289,23 @@ }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, @@ -351,23 +351,23 @@ }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, @@ -470,23 +470,23 @@ }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, @@ -535,23 +535,23 @@ }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, @@ -597,23 +597,23 @@ }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, "loc": { "start": { - "line": 17, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 16 + "line": 1, + "column": 1 } } }, diff --git a/ets2panda/test/parser/ets/import_tests/import_recursive-expected.txt b/ets2panda/test/parser/ets/import_tests/import_recursive-expected.txt index 8d3a68b63a..737a20a76e 100755 --- a/ets2panda/test/parser/ets/import_tests/import_recursive-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/import_recursive-expected.txt @@ -1 +1,210 @@ -SyntaxError: Recursive import not allowed [subpackage_module_1.ets:18:1] +{ + "type": "Program", + "statements": [ + { + "type": "ImportDeclaration", + "source": { + "type": "StringLiteral", + "value": "import_tests/packages/recursive", + "loc": { + "start": { + "line": 16, + "column": 15 + }, + "end": { + "line": 16, + "column": 48 + } + } + }, + "specifiers": [ + { + "type": "ImportNamespaceSpecifier", + "local": { + "type": "Identifier", + "name": "", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 14 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 49 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 17, + "column": 1 + } + } +} diff --git a/ets2panda/test/parser/ets/import_tests/packages/recursive/subpackage/subpackage_module_1-expected.txt b/ets2panda/test/parser/ets/import_tests/packages/recursive/subpackage/subpackage_module_1-expected.txt index 8d3a68b63a..700e1ee2c7 100755 --- a/ets2panda/test/parser/ets/import_tests/packages/recursive/subpackage/subpackage_module_1-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/packages/recursive/subpackage/subpackage_module_1-expected.txt @@ -1 +1,319 @@ -SyntaxError: Recursive import not allowed [subpackage_module_1.ets:18:1] +{ + "type": "Program", + "statements": [ + { + "type": "ETSPackageDeclaration", + "name": { + "type": "TSQualifiedName", + "left": { + "type": "TSQualifiedName", + "left": { + "type": "TSQualifiedName", + "left": { + "type": "Identifier", + "name": "import_tests", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 21 + } + } + }, + "right": { + "type": "Identifier", + "name": "packages", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 22 + }, + "end": { + "line": 16, + "column": 30 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 30 + } + } + }, + "right": { + "type": "Identifier", + "name": "recursive", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 31 + }, + "end": { + "line": 16, + "column": 40 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 40 + } + } + }, + "right": { + "type": "Identifier", + "name": "subpackage", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 41 + }, + "end": { + "line": 16, + "column": 51 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 52 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 52 + } + } + }, + { + "type": "ImportDeclaration", + "source": { + "type": "StringLiteral", + "value": "import_tests/packages/recursive", + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 48 + } + } + }, + "specifiers": [ + { + "type": "ImportNamespaceSpecifier", + "local": { + "type": "Identifier", + "name": "", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 14 + } + } + } + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 49 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "ClassProperty", + "key": { + "type": "Identifier", + "name": "b", + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 13 + } + } + }, + "value": { + "type": "StringLiteral", + "value": "hello", + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 31 + } + } + }, + "accessibility": "public", + "static": true, + "readonly": false, + "declare": false, + "optional": false, + "computed": false, + "typeAnnotation": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 23 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 23 + } + } + }, + "definite": false, + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 31 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 21, + "column": 1 + } + } +} diff --git a/ets2panda/test/parser/ets/import_tests/packages/recursive/subpackage_module_1-expected.txt b/ets2panda/test/parser/ets/import_tests/packages/recursive/subpackage_module_1-expected.txt index 8d3a68b63a..3bc4bcc1f0 100755 --- a/ets2panda/test/parser/ets/import_tests/packages/recursive/subpackage_module_1-expected.txt +++ b/ets2panda/test/parser/ets/import_tests/packages/recursive/subpackage_module_1-expected.txt @@ -1 +1,291 @@ -SyntaxError: Recursive import not allowed [subpackage_module_1.ets:18:1] +{ + "type": "Program", + "statements": [ + { + "type": "ETSPackageDeclaration", + "name": { + "type": "TSQualifiedName", + "left": { + "type": "TSQualifiedName", + "left": { + "type": "Identifier", + "name": "import_tests", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 21 + } + } + }, + "right": { + "type": "Identifier", + "name": "packages", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 22 + }, + "end": { + "line": 16, + "column": 30 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 30 + } + } + }, + "right": { + "type": "Identifier", + "name": "recursive", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 31 + }, + "end": { + "line": 16, + "column": 40 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 41 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 41 + } + } + }, + { + "type": "ImportDeclaration", + "source": { + "type": "StringLiteral", + "value": "import_tests/packages/recursive/subpackage", + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 59 + } + } + }, + "specifiers": [ + { + "type": "ImportNamespaceSpecifier", + "local": { + "type": "Identifier", + "name": "", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 14 + } + } + } + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 60 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "ClassProperty", + "key": { + "type": "Identifier", + "name": "a", + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 13 + } + } + }, + "value": { + "type": "StringLiteral", + "value": "hello", + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 31 + } + } + }, + "accessibility": "public", + "static": true, + "readonly": false, + "declare": false, + "optional": false, + "computed": false, + "typeAnnotation": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 21 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 23 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 23 + } + } + }, + "definite": false, + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 31 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 21, + "column": 1 + } + } +} diff --git a/ets2panda/test/parser/ets/interfaces-expected.txt b/ets2panda/test/parser/ets/interfaces-expected.txt index 4c33267a11..ea68d0b006 100644 --- a/ets2panda/test/parser/ets/interfaces-expected.txt +++ b/ets2panda/test/parser/ets/interfaces-expected.txt @@ -15,12 +15,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 17, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 11 + "line": 1, + "column": 1 } } }, @@ -52,12 +52,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 17, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 11 + "line": 1, + "column": 1 } } }, @@ -123,12 +123,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 17, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 11 + "line": 1, + "column": 1 } } }, @@ -160,12 +160,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 17, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 11 + "line": 1, + "column": 1 } } }, @@ -194,12 +194,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 17, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 11 + "line": 1, + "column": 1 } } }, @@ -285,12 +285,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 17, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 11 + "line": 1, + "column": 1 } } }, @@ -322,12 +322,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 17, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 11 + "line": 1, + "column": 1 } } }, @@ -356,12 +356,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 17, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 17, - "column": 11 + "line": 1, + "column": 1 } } }, @@ -434,12 +434,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 18, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 18, - "column": 11 + "line": 1, + "column": 1 } } }, @@ -471,12 +471,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 18, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 18, - "column": 11 + "line": 1, + "column": 1 } } }, @@ -542,12 +542,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 18, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 18, - "column": 11 + "line": 1, + "column": 1 } } }, @@ -579,12 +579,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 18, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 18, - "column": 11 + "line": 1, + "column": 1 } } }, @@ -613,12 +613,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 18, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 18, - "column": 11 + "line": 1, + "column": 1 } } }, @@ -704,12 +704,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 18, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 18, - "column": 11 + "line": 1, + "column": 1 } } }, @@ -741,12 +741,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 18, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 18, - "column": 11 + "line": 1, + "column": 1 } } }, @@ -775,12 +775,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 18, - "column": 8 + "line": 1, + "column": 1 }, "end": { - "line": 18, - "column": 11 + "line": 1, + "column": 1 } } }, diff --git a/ets2panda/test/parser/ets/local-class-access-modifier-private-expected.txt b/ets2panda/test/parser/ets/local-class-access-modifier-private-expected.txt new file mode 100644 index 0000000000..e56659bd52 --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-access-modifier-private-expected.txt @@ -0,0 +1 @@ +SyntaxError: A local class or interface declaration can not have access modifier [local-class-access-modifier-private.ets:19:5] diff --git a/ets2panda/test/parser/ets/local-class-access-modifier-private.ets b/ets2panda/test/parser/ets/local-class-access-modifier-private.ets new file mode 100644 index 0000000000..ebe906434c --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-access-modifier-private.ets @@ -0,0 +1,22 @@ + +/* + * Copyright (c) 2021-2024 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() +{ + private class LocalClass + { + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-class-access-modifier-protected-expected.txt b/ets2panda/test/parser/ets/local-class-access-modifier-protected-expected.txt new file mode 100644 index 0000000000..ecb0378aa5 --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-access-modifier-protected-expected.txt @@ -0,0 +1 @@ +SyntaxError: A local class or interface declaration can not have access modifier [local-class-access-modifier-protected.ets:18:5] diff --git a/ets2panda/test/parser/ets/local-class-access-modifier-protected.ets b/ets2panda/test/parser/ets/local-class-access-modifier-protected.ets new file mode 100644 index 0000000000..566c817513 --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-access-modifier-protected.ets @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2021-2024 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() +{ + protected class LocalClass + { + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-class-access-modifier-public-expected.txt b/ets2panda/test/parser/ets/local-class-access-modifier-public-expected.txt new file mode 100644 index 0000000000..b8826e134b --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-access-modifier-public-expected.txt @@ -0,0 +1 @@ +SyntaxError: A local class or interface declaration can not have access modifier [local-class-access-modifier-public.ets:18:5] diff --git a/ets2panda/test/parser/ets/local-class-access-modifier-public.ets b/ets2panda/test/parser/ets/local-class-access-modifier-public.ets new file mode 100644 index 0000000000..58787a9afe --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-access-modifier-public.ets @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2021-2024 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() +{ + public class LocalClass + { + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-class-expected.txt b/ets2panda/test/parser/ets/local-class-expected.txt new file mode 100644 index 0000000000..f317ab4ea7 --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-expected.txt @@ -0,0 +1,425 @@ +{ + "type": "Program", + "statements": [ + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "main", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "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": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "returnType": { + "type": "ETSPrimitiveType", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 22 + } + } + }, + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "LocalClass", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "constructor", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 25 + }, + "end": { + "line": 18, + "column": 25 + } + } + } + ], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 25 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 25 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "NumberLiteral", + "value": 0, + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 13 + } + } + }, + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 14 + } + } + } + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 20, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 20, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 20, + "column": 2 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 20, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 20, + "column": 2 + } + } +} diff --git a/ets2panda/test/parser/ets/local-class-member-access-modifier-private1-expected.txt b/ets2panda/test/parser/ets/local-class-member-access-modifier-private1-expected.txt new file mode 100644 index 0000000000..a5a73903e0 --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-member-access-modifier-private1-expected.txt @@ -0,0 +1 @@ +SyntaxError: Local class declaration members can not have access modifies [local-class-member-access-modifier-private1.ets:20:9] diff --git a/ets2panda/test/parser/ets/local-class-member-access-modifier-private1.ets b/ets2panda/test/parser/ets/local-class-member-access-modifier-private1.ets new file mode 100644 index 0000000000..4842198e5e --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-member-access-modifier-private1.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021-2024 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() +{ + class LocalClass + { + private property : int; + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-class-member-access-modifier-private2-expected.txt b/ets2panda/test/parser/ets/local-class-member-access-modifier-private2-expected.txt new file mode 100644 index 0000000000..1794411ab8 --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-member-access-modifier-private2-expected.txt @@ -0,0 +1 @@ +SyntaxError: Local class declaration members can not have access modifies [local-class-member-access-modifier-private2.ets:20:9] diff --git a/ets2panda/test/parser/ets/local-class-member-access-modifier-private2.ets b/ets2panda/test/parser/ets/local-class-member-access-modifier-private2.ets new file mode 100644 index 0000000000..d076baa1a7 --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-member-access-modifier-private2.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021-2024 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() +{ + class LocalClass + { + private method() : void; + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-class-member-access-modifier-protected1-expected.txt b/ets2panda/test/parser/ets/local-class-member-access-modifier-protected1-expected.txt new file mode 100644 index 0000000000..cf37e0b470 --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-member-access-modifier-protected1-expected.txt @@ -0,0 +1 @@ +SyntaxError: Local class declaration members can not have access modifies [local-class-member-access-modifier-protected1.ets:20:9] diff --git a/ets2panda/test/parser/ets/local-class-member-access-modifier-protected1.ets b/ets2panda/test/parser/ets/local-class-member-access-modifier-protected1.ets new file mode 100644 index 0000000000..7c292c50dd --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-member-access-modifier-protected1.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021-2024 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() +{ + class LocalClass + { + protected property : int; + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-class-member-access-modifier-protected2-expected.txt b/ets2panda/test/parser/ets/local-class-member-access-modifier-protected2-expected.txt new file mode 100644 index 0000000000..e78b256b22 --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-member-access-modifier-protected2-expected.txt @@ -0,0 +1 @@ +SyntaxError: Local class declaration members can not have access modifies [local-class-member-access-modifier-protected2.ets:20:9] diff --git a/ets2panda/test/parser/ets/local-class-member-access-modifier-protected2.ets b/ets2panda/test/parser/ets/local-class-member-access-modifier-protected2.ets new file mode 100644 index 0000000000..d4334b411f --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-member-access-modifier-protected2.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021-2024 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() +{ + class LocalClass + { + protected method() : void; + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-class-member-access-modifier-public1-expected.txt b/ets2panda/test/parser/ets/local-class-member-access-modifier-public1-expected.txt new file mode 100644 index 0000000000..6e312819bb --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-member-access-modifier-public1-expected.txt @@ -0,0 +1 @@ +SyntaxError: Local class declaration members can not have access modifies [local-class-member-access-modifier-public1.ets:20:9] diff --git a/ets2panda/test/parser/ets/local-class-member-access-modifier-public1.ets b/ets2panda/test/parser/ets/local-class-member-access-modifier-public1.ets new file mode 100644 index 0000000000..1a4cf2c419 --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-member-access-modifier-public1.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021-2024 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() +{ + class LocalClass + { + public property : int; + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-class-member-access-modifier-public2-expected.txt b/ets2panda/test/parser/ets/local-class-member-access-modifier-public2-expected.txt new file mode 100644 index 0000000000..05bc52458a --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-member-access-modifier-public2-expected.txt @@ -0,0 +1 @@ +SyntaxError: Local class declaration members can not have access modifies [local-class-member-access-modifier-public2.ets:20:9] diff --git a/ets2panda/test/parser/ets/local-class-member-access-modifier-public2.ets b/ets2panda/test/parser/ets/local-class-member-access-modifier-public2.ets new file mode 100644 index 0000000000..57f75dbd3c --- /dev/null +++ b/ets2panda/test/parser/ets/local-class-member-access-modifier-public2.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021-2024 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() +{ + class LocalClass + { + public method() : void; + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-class.ets b/ets2panda/test/parser/ets/local-class.ets new file mode 100644 index 0000000000..52237f9168 --- /dev/null +++ b/ets2panda/test/parser/ets/local-class.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2021-2024 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 main() : int +{ + class LocalClass { } + return 0; +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-interface-access-modifier-private-expected.txt b/ets2panda/test/parser/ets/local-interface-access-modifier-private-expected.txt new file mode 100644 index 0000000000..b2b274ff4c --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-access-modifier-private-expected.txt @@ -0,0 +1 @@ +SyntaxError: A local class or interface declaration can not have access modifier [local-interface-access-modifier-private.ets:18:5] diff --git a/ets2panda/test/parser/ets/local-interface-access-modifier-private.ets b/ets2panda/test/parser/ets/local-interface-access-modifier-private.ets new file mode 100644 index 0000000000..ebb78d7e7f --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-access-modifier-private.ets @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2021-2024 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() +{ + private interface LocalInterface + { + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-interface-access-modifier-protected-expected.txt b/ets2panda/test/parser/ets/local-interface-access-modifier-protected-expected.txt new file mode 100644 index 0000000000..3b79eeef88 --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-access-modifier-protected-expected.txt @@ -0,0 +1 @@ +SyntaxError: A local class or interface declaration can not have access modifier [local-interface-access-modifier-protected.ets:18:5] diff --git a/ets2panda/test/parser/ets/local-interface-access-modifier-protected.ets b/ets2panda/test/parser/ets/local-interface-access-modifier-protected.ets new file mode 100644 index 0000000000..4820997507 --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-access-modifier-protected.ets @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2021-2024 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() +{ + protected interface LocalInterface + { + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-interface-access-modifier-public-expected.txt b/ets2panda/test/parser/ets/local-interface-access-modifier-public-expected.txt new file mode 100644 index 0000000000..1a1bef4653 --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-access-modifier-public-expected.txt @@ -0,0 +1 @@ +SyntaxError: A local class or interface declaration can not have access modifier [local-interface-access-modifier-public.ets:18:5] diff --git a/ets2panda/test/parser/ets/local-interface-access-modifier-public.ets b/ets2panda/test/parser/ets/local-interface-access-modifier-public.ets new file mode 100644 index 0000000000..b0b8d4d371 --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-access-modifier-public.ets @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2021-2024 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() +{ + public interface LocalInterface + { + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-interface-expected.txt b/ets2panda/test/parser/ets/local-interface-expected.txt new file mode 100644 index 0000000000..e01cce77f7 --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-expected.txt @@ -0,0 +1,331 @@ +{ + "type": "Program", + "statements": [ + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "main", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "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": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "returnType": { + "type": "ETSPrimitiveType", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 22 + } + } + }, + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "TSInterfaceDeclaration", + "body": { + "type": "TSInterfaceBody", + "body": [], + "loc": { + "start": { + "line": 18, + "column": 30 + }, + "end": { + "line": 18, + "column": 33 + } + } + }, + "id": { + "type": "Identifier", + "name": "LocalInterface", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "extends": [], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 19, + "column": 11 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "NumberLiteral", + "value": 0, + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 13 + } + } + }, + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 14 + } + } + } + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 20, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 20, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 20, + "column": 2 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 20, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 20, + "column": 2 + } + } +} diff --git a/ets2panda/test/parser/ets/local-interface-member-access-modifier-private1-expected.txt b/ets2panda/test/parser/ets/local-interface-member-access-modifier-private1-expected.txt new file mode 100644 index 0000000000..190c83aa9b --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-member-access-modifier-private1-expected.txt @@ -0,0 +1 @@ +SyntaxError: Local interface declaration members can not have access modifies [local-interface-member-access-modifier-private1.ets:20:9] diff --git a/ets2panda/test/parser/ets/local-interface-member-access-modifier-private1.ets b/ets2panda/test/parser/ets/local-interface-member-access-modifier-private1.ets new file mode 100644 index 0000000000..b772614d55 --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-member-access-modifier-private1.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021-2024 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() +{ + interface LocalInterface + { + private property : int; + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-interface-member-access-modifier-private2-expected.txt b/ets2panda/test/parser/ets/local-interface-member-access-modifier-private2-expected.txt new file mode 100644 index 0000000000..c10786f859 --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-member-access-modifier-private2-expected.txt @@ -0,0 +1 @@ +SyntaxError: Local interface declaration members can not have access modifies [local-interface-member-access-modifier-private2.ets:20:9] diff --git a/ets2panda/test/parser/ets/local-interface-member-access-modifier-private2.ets b/ets2panda/test/parser/ets/local-interface-member-access-modifier-private2.ets new file mode 100644 index 0000000000..fea47b8530 --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-member-access-modifier-private2.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021-2024 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() +{ + interface LocalInterface + { + private method() : void; + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-interface-member-access-modifier-protected1-expected.txt b/ets2panda/test/parser/ets/local-interface-member-access-modifier-protected1-expected.txt new file mode 100644 index 0000000000..c648044306 --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-member-access-modifier-protected1-expected.txt @@ -0,0 +1 @@ +SyntaxError: Local interface declaration members can not have access modifies [local-interface-member-access-modifier-protected1.ets:20:9] diff --git a/ets2panda/test/parser/ets/local-interface-member-access-modifier-protected1.ets b/ets2panda/test/parser/ets/local-interface-member-access-modifier-protected1.ets new file mode 100644 index 0000000000..4b239afd40 --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-member-access-modifier-protected1.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021-2024 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() +{ + interface LocalInterface + { + protected property : int; + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-interface-member-access-modifier-protected2-expected.txt b/ets2panda/test/parser/ets/local-interface-member-access-modifier-protected2-expected.txt new file mode 100644 index 0000000000..f245a63431 --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-member-access-modifier-protected2-expected.txt @@ -0,0 +1 @@ +SyntaxError: Local interface declaration members can not have access modifies [local-interface-member-access-modifier-protected2.ets:20:9] diff --git a/ets2panda/test/parser/ets/local-interface-member-access-modifier-protected2.ets b/ets2panda/test/parser/ets/local-interface-member-access-modifier-protected2.ets new file mode 100644 index 0000000000..11ff6ffd2b --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-member-access-modifier-protected2.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021-2024 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() +{ + interface LocalInterface + { + protected method() : void; + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-interface-member-access-modifier-public1-expected.txt b/ets2panda/test/parser/ets/local-interface-member-access-modifier-public1-expected.txt new file mode 100644 index 0000000000..984d6657ff --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-member-access-modifier-public1-expected.txt @@ -0,0 +1 @@ +SyntaxError: Local interface declaration members can not have access modifies [local-interface-member-access-modifier-public1.ets:20:9] diff --git a/ets2panda/test/parser/ets/local-interface-member-access-modifier-public1.ets b/ets2panda/test/parser/ets/local-interface-member-access-modifier-public1.ets new file mode 100644 index 0000000000..9d01a6df98 --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-member-access-modifier-public1.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021-2024 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() +{ + interface LocalInterface + { + public property : int; + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-interface-member-access-modifier-public2-expected.txt b/ets2panda/test/parser/ets/local-interface-member-access-modifier-public2-expected.txt new file mode 100644 index 0000000000..8f48cf7201 --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-member-access-modifier-public2-expected.txt @@ -0,0 +1 @@ +SyntaxError: Local interface declaration members can not have access modifies [local-interface-member-access-modifier-public2.ets:20:9] diff --git a/ets2panda/test/parser/ets/local-interface-member-access-modifier-public2.ets b/ets2panda/test/parser/ets/local-interface-member-access-modifier-public2.ets new file mode 100644 index 0000000000..26211d4f8c --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface-member-access-modifier-public2.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021-2024 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() +{ + interface LocalInterface + { + public method() : void; + } +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/local-interface.ets b/ets2panda/test/parser/ets/local-interface.ets new file mode 100644 index 0000000000..ba355d70cc --- /dev/null +++ b/ets2panda/test/parser/ets/local-interface.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2021-2024 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 main() : int +{ + interface LocalInterface { } + return 0; +} \ No newline at end of file diff --git a/ets2panda/test/parser/ets/localClassIsPermitted-expected.txt b/ets2panda/test/parser/ets/localClassIsPermitted-expected.txt index 2935597f31..bac179ba08 100644 --- a/ets2panda/test/parser/ets/localClassIsPermitted-expected.txt +++ b/ets2panda/test/parser/ets/localClassIsPermitted-expected.txt @@ -1 +1,500 @@ -SyntaxError: Illegal start of expression [localClassIsPermitted.ets:18:9] +{ + "type": "Program", + "statements": [ + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "Klass", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "ClassStaticBlock", + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": true, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "Local", + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "constructor", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 10 + } + } + } + ], + "loc": { + "start": { + "line": 18, + "column": 21 + }, + "end": { + "line": 20, + "column": 10 + } + } + }, + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 20, + "column": 10 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 6 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "constructor", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 23, + "column": 1 + } + } +} diff --git a/ets2panda/test/parser/ets/named_types-expected.txt b/ets2panda/test/parser/ets/named_types-expected.txt index a5c932661c..0080c199f0 100644 --- a/ets2panda/test/parser/ets/named_types-expected.txt +++ b/ets2panda/test/parser/ets/named_types-expected.txt @@ -1,1086 +1 @@ -{ - "type": "Program", - "statements": [ - { - "type": "ETSPackageDeclaration", - "name": { - "type": "TSQualifiedName", - "left": { - "type": "TSQualifiedName", - "left": { - "type": "TSQualifiedName", - "left": { - "type": "TSQualifiedName", - "left": { - "type": "Identifier", - "name": "com", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 9 - }, - "end": { - "line": 16, - "column": 12 - } - } - }, - "right": { - "type": "Identifier", - "name": "huawei", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 13 - }, - "end": { - "line": 16, - "column": 19 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 9 - }, - "end": { - "line": 16, - "column": 19 - } - } - }, - "right": { - "type": "Identifier", - "name": "migrationtool", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 20 - }, - "end": { - "line": 16, - "column": 33 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 9 - }, - "end": { - "line": 16, - "column": 33 - } - } - }, - "right": { - "type": "Identifier", - "name": "test", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 34 - }, - "end": { - "line": 16, - "column": 38 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 9 - }, - "end": { - "line": 16, - "column": 38 - } - } - }, - "right": { - "type": "Identifier", - "name": "ets", - "decorators": [], - "loc": { - "start": { - "line": 16, - "column": 39 - }, - "end": { - "line": 16, - "column": 42 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 9 - }, - "end": { - "line": 16, - "column": 43 - } - } - }, - "loc": { - "start": { - "line": 16, - "column": 1 - }, - "end": { - "line": 16, - "column": 43 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "named_types", - "decorators": [], - "loc": { - "start": { - "line": 20, - "column": 12 - }, - "end": { - "line": 20, - "column": 23 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassProperty", - "key": { - "type": "Identifier", - "name": "text", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 5 - }, - "end": { - "line": 21, - "column": 9 - } - } - }, - "accessibility": "public", - "static": false, - "readonly": false, - "declare": false, - "optional": false, - "computed": false, - "typeAnnotation": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "TSQualifiedName", - "left": { - "type": "TSQualifiedName", - "left": { - "type": "Identifier", - "name": "ets", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 12 - }, - "end": { - "line": 21, - "column": 15 - } - } - }, - "right": { - "type": "Identifier", - "name": "lang", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 16 - }, - "end": { - "line": 21, - "column": 20 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 12 - }, - "end": { - "line": 21, - "column": 20 - } - } - }, - "right": { - "type": "Identifier", - "name": "String", - "decorators": [], - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 27 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 12 - }, - "end": { - "line": 21, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 12 - }, - "end": { - "line": 21, - "column": 29 - } - } - }, - "loc": { - "start": { - "line": 21, - "column": 12 - }, - "end": { - "line": 21, - "column": 29 - } - } - }, - "definite": false, - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "inner", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 30 - }, - "end": { - "line": 22, - "column": 35 - } - } - }, - "typeParameters": { - "type": "TSTypeParameterDeclaration", - "params": [ - { - "type": "TSTypeParameter", - "name": { - "type": "Identifier", - "name": "T", - "decorators": [], - "loc": { - "start": { - "line": 22, - "column": 36 - }, - "end": { - "line": 22, - "column": 37 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 36 - }, - "end": { - "line": 22, - "column": 38 - } - } - } - ], - "loc": { - "start": { - "line": 22, - "column": 35 - }, - "end": { - "line": 22, - "column": 38 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "innertoo", - "decorators": [], - "loc": { - "start": { - "line": 23, - "column": 27 - }, - "end": { - "line": 23, - "column": 35 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 10 - } - } - } - ], - "loc": { - "start": { - "line": 23, - "column": 37 - }, - "end": { - "line": 24, - "column": 10 - } - } - }, - "loc": { - "start": { - "line": 23, - "column": 21 - }, - "end": { - "line": 24, - "column": 10 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 26, - "column": 6 - }, - "end": { - "line": 26, - "column": 6 - } - } - } - ], - "loc": { - "start": { - "line": 22, - "column": 39 - }, - "end": { - "line": 26, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 22, - "column": 24 - }, - "end": { - "line": 26, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 20, - "column": 25 - }, - "end": { - "line": 28, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 20, - "column": 6 - }, - "end": { - "line": 28, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "auxilliary", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 12 - }, - "end": { - "line": 30, - "column": 22 - } - } - }, - "superClass": null, - "implements": [], - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 17 - }, - "end": { - "line": 31, - "column": 20 - } - } - }, - "kind": "method", - "accessibility": "public", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "foo", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 17 - }, - "end": { - "line": 31, - "column": 20 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "TSQualifiedName", - "left": { - "type": "Identifier", - "name": "named_types", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 24 - }, - "end": { - "line": 31, - "column": 35 - } - } - }, - "right": { - "type": "Identifier", - "name": "inner", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 36 - }, - "end": { - "line": 31, - "column": 41 - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 24 - }, - "end": { - "line": 31, - "column": 43 - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 24 - }, - "end": { - "line": 31, - "column": 43 - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 24 - }, - "end": { - "line": 31, - "column": 43 - } - } - }, - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 31, - "column": 42 - }, - "end": { - "line": 32, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 20 - }, - "end": { - "line": 32, - "column": 6 - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 20 - }, - "end": { - "line": 32, - "column": 6 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 5 - }, - "end": { - "line": 32, - "column": 6 - } - } - }, - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "kind": "constructor", - "static": false, - "optional": false, - "computed": false, - "value": { - "type": "FunctionExpression", - "function": { - "type": "ScriptFunction", - "id": { - "type": "Identifier", - "name": "constructor", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "generator": false, - "async": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "statements": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "overloads": [], - "decorators": [], - "loc": { - "start": { - "line": 33, - "column": 2 - }, - "end": { - "line": 33, - "column": 2 - } - } - } - ], - "loc": { - "start": { - "line": 30, - "column": 24 - }, - "end": { - "line": 33, - "column": 2 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 6 - }, - "end": { - "line": 33, - "column": 2 - } - } - }, - { - "type": "ClassDeclaration", - "definition": { - "id": { - "type": "Identifier", - "name": "ETSGLOBAL", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "body": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 35, - "column": 1 - } - } -} -SyntaxError: Cannot find type 'ets'. [named_types.ets:21:12] +SyntaxError: Local type declaration (class, struct, interface and enum) support is not yet implemented. [named_types.ets:22:19] diff --git a/ets2panda/test/parser/ets/null-coalesc-negative-expected.txt b/ets2panda/test/parser/ets/null-coalesc-negative-expected.txt index aef2a178ed..c187e0df58 100644 --- a/ets2panda/test/parser/ets/null-coalesc-negative-expected.txt +++ b/ets2panda/test/parser/ets/null-coalesc-negative-expected.txt @@ -62,12 +62,12 @@ "decorators": [], "loc": { "start": { - "line": 1, - "column": 1 + "line": 17, + "column": 13 }, "end": { - "line": 1, - "column": 1 + "line": 17, + "column": 23 } } }, @@ -458,7 +458,35 @@ "expression": false, "params": [], "returnType": { - "type": "ETSPrimitiveType", + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "void", + "decorators": [], + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 22 + } + } + }, "loc": { "start": { "line": 24, @@ -466,7 +494,7 @@ }, "end": { "line": 24, - "column": 20 + "column": 22 } } }, @@ -905,6 +933,100 @@ "superClass": null, "implements": [], "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, { "type": "MethodDefinition", "key": { @@ -951,7 +1073,35 @@ "expression": false, "params": [], "returnType": { - "type": "ETSPrimitiveType", + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "void", + "decorators": [], + "loc": { + "start": { + "line": 32, + "column": 18 + }, + "end": { + "line": 32, + "column": 22 + } + } + }, + "loc": { + "start": { + "line": 32, + "column": 18 + }, + "end": { + "line": 32, + "column": 24 + } + } + }, "loc": { "start": { "line": 32, @@ -959,7 +1109,7 @@ }, "end": { "line": 32, - "column": 22 + "column": 24 } } }, diff --git a/ets2panda/test/parser/ets/test_interface-expected.txt b/ets2panda/test/parser/ets/test_interface-expected.txt index 47210d2f38..e4aaecfe08 100644 --- a/ets2panda/test/parser/ets/test_interface-expected.txt +++ b/ets2panda/test/parser/ets/test_interface-expected.txt @@ -155,12 +155,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 21, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 21, - "column": 12 + "line": 1, + "column": 1 } } }, @@ -192,12 +192,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 21, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 21, - "column": 12 + "line": 1, + "column": 1 } } }, @@ -263,12 +263,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 21, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 21, - "column": 12 + "line": 1, + "column": 1 } } }, @@ -300,12 +300,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 21, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 21, - "column": 12 + "line": 1, + "column": 1 } } }, @@ -334,12 +334,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 21, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 21, - "column": 12 + "line": 1, + "column": 1 } } }, @@ -425,12 +425,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 21, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 21, - "column": 12 + "line": 1, + "column": 1 } } }, @@ -462,12 +462,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 21, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 21, - "column": 12 + "line": 1, + "column": 1 } } }, @@ -496,12 +496,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 21, - "column": 9 + "line": 1, + "column": 1 }, "end": { - "line": 21, - "column": 12 + "line": 1, + "column": 1 } } }, @@ -574,12 +574,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 22, - "column": 10 + "line": 1, + "column": 1 }, "end": { - "line": 22, - "column": 16 + "line": 1, + "column": 1 } } }, @@ -611,12 +611,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 22, - "column": 10 + "line": 1, + "column": 1 }, "end": { - "line": 22, - "column": 16 + "line": 1, + "column": 1 } } }, @@ -682,12 +682,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 22, - "column": 10 + "line": 1, + "column": 1 }, "end": { - "line": 22, - "column": 16 + "line": 1, + "column": 1 } } }, @@ -719,12 +719,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 22, - "column": 10 + "line": 1, + "column": 1 }, "end": { - "line": 22, - "column": 16 + "line": 1, + "column": 1 } } }, @@ -753,12 +753,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 22, - "column": 10 + "line": 1, + "column": 1 }, "end": { - "line": 22, - "column": 16 + "line": 1, + "column": 1 } } }, @@ -844,12 +844,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 22, - "column": 10 + "line": 1, + "column": 1 }, "end": { - "line": 22, - "column": 16 + "line": 1, + "column": 1 } } }, @@ -881,12 +881,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 22, - "column": 10 + "line": 1, + "column": 1 }, "end": { - "line": 22, - "column": 16 + "line": 1, + "column": 1 } } }, @@ -915,12 +915,12 @@ "type": "ETSPrimitiveType", "loc": { "start": { - "line": 22, - "column": 10 + "line": 1, + "column": 1 }, "end": { - "line": 22, - "column": 16 + "line": 1, + "column": 1 } } }, diff --git a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_define_lambda_in_body_capture_variable-expected.txt b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_define_lambda_in_body_capture_variable-expected.txt index e69de29bb2..fe90d86434 100644 --- a/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_define_lambda_in_body_capture_variable-expected.txt +++ b/ets2panda/test/parser/ets/trailing_lambda_tests/trailing_lambda_define_lambda_in_body_capture_variable-expected.txt @@ -0,0 +1,595 @@ +{ + "type": "Program", + "statements": [ + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 13 + } + } + }, + "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 + }, + "end": { + "line": 16, + "column": 13 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [ + { + "type": "ETSParameterExpression", + "name": { + "type": "Identifier", + "name": "a0", + "typeAnnotation": { + "type": "ETSFunctionType", + "params": [], + "returnType": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "void", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 24 + }, + "end": { + "line": 16, + "column": 28 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 24 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 24 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 29 + } + } + } + ], + "returnType": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "void", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 31 + }, + "end": { + "line": 16, + "column": 35 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 31 + }, + "end": { + "line": 16, + "column": 37 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 31 + }, + "end": { + "line": 16, + "column": 37 + } + } + }, + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "a0", + "decorators": [], + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + "arguments": [], + "optional": false, + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 9 + } + } + }, + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 10 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 36 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "main", + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 14 + } + } + }, + "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 + }, + "end": { + "line": 20, + "column": 14 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "returnType": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "void", + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 22 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 24 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 24 + } + } + }, + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + "arguments": [], + "optional": false, + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 10 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 10 + } + } + } + ], + "loc": { + "start": { + "line": 20, + "column": 23 + }, + "end": { + "line": 28, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 14 + }, + "end": { + "line": 28, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 14 + }, + "end": { + "line": 28, + "column": 2 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 28, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 29, + "column": 1 + } + } +} diff --git a/ets2panda/test/runtime/ets/local-class-capture-boxing.ets b/ets2panda/test/runtime/ets/local-class-capture-boxing.ets new file mode 100644 index 0000000000..229e73d411 --- /dev/null +++ b/ets2panda/test/runtime/ets/local-class-capture-boxing.ets @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2021-2024 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 UserClassType +{ + v : int = 0; + constructor (p : int) + { + this.v = p; + } + + override toString() : string { + return Int.valueOf(this.v).toString(); + } +} + +enum UserEnumType +{ + Red, + Green, + Blue +}; + +let g_array : int [] = [1,2,3]; +let g_array2 : int [] = [11,12,13]; +let g_Array : Array = new Array(new Int(4), new Int(5), new Int(6)); +let g_Array2 : Array = new Array(new Int(14), new Int(15), new Int(16)); +let g_Object : Object = new Object(); +let g_Object2 : Object = new Object(); +let g_Class : UserClassType = new UserClassType(25); +let g_Class2 : UserClassType = new UserClassType(250); + + + +class GlobalClass +{ + static s_field : int = 13; + field : int = 14; + + static s_method_boxing_local_class() { + // predefined value types + let l_number : number = 1; + let l_byte : byte = 2; + let l_short : short = 3; + let l_int : int = 4; + let l_long : long = 5; + let l_float : float = 6.0; + let l_double : double = 7.0; + let l_boolean : boolean = false; + let l_char : char = c'x'; + + // user defined value types + let l_enum : UserEnumType = UserEnumType.Red; + + // predefined reference types + let l_Number : Number = new Number(11); + let l_Byte : Byte = new Byte(12 as byte); + let l_Short : Short = new Short(13 as short); + let l_Int : Int = new Int(14 as int); + let l_Long : Long = new Long(15 as long); + let l_Float : Float = new Float(16.0); + let l_Double : Double = new Double(17.0); + let l_Boolean: Boolean = new Boolean(false); + let l_Char : Char = new Char(c'X'); + + let l_string : string = "something"; + let l_String : String = new String("Something"); + let l_array : int [] = g_array; + let l_Array : Array = g_Array; + //let l_bigint : bigint = 20n; + //let l_BigInt : BigInt = new BigInt(21n); + let l_Object : Object = g_Object; + + // user defined reference types + let l_Class : UserClassType = g_Class; + + class LocalClassBoxing + { + local_field : int = 1000; + static local_s_field : int = 2000; + + static local_s_method(lp : int) : void + { + assert(lp == 300); + assert(LocalClassBoxing.local_s_field == 2000); + + LocalClassBoxing.local_s_field = 5000; + assert(LocalClassBoxing.local_s_field == 5000); + } + + local_method(lp : int) : void + { + // Parameter + assert(lp == 400); + // Local class object field + assert(this.local_field == 1000); + // Local class static field + assert(LocalClassBoxing.local_s_field == 5000); + // Outer class static field + assert(GlobalClass.s_field == 13); + // Predefined value types + assert(l_number == 1); + assert(l_byte == 2); + assert(l_short == 3); + assert(l_int == 4); + assert(l_long == 5); + assert(l_float == 6); + assert(l_double == 7); + assert(l_boolean == false); + assert(l_char == c'x'); + // User defined value type + assert(l_enum == UserEnumType.Red); + // Predefined reference types + assert(l_Number == Number.valueOf(11)); + assert(l_Byte == Byte.valueOf(12 as byte)); + assert(l_Short == Short.valueOf(13 as short)); + assert(l_Int == Int.valueOf(14 as int)); + assert(l_Long == Long.valueOf(15 as long)); + assert(l_Float == Float.valueOf(16 as float)); + assert(l_Double == Double.valueOf(17 as double)); + assert(l_Boolean == Boolean.valueOf(false)); + assert(l_Char == Char.valueOf(c'X')); + assert(l_string == "something"); + assert(l_String == "Something"); + // assert(l_array == g_array); + // assert(l_Array == g_Array); + assert(l_Object == g_Object); + assert(l_Class == g_Class); + + this.local_field = 1100; + LocalClassBoxing.local_s_field = 5100; + + l_number = 101; + l_byte = 102; + l_short = 103; + l_int = 104; + l_long = 105; + l_float = 106.0; + l_double = 107.0; + l_boolean = true; + l_char = c'y'; + //l_enum = UserEnumType.Green; + + l_Number = new Number(111); + l_Byte = new Byte(112 as byte); + l_Short = new Short(113 as short); + l_Int = new Int(114 as int); + l_Long = new Long(115 as long); + l_Float = new Float(116.0); + l_Double = new Double(117.0); + l_Boolean = new Boolean(true); + l_Char = new Char(c'Y'); + + l_string = "something new"; + l_String = new String("Something new"); + l_array = g_array2; + l_Array = g_Array2; + l_Object = g_Object2; + l_Class = g_Class2; + } + }; + LocalClassBoxing.local_s_field = 2000; // due to the jit loop + LocalClassBoxing.local_s_method(300); + + let lcb = new LocalClassBoxing(); + lcb.local_method(400); + + assert(lcb.local_field == 1100); + assert(LocalClassBoxing.local_s_field == 5100); + assert(l_number == 101); + assert(l_byte == 102); + assert(l_short == 103); + assert(l_int == 104); + assert(l_long == 105); + assert(l_float == 106); + assert(l_double == 107); + assert(l_boolean == true); + assert(l_char == c'y'); + + //assert(l_enum == UserEnumType.Green); + + // Predefined reference types + assert(l_Number == Number.valueOf(111)); + assert(l_Byte == Byte.valueOf(112 as byte)); + assert(l_Short == Short.valueOf(113 as short)); + assert(l_Int == Int.valueOf(114 as int)); + assert(l_Long == Long.valueOf(115 as long)); + assert(l_Float == Float.valueOf(116 as float)); + assert(l_Double == Double.valueOf(117 as double)); + assert(l_Boolean == Boolean.valueOf(true)); + assert(l_Char == Char.valueOf(c'Y')); + assert(l_string == "something new"); + assert(l_String == "Something new"); + //assert(l_array == g_array2); + //assert(l_Array == g_Array2); + assert(l_Object == g_Object2); + assert(l_Class == g_Class2); + } +} + + +function main() : int +{ + GlobalClass.s_method_boxing_local_class(); + return 0; +} diff --git a/ets2panda/test/runtime/ets/local-class-capture-not-boxing.ets b/ets2panda/test/runtime/ets/local-class-capture-not-boxing.ets new file mode 100644 index 0000000000..38c95a41fd --- /dev/null +++ b/ets2panda/test/runtime/ets/local-class-capture-not-boxing.ets @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2021-2024 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 UserClassType +{ + v : int = 0; + constructor (p : int) + { + this.v = p; + } + + override toString() : string { + return Int.valueOf(this.v).toString(); + } +} + +enum UserEnumType +{ + Red, + Green, + Blue +}; + +let g_array : int [] = [1,2,3]; +let g_array2 : int [] = [11,12,13]; +let g_Array : Array = new Array(new Int(4), new Int(5), new Int(6)); +let g_Array2 : Array = new Array(new Int(14), new Int(15), new Int(16)); +let g_Object : Object = new Object(); +let g_Object2 : Object = new Object(); +let g_Class : UserClassType = new UserClassType(25); +let g_Class2 : UserClassType = new UserClassType(250); + + + +class GlobalClass +{ + static s_field : int = 13; + field : int = 14; + + static s_method_not_boxing_local_class() { + // predefined value types + let l_number : number = 1; + let l_byte : byte = 2; + let l_short : short = 3; + let l_int : int = 4; + let l_long : long = 5; + let l_float : float = 6.0; + let l_double : double = 7.0; + let l_boolean : boolean = false; + let l_char : char = c'x'; + + // user defined value types + let l_enum : UserEnumType = UserEnumType.Red; + + // predefined reference types + let l_Number : Number = new Number(11); + let l_Byte : Byte = new Byte(12 as byte); + let l_Short : Short = new Short(13 as short); + let l_Int : Int = new Int(14 as int); + let l_Long : Long = new Long(15 as long); + let l_Float : Float = new Float(16.0); + let l_Double : Double = new Double(17.0); + let l_Boolean: Boolean = new Boolean(false); + let l_Char : Char = new Char(c'X'); + + let l_string : string = "something"; + let l_String : String = new String("Something"); + let l_array : int [] = g_array; + let l_Array : Array = g_Array; + //let l_bigint : bigint = 20n; + //let l_BigInt : BigInt = new BigInt(21n); + let l_Object : Object = g_Object; + + // user defined reference types + let l_Class : UserClassType = g_Class; + + class LocalClassNotBoxing + { + local_field : int = 100; + static local_s_field : int = 200; + + static local_s_method(lp : int) : void + { + assert(lp == 30); + assert(LocalClassNotBoxing.local_s_field == 200); + } + + local_method(lp : int) : void + { + // Parameter + assert(lp == 40); + // Local class object field + assert(this.local_field == 100); + // Local class static field + assert(LocalClassNotBoxing.local_s_field == 200); + // Predefined value types + assert(l_number == 1); + assert(l_byte == 2); + assert(l_short == 3); + assert(l_int == 4); + assert(l_long == 5); + assert(l_float == 6); + assert(l_double == 7); + assert(l_boolean == false); + assert(l_char == c'x'); + // User defined value type + assert(l_enum == UserEnumType.Red); + // Predefined reference types + assert(l_Number == Number.valueOf(11)); + assert(l_Byte == Byte.valueOf(12 as byte)); + assert(l_Short == Short.valueOf(13 as short)); + assert(l_Int == Int.valueOf(14 as int)); + assert(l_Long == Long.valueOf(15 as long)); + assert(l_Float == Float.valueOf(16 as float)); + assert(l_Double == Double.valueOf(17 as double)); + assert(l_Boolean == Boolean.valueOf(false)); + assert(l_Char == Char.valueOf(c'X')); + assert(l_string == "something"); + assert(l_String == "Something"); + assert(l_array == g_array); + assert(l_Array == g_Array); + assert(l_Object == g_Object); + assert(l_Class == g_Class); + } + }; + + LocalClassNotBoxing.local_s_method(30); + + let lc = new LocalClassNotBoxing(); + lc.local_method(40); + } +} + + +function main() : int +{ + GlobalClass.s_method_not_boxing_local_class(); + return 0; +} diff --git a/ets2panda/test/runtime/ets/local-class-capture-parameter.ets b/ets2panda/test/runtime/ets/local-class-capture-parameter.ets new file mode 100644 index 0000000000..048ee9ee37 --- /dev/null +++ b/ets2panda/test/runtime/ets/local-class-capture-parameter.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2021-2024 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 GlobalClass +{ + static capture_param_method(param : int) + { + class LocalClass + { + method() + { + assert(param == 1) + } + } + + let lc = new LocalClass(); + lc.method() + } +} + +function main() : int +{ + GlobalClass.capture_param_method(1); + + return 0; +} diff --git a/ets2panda/test/runtime/ets/local-class-in-local-class.ets b/ets2panda/test/runtime/ets/local-class-in-local-class.ets new file mode 100644 index 0000000000..274c8dc669 --- /dev/null +++ b/ets2panda/test/runtime/ets/local-class-in-local-class.ets @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021-2024 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 main() : int +{ + let l_int = 0; + + class LocalClassLevel1 + { + m_int1 = 11; + + method1() + { + let l_int2 = 12; + assert(this.m_int1 == 11); + assert(l_int == 0); + l_int = 1; + + class LocalClassLevel2 + { + m_int2 : int = 22; + + method2() { + assert(this.m_int2 == 22); + assert(l_int2 == 12); + l_int2 = 13; + } + } + + let lcl2 = new LocalClassLevel2(); + lcl2.method2(); + assert(l_int2 == 13) + } + } + + let lcl1 = new LocalClassLevel1(); + lcl1.method1(); + assert(l_int == 1); + + return 0; +} diff --git a/ets2panda/test/runtime/ets/local-class-mixed-capture.ets b/ets2panda/test/runtime/ets/local-class-mixed-capture.ets new file mode 100644 index 0000000000..c23219be11 --- /dev/null +++ b/ets2panda/test/runtime/ets/local-class-mixed-capture.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2021-2024 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 main() : int +{ + // Since the BoxingLocalClass modifies the 'i' it has to be boxed and use it as a boxed + // variable in the NotBoxingLocalClass too + let i : int = 1; + + class NotBoxingLocalClass + { + local_method() + { + assert(i == 1); + } + } + + class BoxingLocalClass + { + local_method() + { + assert(i == 1) + i = 2; + } + } + + let nblc = new NotBoxingLocalClass(); + nblc.local_method(); + + let blc = new BoxingLocalClass(); + blc.local_method(); + assert(i == 2); + return 0; +} diff --git a/ets2panda/test/runtime/ets/local-class-modify-captured-parameter.ets b/ets2panda/test/runtime/ets/local-class-modify-captured-parameter.ets new file mode 100644 index 0000000000..d4c1565317 --- /dev/null +++ b/ets2panda/test/runtime/ets/local-class-modify-captured-parameter.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2021-2024 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 GlobalClass +{ + static capture_param_method(param : int) + { + class LocalClass + { + method() + { + assert(param == 1) + param = 3; + } + } + + let lc = new LocalClass(); + lc.method() + assert(param == 3); + } +} + +function main() : int +{ + GlobalClass.capture_param_method(1); + + return 0; +} diff --git a/ets2panda/test/runtime/ets/local-class-standard-example1.ets b/ets2panda/test/runtime/ets/local-class-standard-example1.ets new file mode 100644 index 0000000000..eb561768ec --- /dev/null +++ b/ets2panda/test/runtime/ets/local-class-standard-example1.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2021-2024 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 (parameter: number) { + let local: string = "function local"; + interface LocalInterface { // Local interface in a top-level function + method (): void; // It has a method + field: string; // and a property + } + class LocalClass implements LocalInterface { // Class implements interface + // Local class in a top-level function + override method () { + console.log ("Instance field = " + this.field + " par = " + parameter + " loc = " + local ) + assert(this.field == "`instance field value`") + assert(parameter == 42) + assert(local == "function local") + } + field: string = "`instance field value`" + static s_method () { + console.log ("Static field = " + LocalClass.s_field) + assert(LocalClass.s_field == "`class/static field value`") + + } + static s_field: string = "`class/static field value`" + } + + let lc: LocalInterface = new LocalClass(); + // Both local types can be freely used in the top-level function scope + lc.method() + LocalClass.s_method() +} + +function main() : int +{ + foo(42); + return 0; +} diff --git a/ets2panda/test/runtime/ets/local-class-standard-example2.ets b/ets2panda/test/runtime/ets/local-class-standard-example2.ets new file mode 100644 index 0000000000..de257c768d --- /dev/null +++ b/ets2panda/test/runtime/ets/local-class-standard-example2.ets @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2021-2024 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 A_class { + field: number = 1234 // Not visible for the local class + method (parameter: number) { + let local: string = "instance local" + + interface LocalInterface { + method (): void + field: string + } + + class LocalClass implements LocalInterface { + override method () { + console.log ("Instance field = " + this.field + " par = " + parameter + " loc = " + local ) + assert(this.field == "`instance method instance field value`") + assert(parameter == 42) + assert(local == "instance local") + + } + field: string = "`instance method instance field value`" + static s_method () { + console.log ("Static field = " + LocalClass.s_field) + assert(LocalClass.s_field == "`instance method class/static field value`") + } + static s_field: string = "`instance method class/static field value`" + } + + let lc: LocalInterface = new LocalClass + lc.method() + LocalClass.s_method() + } + + static s_method (parameter: number) { + let local: string = "class/static local" + interface LocalInterface { + method (): void + field: string + } + + class LocalClass implements LocalInterface { + override method () { + console.log ("Instance field = " + this.field + " par = " + parameter + " loc = " + local) + assert(this.field == "`static method instance field value`") + assert(parameter == 72) + assert(local == "class/static local") + } + field: string = "`static method instance field value`" + static s_method () { + console.log ("Static field = " + LocalClass.s_field) + assert(LocalClass.s_field == "`static method class/static field value`") + } + static s_field: string = "`static method class/static field value`" + } + let lc: LocalInterface = new LocalClass + lc.method() + LocalClass.s_method() + } +} + +function main() : int +{ + A_class.s_method(72); + + let a = new A_class(); + a.method(42) + + return 0; +} diff --git a/ets2panda/test/test-lists/ets-runtime/ets-runtime-ignored.txt b/ets2panda/test/test-lists/ets-runtime/ets-runtime-ignored.txt index c12cc9299c..7b6b2e0d97 100644 --- a/ets2panda/test/test-lists/ets-runtime/ets-runtime-ignored.txt +++ b/ets2panda/test/test-lists/ets-runtime/ets-runtime-ignored.txt @@ -56,3 +56,7 @@ lambdaExpressionWithRestParameter.ets # Non-trivial cast sequence castSequence.ets + +# ignored due to interface implementation modification +local-class-standard-example1.ets +local-class-standard-example2.ets diff --git a/ets2panda/varbinder/ETSBinder.cpp b/ets2panda/varbinder/ETSBinder.cpp index 9adf1f8e6d..040966d259 100644 --- a/ets2panda/varbinder/ETSBinder.cpp +++ b/ets2panda/varbinder/ETSBinder.cpp @@ -190,7 +190,7 @@ void ETSBinder::LookupIdentReference(ir::Identifier *ident) auto *outerFunction = GetScope()->EnclosingVariableScope()->Node(); if ((!outerFunction->IsScriptFunction() || !outerFunction->AsScriptFunction()->IsArrow()) && - !res.variable->IsGlobalVariable() && res.level > 1) { + !res.variable->IsGlobalVariable() && res.variable->HasFlag(VariableFlags::LOCAL) && res.level > 1) { ThrowInvalidCapture(ident->Start(), name); } } diff --git a/ets2panda/varbinder/recordTable.cpp b/ets2panda/varbinder/recordTable.cpp index 971257b12c..917107de71 100644 --- a/ets2panda/varbinder/recordTable.cpp +++ b/ets2panda/varbinder/recordTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 @@ -20,11 +20,15 @@ #include "ir/expressions/identifier.h" #include "ir/ts/tsEnumDeclaration.h" #include "ir/ts/tsInterfaceDeclaration.h" +#include "checker/types/ets/etsObjectType.h" #include "generated/signatures.h" namespace ark::es2panda::varbinder { BoundContext::BoundContext(RecordTable *recordTable, ir::ClassDefinition *classDef) - : prev_(recordTable->boundCtx_), recordTable_(recordTable), savedRecord_(recordTable->record_) + : prev_(recordTable->boundCtx_), + recordTable_(recordTable), + currentRecord_(classDef), + savedRecord_(recordTable->record_) { if (classDef == nullptr || !recordTable_->classDefinitions_.insert(classDef).second) { return; @@ -37,7 +41,10 @@ BoundContext::BoundContext(RecordTable *recordTable, ir::ClassDefinition *classD } BoundContext::BoundContext(RecordTable *recordTable, ir::TSInterfaceDeclaration *interfaceDecl) - : prev_(recordTable->boundCtx_), recordTable_(recordTable), savedRecord_(recordTable->record_) + : prev_(recordTable->boundCtx_), + recordTable_(recordTable), + currentRecord_(interfaceDecl), + savedRecord_(recordTable->record_) { if (interfaceDecl == nullptr || !recordTable_->interfaceDeclarations_.insert(interfaceDecl).second) { return; @@ -73,6 +80,13 @@ util::StringView BoundContext::FormRecordName() const util::UString recordName(recordTable_->program_->Allocator()); recordName.Append(prev_->FormRecordName()); recordName.Append(compiler::Signatures::METHOD_SEPARATOR); + if (std::holds_alternative(currentRecord_)) { + const auto *classDef = std::get(currentRecord_); + if (classDef->IsLocal()) { + recordName.Append(classDef->LocalPrefix()); + } + } + recordName.Append(recordIdent_->Name()); return recordName.View(); } diff --git a/ets2panda/varbinder/recordTable.h b/ets2panda/varbinder/recordTable.h index 1576acf0c7..9486719379 100644 --- a/ets2panda/varbinder/recordTable.h +++ b/ets2panda/varbinder/recordTable.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 @@ -180,6 +180,7 @@ public: private: BoundContext *prev_; RecordTable *recordTable_; + RecordTable::RecordHolder currentRecord_ {nullptr}; RecordTable::RecordHolder savedRecord_ {nullptr}; ir::Identifier *recordIdent_ {nullptr}; }; diff --git a/ets2panda/varbinder/scope.cpp b/ets2panda/varbinder/scope.cpp index bba9cd848e..d6bb722e42 100644 --- a/ets2panda/varbinder/scope.cpp +++ b/ets2panda/varbinder/scope.cpp @@ -73,6 +73,38 @@ const VariableScope *Scope::EnclosingVariableScope() const return nullptr; } +// NOTE(psiket): Duplication +ClassScope *Scope::EnclosingClassScope() +{ + Scope *iter = this; + + while (iter != nullptr) { + if (iter->IsClassScope()) { + return iter->AsClassScope(); + } + + iter = iter->Parent(); + } + + return nullptr; +} + +const ClassScope *Scope::EnclosingClassScope() const +{ + const auto *iter = this; + + while (iter != nullptr) { + if (iter->IsVariableScope()) { + return iter->AsClassScope(); + } + + iter = iter->Parent(); + } + + return nullptr; +} + +// NOLINTNEXTLINE(google-default-arguments) Variable *Scope::FindLocal(const util::StringView &name, ResolveBindingOptions options) const { if ((options & ResolveBindingOptions::INTERFACES) != 0) { @@ -147,14 +179,16 @@ ConstScopeFindResult Scope::FindInGlobal(const util::StringView &name, const Res ConstScopeFindResult Scope::FindInFunctionScope(const util::StringView &name, const ResolveBindingOptions options) const { const auto *scopeIter = this; - while (scopeIter != nullptr && !scopeIter->IsClassScope() && !scopeIter->IsGlobalScope()) { - if (auto *const resolved = scopeIter->FindLocal(name, options); resolved != nullptr) { - return {name, scopeIter, 0, 0, resolved}; + while (scopeIter != nullptr && !scopeIter->IsGlobalScope()) { + if (!scopeIter->IsClassScope()) { + if (auto *const resolved = scopeIter->FindLocal(name, options); resolved != nullptr) { + return ConstScopeFindResult(name, scopeIter, 0, 0, resolved); + } } scopeIter = scopeIter->Parent(); } - return {name, scopeIter, 0, 0, nullptr}; + return ConstScopeFindResult(name, scopeIter, 0, 0, nullptr); } ScopeFindResult Scope::Find(const util::StringView &name, const ResolveBindingOptions options) @@ -236,6 +270,10 @@ Variable *Scope::AddLocal(ArenaAllocator *allocator, Variable *currentVariable, return bindings_.insert({newDecl->Name(), allocator->New(newDecl, VariableFlags::INTERFACE)}) .first->second; } + case DeclType::CLASS: { + return bindings_.insert({newDecl->Name(), allocator->New(newDecl, VariableFlags::CLASS)}) + .first->second; + } case DeclType::TYPE_PARAMETER: { return bindings_ .insert({newDecl->Name(), allocator->New(newDecl, VariableFlags::TYPE_PARAMETER)}) @@ -404,8 +442,40 @@ Variable *FunctionScope::AddBinding(ArenaAllocator *allocator, Variable *current case DeclType::ENUM_LITERAL: { return AddTSBinding(allocator, currentVariable, newDecl, VariableFlags::ENUM_LITERAL); } + // NOTE(psiket):Duplication case DeclType::INTERFACE: { - return AddTSBinding(allocator, currentVariable, newDecl, VariableFlags::INTERFACE); + ir::Identifier *ident {}; + ident = newDecl->Node()->AsTSInterfaceDeclaration()->Id(); + + auto *var = InsertBinding(newDecl->Name(), allocator->New(newDecl, VariableFlags::INTERFACE)) + .first->second; + + if (var == nullptr) { + return nullptr; + } + + var->SetScope(this); + if (ident != nullptr) { + ident->SetVariable(var); + } + return var; + } + case DeclType::CLASS: { + ir::Identifier *ident {}; + ident = newDecl->Node()->AsClassDefinition()->Ident(); + + auto *var = InsertBinding(newDecl->Name(), allocator->New(newDecl, VariableFlags::CLASS)) + .first->second; + + if (var == nullptr) { + return nullptr; + } + + var->SetScope(this); + if (ident != nullptr) { + ident->SetVariable(var); + } + return var; } default: { return AddLexical(allocator, currentVariable, newDecl); diff --git a/ets2panda/varbinder/scope.h b/ets2panda/varbinder/scope.h index b179f00b2b..0aa277b0b4 100644 --- a/ets2panda/varbinder/scope.h +++ b/ets2panda/varbinder/scope.h @@ -134,6 +134,9 @@ public: const VariableScope *EnclosingVariableScope() const; + ClassScope *EnclosingClassScope(); + const ClassScope *EnclosingClassScope() const; + void AddFlag(ScopeFlags flag) { flags_ |= flag; -- Gitee From 007d0b8cd5f126e588f649348667bfe338c31f09 Mon Sep 17 00:00:00 2001 From: Tatiana Pivovarova Date: Fri, 1 Mar 2024 22:59:44 +0300 Subject: [PATCH 08/12] Fix clang-tidy Signed-off-by: Tatiana Pivovarova --- ets2panda/parser/ETSparser.cpp | 3 +-- ets2panda/parser/ETSparser.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ets2panda/parser/ETSparser.cpp b/ets2panda/parser/ETSparser.cpp index d9e9b6e02d..66aa029d38 100644 --- a/ets2panda/parser/ETSparser.cpp +++ b/ets2panda/parser/ETSparser.cpp @@ -658,9 +658,8 @@ ir::ModifierFlags ETSParser::ParseClassMethodModifiers(bool seenStatic) // NOLINTNEXTLINE(google-default-arguments) void ETSParser::ParseClassFieldDefinition(ir::Identifier *fieldName, ir::ModifierFlags modifiers, - ArenaVector *declarations, lexer::SourcePosition *letLoc) + ArenaVector *declarations) { - lexer::SourcePosition startLoc = letLoc != nullptr ? *letLoc : fieldName->Start(); lexer::SourcePosition endLoc = fieldName->End(); ir::TypeNode *typeAnnotation = nullptr; TypeAnnotationParsingOptions options = TypeAnnotationParsingOptions::THROW_ERROR; diff --git a/ets2panda/parser/ETSparser.h b/ets2panda/parser/ETSparser.h index c470d1c530..b01b9c51f9 100644 --- a/ets2panda/parser/ETSparser.h +++ b/ets2panda/parser/ETSparser.h @@ -166,7 +166,7 @@ private: ir::TypeNode *ConvertToOptionalUnionType(ir::TypeNode *typeNode); // NOLINTNEXTLINE(google-default-arguments) void ParseClassFieldDefinition(ir::Identifier *fieldName, ir::ModifierFlags modifiers, - ArenaVector *declarations, lexer::SourcePosition *letLoc = nullptr); + ArenaVector *declarations); std::tuple ParseTypeReferencePart( TypeAnnotationParsingOptions *options); ir::TypeNode *ParseTypeReference(TypeAnnotationParsingOptions *options); -- Gitee From 9355a0ed45bd7de86c8b8549733d55d9f8f5633c Mon Sep 17 00:00:00 2001 From: Gergo Csizi Date: Mon, 5 Feb 2024 14:57:11 +0100 Subject: [PATCH 09/12] Fix Static field and instance method with same name Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/I919CJ Internal issue: #15584 Test: new parser test Change-Id: Ia014860fd0f7e69bba81e041c359e360143a6df9 Signed-off-by: Gergo Csizi --- ets2panda/checker/ETSchecker.h | 2 + ets2panda/checker/ets/object.cpp | 52 +- .../lowering/scopesInit/scopesInitPhase.cpp | 18 +- .../lowering/scopesInit/scopesInitPhase.h | 2 + ...anceFromInterfaceStaticMethod-expected.txt | 1 - .../StaticFieldAndMethodSameName-expected.txt | 945 ++++++++++++++ .../ets/StaticFieldAndMethodSameName.ets | 24 + ...dAndMethodSameNameInheritance-expected.txt | 1122 +++++++++++++++++ ...taticFieldAndMethodSameNameInheritance.ets | 27 + ets2panda/varbinder/variableFlags.h | 4 +- 10 files changed, 2171 insertions(+), 26 deletions(-) create mode 100644 ets2panda/test/parser/ets/StaticFieldAndMethodSameName-expected.txt create mode 100644 ets2panda/test/parser/ets/StaticFieldAndMethodSameName.ets create mode 100644 ets2panda/test/parser/ets/StaticFieldAndMethodSameNameInheritance-expected.txt create mode 100644 ets2panda/test/parser/ets/StaticFieldAndMethodSameNameInheritance.ets diff --git a/ets2panda/checker/ETSchecker.h b/ets2panda/checker/ETSchecker.h index d853b84e44..522dc9220b 100644 --- a/ets2panda/checker/ETSchecker.h +++ b/ets2panda/checker/ETSchecker.h @@ -178,6 +178,8 @@ public: varbinder::Variable *ResolveInstanceExtension(const ir::MemberExpression *memberExpr); void CheckImplicitSuper(ETSObjectType *classType, Signature *ctorSig); void CheckValidInheritance(ETSObjectType *classType, ir::ClassDefinition *classDef); + void CheckProperties(ETSObjectType *classType, ir::ClassDefinition *classDef, varbinder::LocalVariable *it, + varbinder::LocalVariable *found, ETSObjectType *interfaceFound); void TransformProperties(ETSObjectType *classType); void CheckGetterSetterProperties(ETSObjectType *classType); void AddElementsToModuleObject(ETSObjectType *moduleObj, const util::StringView &str); diff --git a/ets2panda/checker/ets/object.cpp b/ets2panda/checker/ets/object.cpp index 82f9371201..ff2eebd10f 100644 --- a/ets2panda/checker/ets/object.cpp +++ b/ets2panda/checker/ets/object.cpp @@ -1515,30 +1515,40 @@ void ETSChecker::CheckValidInheritance(ETSObjectType *classType, ir::ClassDefini continue; } - if (!IsSameDeclarationType(it, found) && !it->HasFlag(varbinder::VariableFlags::GETTER_SETTER)) { - const char *targetType {}; - - if (it->HasFlag(varbinder::VariableFlags::PROPERTY)) { - targetType = "field"; - } else if (it->HasFlag(varbinder::VariableFlags::METHOD)) { - targetType = "method"; - } else if (it->HasFlag(varbinder::VariableFlags::CLASS)) { - targetType = "class"; - } else if (it->HasFlag(varbinder::VariableFlags::INTERFACE)) { - targetType = "interface"; - } else { - targetType = "enum"; - } + CheckProperties(classType, classDef, it, found, interfaceFound); + } +} - if (interfaceFound != nullptr) { - ThrowTypeError({"Cannot inherit from interface ", interfaceFound->Name(), " because ", targetType, " ", - it->Name(), " is inherited with a different declaration type"}, - interfaceFound->GetDeclNode()->Start()); - } - ThrowTypeError({"Cannot inherit from class ", classType->SuperType()->Name(), ", because ", targetType, " ", +void ETSChecker::CheckProperties(ETSObjectType *classType, ir::ClassDefinition *classDef, varbinder::LocalVariable *it, + varbinder::LocalVariable *found, ETSObjectType *interfaceFound) +{ + if (!IsSameDeclarationType(it, found) && !it->HasFlag(varbinder::VariableFlags::GETTER_SETTER)) { + if (IsVariableStatic(it) != IsVariableStatic(found)) { + return; + } + + const char *targetType {}; + + if (it->HasFlag(varbinder::VariableFlags::PROPERTY)) { + targetType = "field"; + } else if (it->HasFlag(varbinder::VariableFlags::METHOD)) { + targetType = "method"; + } else if (it->HasFlag(varbinder::VariableFlags::CLASS)) { + targetType = "class"; + } else if (it->HasFlag(varbinder::VariableFlags::INTERFACE)) { + targetType = "interface"; + } else { + targetType = "enum"; + } + + if (interfaceFound != nullptr) { + ThrowTypeError({"Cannot inherit from interface ", interfaceFound->Name(), " because ", targetType, " ", it->Name(), " is inherited with a different declaration type"}, - classDef->Super()->Start()); + interfaceFound->GetDeclNode()->Start()); } + ThrowTypeError({"Cannot inherit from class ", classType->SuperType()->Name(), ", because ", targetType, " ", + it->Name(), " is inherited with a different declaration type"}, + classDef->Super()->Start()); } } diff --git a/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.cpp b/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.cpp index 45ed555119..17755b07e5 100644 --- a/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.cpp +++ b/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.cpp @@ -758,8 +758,11 @@ void InitScopesPhaseETS::DeclareClassMethod(ir::MethodDefinition *method) const auto methodName = method->Id(); auto *const clsScope = VarBinder()->GetScope()->AsClassScope(); - if (clsScope->FindLocal(methodName->Name(), varbinder::ResolveBindingOptions::VARIABLES | - varbinder::ResolveBindingOptions::DECLARATION) != nullptr) { + auto options = + method->IsStatic() + ? varbinder::ResolveBindingOptions::STATIC_VARIABLES | varbinder::ResolveBindingOptions::STATIC_DECLARATION + : varbinder::ResolveBindingOptions::VARIABLES | varbinder::ResolveBindingOptions::DECLARATION; + if (clsScope->FindLocal(methodName->Name(), options) != nullptr) { VarBinder()->ThrowRedeclaration(methodName->Start(), methodName->Name()); } @@ -771,6 +774,13 @@ void InitScopesPhaseETS::DeclareClassMethod(ir::MethodDefinition *method) } auto *found = targetScope->FindLocal(methodName->Name(), varbinder::ResolveBindingOptions::BINDINGS); + MaybeAddOverload(method, methodName, found, clsScope, targetScope); +} + +void InitScopesPhaseETS::MaybeAddOverload(ir::MethodDefinition *method, ir::Identifier *methodName, + varbinder::Variable *found, varbinder::ClassScope *clsScope, + varbinder::LocalScope *targetScope) +{ if (found == nullptr) { auto classCtx = varbinder::LexicalScope::Enter(VarBinder(), targetScope); [[maybe_unused]] auto [_, var] = VarBinder()->NewVarDecl( @@ -839,7 +849,9 @@ void InitScopesPhaseETS::VisitMethodDefinition(ir::MethodDefinition *method) { auto *curScope = VarBinder()->GetScope(); const auto methodName = method->Id(); - auto res = curScope->Find(methodName->Name(), varbinder::ResolveBindingOptions::ALL); + auto res = + curScope->Find(methodName->Name(), method->IsStatic() ? varbinder::ResolveBindingOptions::ALL_STATIC + : varbinder::ResolveBindingOptions::ALL_NON_STATIC); if (res.variable != nullptr && !res.variable->Declaration()->IsFunctionDecl() && res.scope == curScope) { VarBinder()->ThrowRedeclaration(methodName->Start(), res.name); } diff --git a/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.h b/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.h index 35674b53dc..29bed5afae 100644 --- a/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.h +++ b/ets2panda/compiler/lowering/scopesInit/scopesInitPhase.h @@ -331,6 +331,8 @@ private: void BindVarDecl(ir::Identifier *binding, ir::Expression *init, varbinder::Decl *decl, varbinder::Variable *var) override; void DeclareClassMethod(ir::MethodDefinition *method); + void MaybeAddOverload(ir::MethodDefinition *method, ir::Identifier *methodName, varbinder::Variable *found, + varbinder::ClassScope *clsScope, varbinder::LocalScope *targetScope); void VisitClassStaticBlock(ir::ClassStaticBlock *staticBlock) override; void VisitBlockExpression(ir::BlockExpression *blockExpr) override; diff --git a/ets2panda/test/compiler/ets/invalidInheritanceFromInterfaceStaticMethod-expected.txt b/ets2panda/test/compiler/ets/invalidInheritanceFromInterfaceStaticMethod-expected.txt index aadbca07d2..f4986f2381 100644 --- a/ets2panda/test/compiler/ets/invalidInheritanceFromInterfaceStaticMethod-expected.txt +++ b/ets2panda/test/compiler/ets/invalidInheritanceFromInterfaceStaticMethod-expected.txt @@ -1103,4 +1103,3 @@ } } } -TypeError: Cannot inherit from interface A because field x is inherited with a different declaration type [invalidInheritanceFromInterfaceStaticMethod.ets:16:1] diff --git a/ets2panda/test/parser/ets/StaticFieldAndMethodSameName-expected.txt b/ets2panda/test/parser/ets/StaticFieldAndMethodSameName-expected.txt new file mode 100644 index 0000000000..6423a67528 --- /dev/null +++ b/ets2panda/test/parser/ets/StaticFieldAndMethodSameName-expected.txt @@ -0,0 +1,945 @@ +{ + "type": "Program", + "statements": [ + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "C", + "decorators": [], + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "ClassProperty", + "key": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "value": { + "type": "NumberLiteral", + "value": 10, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "accessibility": "public", + "static": false, + "readonly": false, + "declare": false, + "optional": false, + "computed": false, + "typeAnnotation": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "number", + "decorators": [], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "definite": false, + "decorators": [], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 1 + } + } + }, + "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": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "returnType": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "void", + "decorators": [], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 1 + } + } + }, + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 1 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "constructor", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 32, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 32, + "column": 1 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "main", + "decorators": [], + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 1 + } + } + }, + "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": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "returnType": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "void", + "decorators": [], + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 1 + } + } + }, + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "console", + "decorators": [], + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 1 + } + } + }, + "property": { + "type": "Identifier", + "name": "log", + "decorators": [], + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 1 + } + } + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 1 + } + } + }, + "arguments": [ + { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "C", + "decorators": [], + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 1 + } + } + }, + "property": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 1 + } + } + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 1 + } + } + }, + "arguments": [], + "optional": false, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 1 + } + } + } + ], + "optional": false, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 1 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "console", + "decorators": [], + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 1 + } + } + }, + "property": { + "type": "Identifier", + "name": "log", + "decorators": [], + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 1 + } + } + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 1 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "ETSNewClassInstanceExpression", + "typeReference": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "C", + "decorators": [], + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 1 + } + } + }, + "arguments": [], + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 1 + } + } + }, + "property": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 1 + } + } + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 1 + } + } + } + ], + "optional": false, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 37, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 37, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 37, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 37, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 38, + "column": 1 + } + } +} diff --git a/ets2panda/test/parser/ets/StaticFieldAndMethodSameName.ets b/ets2panda/test/parser/ets/StaticFieldAndMethodSameName.ets new file mode 100644 index 0000000000..04cef72294 --- /dev/null +++ b/ets2panda/test/parser/ets/StaticFieldAndMethodSameName.ets @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024 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 C { + foo: number = 10 + static foo(): void {} +} + +function main(): void { + console.log(C.foo()) + console.log(new C().foo) +} diff --git a/ets2panda/test/parser/ets/StaticFieldAndMethodSameNameInheritance-expected.txt b/ets2panda/test/parser/ets/StaticFieldAndMethodSameNameInheritance-expected.txt new file mode 100644 index 0000000000..cfaa72be99 --- /dev/null +++ b/ets2panda/test/parser/ets/StaticFieldAndMethodSameNameInheritance-expected.txt @@ -0,0 +1,1122 @@ +{ + "type": "Program", + "statements": [ + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "A", + "decorators": [], + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "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": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "returnType": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "void", + "decorators": [], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "constructor", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 31, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 31, + "column": 1 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "B", + "decorators": [], + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 1 + } + } + }, + "superClass": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "A", + "decorators": [], + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 1 + } + } + }, + "implements": [], + "body": [ + { + "type": "ClassProperty", + "key": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 1 + } + } + }, + "value": { + "type": "NumberLiteral", + "value": 10, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 1 + } + } + }, + "accessibility": "public", + "static": false, + "readonly": false, + "declare": false, + "optional": false, + "computed": false, + "typeAnnotation": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "number", + "decorators": [], + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 1 + } + } + }, + "definite": false, + "decorators": [], + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 1 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "constructor", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 35, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 35, + "column": 1 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "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 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "main", + "decorators": [], + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 1 + } + } + }, + "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": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "returnType": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "void", + "decorators": [], + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 1 + } + } + }, + "body": { + "type": "BlockStatement", + "statements": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "console", + "decorators": [], + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 1 + } + } + }, + "property": { + "type": "Identifier", + "name": "log", + "decorators": [], + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 1 + } + } + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 1 + } + } + }, + "arguments": [ + { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "A", + "decorators": [], + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 1 + } + } + }, + "property": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 1 + } + } + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 1 + } + } + }, + "arguments": [], + "optional": false, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 1 + } + } + } + ], + "optional": false, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 1 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "console", + "decorators": [], + "loc": { + "start": { + "line": 39, + "column": 1 + }, + "end": { + "line": 39, + "column": 1 + } + } + }, + "property": { + "type": "Identifier", + "name": "log", + "decorators": [], + "loc": { + "start": { + "line": 39, + "column": 1 + }, + "end": { + "line": 39, + "column": 1 + } + } + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 39, + "column": 1 + }, + "end": { + "line": 39, + "column": 1 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "ETSNewClassInstanceExpression", + "typeReference": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "B", + "decorators": [], + "loc": { + "start": { + "line": 39, + "column": 1 + }, + "end": { + "line": 39, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 39, + "column": 1 + }, + "end": { + "line": 39, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 39, + "column": 1 + }, + "end": { + "line": 39, + "column": 1 + } + } + }, + "arguments": [], + "loc": { + "start": { + "line": 39, + "column": 1 + }, + "end": { + "line": 39, + "column": 1 + } + } + }, + "property": { + "type": "Identifier", + "name": "foo", + "decorators": [], + "loc": { + "start": { + "line": 39, + "column": 1 + }, + "end": { + "line": 39, + "column": 1 + } + } + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 39, + "column": 1 + }, + "end": { + "line": 39, + "column": 1 + } + } + } + ], + "optional": false, + "loc": { + "start": { + "line": 39, + "column": 1 + }, + "end": { + "line": 39, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 39, + "column": 1 + }, + "end": { + "line": 39, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 40, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 40, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 40, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 40, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 41, + "column": 1 + } + } +} diff --git a/ets2panda/test/parser/ets/StaticFieldAndMethodSameNameInheritance.ets b/ets2panda/test/parser/ets/StaticFieldAndMethodSameNameInheritance.ets new file mode 100644 index 0000000000..19bbbadbf9 --- /dev/null +++ b/ets2panda/test/parser/ets/StaticFieldAndMethodSameNameInheritance.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2024 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 A { + static foo(): void {} +} + +class B extends A { + foo: number = 10 +} + +function main(): void { + console.log(A.foo()) + console.log(new B().foo) +} diff --git a/ets2panda/varbinder/variableFlags.h b/ets2panda/varbinder/variableFlags.h index 6cbe8917f1..cd97b090c0 100644 --- a/ets2panda/varbinder/variableFlags.h +++ b/ets2panda/varbinder/variableFlags.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 @@ -84,6 +84,8 @@ enum class ResolveBindingOptions : uint32_t { ALL_VARIABLES = VARIABLES | STATIC_VARIABLES, ALL_METHOD = METHODS | STATIC_METHODS, ALL_DECLARATION = DECLARATION | STATIC_DECLARATION, + ALL_STATIC = STATIC_VARIABLES | STATIC_METHODS | STATIC_DECLARATION, + ALL_NON_STATIC = VARIABLES | METHODS | DECLARATION, LAST = TYPE_ALIASES, ALL = (LAST << 1U) - 1U, -- Gitee From 343d3c9f2ea767c9fdf697a6e18e2a354eba9b9b Mon Sep 17 00:00:00 2001 From: x30053363 Date: Tue, 27 Feb 2024 20:06:09 +0800 Subject: [PATCH 10/12] fix codestyle problems #15076 Signed-off-by: x30053363 --- ets2panda/BUILD.gn | 1 + ets2panda/CMakeLists.txt | 1 + ets2panda/checker/ETSAnalyzer.cpp | 552 ---------------------- ets2panda/checker/ETSAnalyzer.h | 1 + ets2panda/checker/ETSAnalyzerHelpers.cpp | 571 +++++++++++++++++++++++ ets2panda/checker/ETSAnalyzerHelpers.h | 65 +++ 6 files changed, 639 insertions(+), 552 deletions(-) create mode 100644 ets2panda/checker/ETSAnalyzerHelpers.cpp create mode 100644 ets2panda/checker/ETSAnalyzerHelpers.h diff --git a/ets2panda/BUILD.gn b/ets2panda/BUILD.gn index 9f1c550824..8d5a3a07dc 100644 --- a/ets2panda/BUILD.gn +++ b/ets2panda/BUILD.gn @@ -27,6 +27,7 @@ config("libes2panda_public_config") { libes2panda_sources = [ "checker/ASchecker.cpp", "checker/ETSAnalyzer.cpp", + "checker/ETSAnalyzerHelpers.cpp", "checker/ETSchecker.cpp", "checker/JSchecker.cpp", "checker/TSAnalyzer.cpp", diff --git a/ets2panda/CMakeLists.txt b/ets2panda/CMakeLists.txt index 5ddc010839..a4868c6a84 100644 --- a/ets2panda/CMakeLists.txt +++ b/ets2panda/CMakeLists.txt @@ -359,6 +359,7 @@ set(ES2PANDA_LIB_SRC checker/checker.cpp checker/checkerContext.cpp checker/ETSAnalyzer.cpp + checker/ETSAnalyzerHelpers.cpp checker/ETSchecker.cpp checker/TSchecker.cpp checker/ASchecker.cpp diff --git a/ets2panda/checker/ETSAnalyzer.cpp b/ets2panda/checker/ETSAnalyzer.cpp index 772af832e7..267d4f2cee 100644 --- a/ets2panda/checker/ETSAnalyzer.cpp +++ b/ets2panda/checker/ETSAnalyzer.cpp @@ -124,174 +124,6 @@ checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::MetaProperty *expr) const UNREACHABLE(); } -static void CheckExtensionIsShadowedInCurrentClassOrInterface(checker::ETSChecker *checker, - checker::ETSObjectType *objType, - ir::ScriptFunction *extensionFunc, - checker::Signature *signature) -{ - const auto methodName = extensionFunc->Id()->Name(); - // Only check if there are class and interfaces' instance methods which would shadow instance extension method - auto *const variable = objType->GetOwnProperty(methodName); - if (variable == nullptr) { - return; - } - - const auto *const funcType = variable->TsType()->AsETSFunctionType(); - for (auto *funcSignature : funcType->CallSignatures()) { - signature->SetReturnType(funcSignature->ReturnType()); - if (!checker->Relation()->IsCompatibleTo(signature, funcSignature)) { - continue; - } - - checker->ReportWarning({"extension is shadowed by a instance member function '", funcType->Name(), - funcSignature, "' in class ", objType->Name()}, - extensionFunc->Body()->Start()); - return; - } -} - -static void CheckExtensionIsShadowedByMethod(checker::ETSChecker *checker, checker::ETSObjectType *objType, - ir::ScriptFunction *extensionFunc, checker::Signature *signature) -{ - if (objType == nullptr) { - return; - } - - CheckExtensionIsShadowedInCurrentClassOrInterface(checker, objType, extensionFunc, signature); - - for (auto *interface : objType->Interfaces()) { - CheckExtensionIsShadowedByMethod(checker, interface, extensionFunc, signature); - } - - CheckExtensionIsShadowedByMethod(checker, objType->SuperType(), extensionFunc, signature); -} - -static void CheckExtensionMethod(checker::ETSChecker *checker, ir::ScriptFunction *extensionFunc, - ir::MethodDefinition *node) -{ - auto *const classType = checker->GetApparentType(extensionFunc->Signature()->Params()[0]->TsType()); - if (!classType->IsETSObjectType() || - (!classType->AsETSObjectType()->HasObjectFlag(checker::ETSObjectFlags::CLASS) && - !classType->AsETSObjectType()->HasObjectFlag(checker::ETSObjectFlags::INTERFACE))) { - checker->ThrowTypeError("Extension function can only defined for class and interface type.", node->Start()); - } - - checker->AddStatus(checker::CheckerStatus::IN_INSTANCE_EXTENSION_METHOD); - - checker::SignatureInfo *originalExtensionSigInfo = checker->Allocator()->New( - extensionFunc->Signature()->GetSignatureInfo(), checker->Allocator()); - originalExtensionSigInfo->minArgCount -= 1; - originalExtensionSigInfo->params.erase(originalExtensionSigInfo->params.begin()); - checker::Signature *originalExtensionSigature = - checker->CreateSignature(originalExtensionSigInfo, extensionFunc->Signature()->ReturnType(), extensionFunc); - - CheckExtensionIsShadowedByMethod(checker, classType->AsETSObjectType(), extensionFunc, originalExtensionSigature); -} - -void DoBodyTypeChecking(ETSChecker *checker, ir::MethodDefinition *node, ir::ScriptFunction *scriptFunc) -{ - if (scriptFunc->HasBody() && (node->IsNative() || node->IsAbstract() || node->IsDeclare())) { - checker->ThrowTypeError("Native, Abstract and Declare methods cannot have body.", scriptFunc->Body()->Start()); - } - - if (scriptFunc->IsAsyncFunc()) { - auto *retType = scriptFunc->Signature()->ReturnType(); - if (!retType->IsETSObjectType() || - retType->AsETSObjectType()->GetOriginalBaseType() != checker->GlobalBuiltinPromiseType()) { - checker->ThrowTypeError("Return type of async function must be 'Promise'.", scriptFunc->Start()); - } - } else if (scriptFunc->HasBody() && !scriptFunc->IsExternal()) { - checker::ScopeContext scopeCtx(checker, scriptFunc->Scope()); - checker::SavedCheckerContext savedContext(checker, checker->Context().Status(), - checker->Context().ContainingClass()); - checker->Context().SetContainingSignature(checker->GetSignatureFromMethodDefinition(node)); - - if (node->IsStatic() && !node->IsConstructor() && - !checker->Context().ContainingClass()->HasObjectFlag(checker::ETSObjectFlags::GLOBAL)) { - checker->AddStatus(checker::CheckerStatus::IN_STATIC_CONTEXT); - } - - if (node->IsConstructor()) { - checker->AddStatus(checker::CheckerStatus::IN_CONSTRUCTOR); - } - - if (node->IsExtensionMethod()) { - CheckExtensionMethod(checker, scriptFunc, node); - } - - scriptFunc->Body()->Check(checker); - - // In case of inferred function's return type set it forcedly to all return statements; - if (scriptFunc->Signature()->HasSignatureFlag(checker::SignatureFlags::INFERRED_RETURN_TYPE) && - scriptFunc->ReturnTypeAnnotation() == nullptr && scriptFunc->Body() != nullptr && - scriptFunc->Body()->IsStatement()) { - scriptFunc->Body()->AsStatement()->SetReturnType(checker, scriptFunc->Signature()->ReturnType()); - } - - checker->Context().SetContainingSignature(nullptr); - } -} - -void CheckPredefinedMethodReturnType(ETSChecker *checker, ir::ScriptFunction *scriptFunc) -{ - auto const &position = scriptFunc->Start(); - - auto const hasIteratorInterface = [](ETSObjectType const *const objectType) -> bool { - for (auto const *const interface : objectType->Interfaces()) { - if (interface->Name().Is(ir::ITERATOR_INTERFACE_NAME)) { - return true; - } - } - return false; - }; - - if (scriptFunc->IsSetter() && (scriptFunc->Signature()->ReturnType() != checker->GlobalVoidType())) { - checker->ThrowTypeError("Setter must have void return type", position); - } - - if (scriptFunc->IsGetter() && (scriptFunc->Signature()->ReturnType() == checker->GlobalVoidType())) { - checker->ThrowTypeError("Getter must return a value", position); - } - - auto const name = scriptFunc->Id()->Name(); - auto const methodName = std::string {ir::PREDEFINED_METHOD} + std::string {name.Utf8()}; - - if (name.Is(compiler::Signatures::GET_INDEX_METHOD)) { - if (scriptFunc->Signature()->ReturnType() == checker->GlobalVoidType()) { - checker->ThrowTypeError(methodName + "' shouldn't have void return type.", position); - } - } else if (name.Is(compiler::Signatures::SET_INDEX_METHOD)) { - if (scriptFunc->Signature()->ReturnType() != checker->GlobalVoidType()) { - checker->ThrowTypeError(methodName + "' should have void return type.", position); - } - } else if (name.Is(compiler::Signatures::ITERATOR_METHOD)) { - auto const *returnType = scriptFunc->Signature()->ReturnType(); - - if (returnType == nullptr) { - checker->ThrowTypeError(methodName + "' doesn't have return type.", position); - } - - if (returnType->IsETSTypeParameter()) { - returnType = checker->GetApparentType(returnType->AsETSTypeParameter()->GetConstraintType()); - } - - if (returnType->IsETSUnionType() && - returnType->AsETSUnionType()->AllOfConstituentTypes( - [hasIteratorInterface](checker::Type const *const constituentType) -> bool { - return constituentType->IsETSObjectType() && - hasIteratorInterface(constituentType->AsETSObjectType()); - })) { - return; - } - - if (returnType->IsETSObjectType() && hasIteratorInterface(returnType->AsETSObjectType())) { - return; - } - - checker->ThrowTypeError(methodName + "' has invalid return type.", position); - } -} - checker::Type *ETSAnalyzer::Check(ir::MethodDefinition *node) const { ETSChecker *checker = GetETSChecker(); @@ -977,66 +809,6 @@ checker::Type *ETSAnalyzer::Check(ir::BinaryExpression *expr) const return expr->TsType(); } -static checker::Type *InitAnonymousLambdaCallee(checker::ETSChecker *checker, ir::Expression *callee, - checker::Type *calleeType) -{ - auto *const arrowFunc = callee->AsArrowFunctionExpression()->Function(); - - ArenaVector params {checker->Allocator()->Adapter()}; - checker->CopyParams(arrowFunc->Params(), params); - - auto *typeAnnotation = arrowFunc->ReturnTypeAnnotation(); - if (typeAnnotation != nullptr) { - typeAnnotation = typeAnnotation->Clone(checker->Allocator(), nullptr); - typeAnnotation->SetTsType(arrowFunc->ReturnTypeAnnotation()->TsType()); - } - - auto signature = ir::FunctionSignature(nullptr, std::move(params), typeAnnotation); - auto *funcType = checker->AllocNode(std::move(signature), ir::ScriptFunctionFlags::NONE); - - funcType->SetScope(arrowFunc->Scope()->AsFunctionScope()->ParamScope()); - auto *const funcIface = funcType->Check(checker); - checker->Relation()->SetNode(callee); - checker->Relation()->IsAssignableTo(calleeType, funcIface); - return funcIface; -} - -static checker::Signature *ResolveCallExtensionFunction(checker::ETSFunctionType *functionType, - checker::ETSChecker *checker, ir::CallExpression *expr) -{ - auto *memberExpr = expr->Callee()->AsMemberExpression(); - expr->Arguments().insert(expr->Arguments().begin(), memberExpr->Object()); - auto *signature = - checker->ResolveCallExpressionAndTrailingLambda(functionType->CallSignatures(), expr, expr->Start()); - if (!signature->Function()->IsExtensionMethod()) { - checker->ThrowTypeError({"Property '", memberExpr->Property()->AsIdentifier()->Name(), - "' does not exist on type '", memberExpr->ObjType()->Name(), "'"}, - memberExpr->Property()->Start()); - } - expr->SetSignature(signature); - expr->SetCallee(memberExpr->Property()); - memberExpr->Property()->AsIdentifier()->SetParent(expr); - expr->Arguments()[0]->SetParent(expr); - checker->HandleUpdatedCallExpressionNode(expr); - // Set TsType for new Callee(original member expression's Object) - expr->Callee()->Check(checker); - return signature; -} - -static checker::Signature *ResolveCallForETSExtensionFuncHelperType(checker::ETSExtensionFuncHelperType *type, - checker::ETSChecker *checker, - ir::CallExpression *expr) -{ - checker::Signature *signature = checker->ResolveCallExpressionAndTrailingLambda( - type->ClassMethodType()->CallSignatures(), expr, expr->Start(), checker::TypeRelationFlag::NO_THROW); - - if (signature != nullptr) { - return signature; - } - - return ResolveCallExtensionFunction(type->ExtensionMethodType(), checker, expr); -} - checker::Type *ETSAnalyzer::Check(ir::BlockExpression *st) const { ETSChecker *checker = GetETSChecker(); @@ -1055,71 +827,6 @@ checker::Type *ETSAnalyzer::Check(ir::BlockExpression *st) const return st->TsType(); } -ArenaVector GetUnionTypeSignatures(ETSChecker *checker, checker::ETSUnionType *etsUnionType) -{ - ArenaVector callSignatures(checker->Allocator()->Adapter()); - - for (auto *constituentType : etsUnionType->ConstituentTypes()) { - if (constituentType->IsETSObjectType()) { - ArenaVector tmpCallSignatures(checker->Allocator()->Adapter()); - tmpCallSignatures = constituentType->AsETSObjectType() - ->GetOwnProperty("invoke") - ->TsType() - ->AsETSFunctionType() - ->CallSignatures(); - callSignatures.insert(callSignatures.end(), tmpCallSignatures.begin(), tmpCallSignatures.end()); - } - if (constituentType->IsETSFunctionType()) { - ArenaVector tmpCallSignatures(checker->Allocator()->Adapter()); - tmpCallSignatures = constituentType->AsETSFunctionType()->CallSignatures(); - callSignatures.insert(callSignatures.end(), tmpCallSignatures.begin(), tmpCallSignatures.end()); - } - if (constituentType->IsETSUnionType()) { - ArenaVector tmpCallSignatures(checker->Allocator()->Adapter()); - tmpCallSignatures = GetUnionTypeSignatures(checker, constituentType->AsETSUnionType()); - callSignatures.insert(callSignatures.end(), tmpCallSignatures.begin(), tmpCallSignatures.end()); - } - } - - return callSignatures; -} - -ArenaVector &ChooseSignatures(ETSChecker *checker, checker::Type *calleeType, - bool isConstructorCall, bool isFunctionalInterface, - bool isUnionTypeWithFunctionalInterface) -{ - static ArenaVector unionSignatures(checker->Allocator()->Adapter()); - unionSignatures.clear(); - if (isConstructorCall) { - return calleeType->AsETSObjectType()->ConstructSignatures(); - } - if (isFunctionalInterface) { - return calleeType->AsETSObjectType() - ->GetOwnProperty(FUNCTIONAL_INTERFACE_INVOKE_METHOD_NAME) - ->TsType() - ->AsETSFunctionType() - ->CallSignatures(); - } - if (isUnionTypeWithFunctionalInterface) { - unionSignatures = GetUnionTypeSignatures(checker, calleeType->AsETSUnionType()); - return unionSignatures; - } - return calleeType->AsETSFunctionType()->CallSignatures(); -} - -checker::ETSObjectType *ChooseCalleeObj(ETSChecker *checker, ir::CallExpression *expr, checker::Type *calleeType, - bool isConstructorCall) -{ - if (isConstructorCall) { - return calleeType->AsETSObjectType(); - } - if (expr->Callee()->IsIdentifier()) { - return checker->Context().ContainingClass(); - } - ASSERT(expr->Callee()->IsMemberExpression()); - return expr->Callee()->AsMemberExpression()->ObjType(); -} - checker::Signature *ETSAnalyzer::ResolveSignature(ETSChecker *checker, ir::CallExpression *expr, checker::Type *calleeType, bool isFunctionalInterface, bool isUnionTypeWithFunctionalInterface) const @@ -1608,80 +1315,6 @@ checker::Type *ETSAnalyzer::Check(ir::ThisExpression *expr) const return expr->TsType(); } -void ProcessExclamationMark(ETSChecker *checker, ir::UnaryExpression *expr, checker::Type *operandType) -{ - if (checker->IsNullLikeOrVoidExpression(expr->Argument())) { - auto tsType = checker->CreateETSBooleanType(true); - tsType->AddTypeFlag(checker::TypeFlag::CONSTANT); - expr->SetTsType(tsType); - return; - } - - if (operandType == nullptr || !operandType->IsConditionalExprType()) { - checker->ThrowTypeError("Bad operand type, the type of the operand must be boolean type.", - expr->Argument()->Start()); - } - - auto exprRes = operandType->ResolveConditionExpr(); - if (std::get<0>(exprRes)) { - auto tsType = checker->CreateETSBooleanType(!std::get<1>(exprRes)); - tsType->AddTypeFlag(checker::TypeFlag::CONSTANT); - expr->SetTsType(tsType); - return; - } - - expr->SetTsType(checker->GlobalETSBooleanType()); -} - -void SetTsTypeForUnaryExpression(ETSChecker *checker, ir::UnaryExpression *expr, checker::Type *operandType, - checker::Type *argType) -{ - switch (expr->OperatorType()) { - case lexer::TokenType::PUNCTUATOR_MINUS: - case lexer::TokenType::PUNCTUATOR_PLUS: { - if (operandType == nullptr || !operandType->HasTypeFlag(checker::TypeFlag::ETS_NUMERIC)) { - checker->ThrowTypeError("Bad operand type, the type of the operand must be numeric type.", - expr->Argument()->Start()); - } - - if (operandType->HasTypeFlag(checker::TypeFlag::CONSTANT) && - expr->OperatorType() == lexer::TokenType::PUNCTUATOR_MINUS) { - expr->SetTsType(checker->NegateNumericType(operandType, expr)); - break; - } - - expr->SetTsType(operandType); - break; - } - case lexer::TokenType::PUNCTUATOR_TILDE: { - if (operandType == nullptr || !operandType->HasTypeFlag(checker::TypeFlag::ETS_NUMERIC)) { - checker->ThrowTypeError("Bad operand type, the type of the operand must be numeric type.", - expr->Argument()->Start()); - } - - if (operandType->HasTypeFlag(checker::TypeFlag::CONSTANT)) { - expr->SetTsType(checker->BitwiseNegateNumericType(operandType, expr)); - break; - } - - expr->SetTsType(checker->SelectGlobalIntegerTypeForNumeric(operandType)); - break; - } - case lexer::TokenType::PUNCTUATOR_EXCLAMATION_MARK: { - ProcessExclamationMark(checker, expr, operandType); - break; - } - case lexer::TokenType::PUNCTUATOR_DOLLAR_DOLLAR: { - expr->SetTsType(argType); - break; - } - default: { - UNREACHABLE(); - break; - } - } -} - checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TypeofExpression *expr) const { ETSChecker *checker = GetETSChecker(); @@ -1917,21 +1550,6 @@ checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ImportDefaultSpecifier *s UNREACHABLE(); } -checker::ETSObjectType *CreateSyntheticType(ETSChecker *checker, util::StringView const &syntheticName, - checker::ETSObjectType *lastObjectType, ir::Identifier *id) -{ - auto *syntheticObjType = checker->Allocator()->New( - checker->Allocator(), syntheticName, syntheticName, id, checker::ETSObjectFlags::NO_OPTS, checker->Relation()); - - auto *classDecl = checker->Allocator()->New(syntheticName); - varbinder::LocalVariable *var = - checker->Allocator()->New(classDecl, varbinder::VariableFlags::CLASS); - var->SetTsType(syntheticObjType); - lastObjectType->AddProperty(var); - syntheticObjType->SetEnclosingType(lastObjectType); - return syntheticObjType; -} - checker::Type *ETSAnalyzer::Check(ir::ImportNamespaceSpecifier *st) const { ETSChecker *checker = GetETSChecker(); @@ -2085,47 +1703,8 @@ static constexpr char const MISSING_SOURCE_EXPR_TYPE[] = "Cannot determine source expression type in the 'for-of' statement."; static constexpr char const INVALID_SOURCE_EXPR_TYPE[] = "'For-of' statement source expression is not of iterable type."; -static constexpr char const INVALID_CONST_ASSIGNMENT[] = "Cannot assign a value to a constant variable "; -static constexpr char const ITERATOR_TYPE_ABSENT[] = "Cannot obtain iterator type in 'for-of' statement."; // NOLINTEND(modernize-avoid-c-arrays) -checker::Type *GetIteratorType(ETSChecker *checker, checker::Type *elemType, ir::AstNode *left) -{ - // Just to avoid extra nested level(s) - auto const getIterType = [checker, elemType](ir::VariableDeclarator *const declarator) -> checker::Type * { - if (declarator->TsType() == nullptr) { - if (auto *resolved = checker->FindVariableInFunctionScope(declarator->Id()->AsIdentifier()->Name()); - resolved != nullptr) { - resolved->SetTsType(elemType); - return elemType; - } - } else { - return declarator->TsType(); - } - return nullptr; - }; - - checker::Type *iterType = nullptr; - if (left->IsIdentifier()) { - if (auto *const variable = left->AsIdentifier()->Variable(); variable != nullptr) { - if (variable->Declaration()->IsConstDecl()) { - checker->ThrowTypeError({INVALID_CONST_ASSIGNMENT, variable->Name()}, - variable->Declaration()->Node()->Start()); - } - } - iterType = left->AsIdentifier()->TsType(); - } else if (left->IsVariableDeclaration()) { - if (auto const &declarators = left->AsVariableDeclaration()->Declarators(); !declarators.empty()) { - iterType = getIterType(declarators.front()); - } - } - - if (iterType == nullptr) { - checker->ThrowTypeError(ITERATOR_TYPE_ABSENT, left->Start()); - } - return iterType; -} - checker::Type *ETSAnalyzer::Check(ir::ForOfStatement *const st) const { ETSChecker *checker = GetETSChecker(); @@ -2231,137 +1810,6 @@ checker::Type *ETSAnalyzer::Check(ir::LabelledStatement *st) const return nullptr; } -void CheckArgumentVoidType(checker::Type *&funcReturnType, ETSChecker *checker, const std::string &name, - ir::ReturnStatement *st) -{ - if (name.find(compiler::Signatures::ETS_MAIN_WITH_MANGLE_BEGIN) != std::string::npos) { - if (!funcReturnType->IsETSVoidType() && !funcReturnType->IsIntType()) { - checker->ThrowTypeError("Bad return type, main enable only void or int type.", st->Start()); - } - } -} - -void CheckReturnType(ETSChecker *checker, checker::Type *funcReturnType, checker::Type *argumentType, - ir::Expression *stArgument, bool isAsync) -{ - if (funcReturnType->IsETSVoidType() || funcReturnType == checker->GlobalVoidType()) { - if (argumentType != checker->GlobalVoidType()) { - checker->ThrowTypeError("Unexpected return value, enclosing method return type is void.", - stArgument->Start()); - } - checker::AssignmentContext(checker->Relation(), stArgument, argumentType, funcReturnType, stArgument->Start(), - {"Return statement type is not compatible with the enclosing method's return type."}, - checker::TypeRelationFlag::DIRECT_RETURN); - return; - } - - if (isAsync && funcReturnType->IsETSObjectType() && - funcReturnType->AsETSObjectType()->GetOriginalBaseType() == checker->GlobalBuiltinPromiseType()) { - auto promiseArg = funcReturnType->AsETSObjectType()->TypeArguments()[0]; - checker::AssignmentContext(checker->Relation(), stArgument, argumentType, promiseArg, stArgument->Start(), {}, - checker::TypeRelationFlag::DIRECT_RETURN | checker::TypeRelationFlag::NO_THROW); - if (checker->Relation()->IsTrue()) { - return; - } - } - - const Type *targetType = checker->TryGettingFunctionTypeFromInvokeFunction(funcReturnType); - const Type *sourceType = checker->TryGettingFunctionTypeFromInvokeFunction(argumentType); - checker::AssignmentContext( - checker->Relation(), stArgument, argumentType, funcReturnType, stArgument->Start(), - {"Type '", sourceType, "' is not compatible with the enclosing method's return type '", targetType, "'"}, - checker::TypeRelationFlag::DIRECT_RETURN); -} - -void InferReturnType(ETSChecker *checker, ir::ScriptFunction *containingFunc, checker::Type *&funcReturnType, - ir::Expression *stArgument) -{ - // First (or single) return statement in the function: - funcReturnType = stArgument == nullptr ? checker->GlobalVoidType() : stArgument->Check(checker); - if (funcReturnType->HasTypeFlag(checker::TypeFlag::CONSTANT)) { - // remove CONSTANT type modifier if exists - funcReturnType = - funcReturnType->Instantiate(checker->Allocator(), checker->Relation(), checker->GetGlobalTypesHolder()); - funcReturnType->RemoveTypeFlag(checker::TypeFlag::CONSTANT); - } - /* - when st_argment is ArrowFunctionExpression, need infer type for st_argment - example code: - ``` - return () => {} - ``` - */ - if (stArgument != nullptr && stArgument->IsArrowFunctionExpression()) { - auto arrowFunc = stArgument->AsArrowFunctionExpression(); - auto typeAnnotation = arrowFunc->CreateTypeAnnotation(checker); - funcReturnType = typeAnnotation->GetType(checker); - const Type *sourceType = checker->TryGettingFunctionTypeFromInvokeFunction(arrowFunc->TsType()); - const Type *targetType = checker->TryGettingFunctionTypeFromInvokeFunction(funcReturnType); - - checker::AssignmentContext( - checker->Relation(), arrowFunc, arrowFunc->TsType(), funcReturnType, stArgument->Start(), - {"Type '", sourceType, "' is not compatible with the enclosing method's return type '", targetType, "'"}, - checker::TypeRelationFlag::DIRECT_RETURN); - } - - containingFunc->Signature()->SetReturnType(funcReturnType); - containingFunc->Signature()->RemoveSignatureFlag(checker::SignatureFlags::NEED_RETURN_TYPE); - checker->VarBinder()->AsETSBinder()->BuildFunctionName(containingFunc); - - if (stArgument != nullptr && stArgument->IsObjectExpression()) { - stArgument->AsObjectExpression()->SetPreferredType(funcReturnType); - } -} - -void ProcessReturnStatements(ETSChecker *checker, ir::ScriptFunction *containingFunc, checker::Type *&funcReturnType, - ir::ReturnStatement *st, ir::Expression *stArgument) -{ - funcReturnType = containingFunc->Signature()->ReturnType(); - - if (stArgument == nullptr) { - // previous return statement(s) have value - if (!funcReturnType->IsETSVoidType() && funcReturnType != checker->GlobalVoidType()) { - checker->ThrowTypeError("All return statements in the function should be empty or have a value.", - st->Start()); - } - } else { - // previous return statement(s) don't have any value - if (funcReturnType->IsETSVoidType() || funcReturnType == checker->GlobalVoidType()) { - checker->ThrowTypeError("All return statements in the function should be empty or have a value.", - stArgument->Start()); - } - - const auto name = containingFunc->Scope()->InternalName().Mutf8(); - CheckArgumentVoidType(funcReturnType, checker, name, st); - - if (stArgument->IsObjectExpression()) { - stArgument->AsObjectExpression()->SetPreferredType(funcReturnType); - } - - if (stArgument->IsMemberExpression()) { - checker->SetArrayPreferredTypeForNestedMemberExpressions(stArgument->AsMemberExpression(), funcReturnType); - } - - checker::Type *argumentType = stArgument->Check(checker); - // remove CONSTANT type modifier if exists - if (argumentType->HasTypeFlag(checker::TypeFlag::CONSTANT)) { - argumentType = - argumentType->Instantiate(checker->Allocator(), checker->Relation(), checker->GetGlobalTypesHolder()); - argumentType->RemoveTypeFlag(checker::TypeFlag::CONSTANT); - } - - auto *const relation = checker->Relation(); - relation->SetNode(stArgument); - - if (!relation->IsIdenticalTo(funcReturnType, argumentType)) { - checker->ResolveReturnStatement(funcReturnType, argumentType, containingFunc, st); - } - - relation->SetNode(nullptr); - relation->SetFlags(checker::TypeRelationFlag::NONE); - } -} - checker::Type *ETSAnalyzer::GetFunctionReturnType(ir::ReturnStatement *st, ir::ScriptFunction *containingFunc) const { ASSERT(containingFunc->ReturnTypeAnnotation() != nullptr || containingFunc->Signature()->ReturnType() != nullptr); diff --git a/ets2panda/checker/ETSAnalyzer.h b/ets2panda/checker/ETSAnalyzer.h index 8350294baf..6e399a65b1 100644 --- a/ets2panda/checker/ETSAnalyzer.h +++ b/ets2panda/checker/ETSAnalyzer.h @@ -18,6 +18,7 @@ #include "checker/SemanticAnalyzer.h" #include "checker/ETSchecker.h" +#include "ETSAnalyzerHelpers.h" namespace ark::es2panda::checker { diff --git a/ets2panda/checker/ETSAnalyzerHelpers.cpp b/ets2panda/checker/ETSAnalyzerHelpers.cpp new file mode 100644 index 0000000000..bc4ac968a0 --- /dev/null +++ b/ets2panda/checker/ETSAnalyzerHelpers.cpp @@ -0,0 +1,571 @@ +/* + * Copyright (c) 2021-2024 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. + */ + +#include "ETSAnalyzerHelpers.h" + +namespace ark::es2panda::checker { + +void CheckExtensionIsShadowedInCurrentClassOrInterface(checker::ETSChecker *checker, checker::ETSObjectType *objType, + ir::ScriptFunction *extensionFunc, checker::Signature *signature) +{ + const auto methodName = extensionFunc->Id()->Name(); + // Only check if there are class and interfaces' instance methods which would shadow instance extension method + auto *const variable = objType->GetOwnProperty(methodName); + if (variable == nullptr) { + return; + } + + const auto *const funcType = variable->TsType()->AsETSFunctionType(); + for (auto *funcSignature : funcType->CallSignatures()) { + signature->SetReturnType(funcSignature->ReturnType()); + if (!checker->Relation()->IsCompatibleTo(signature, funcSignature)) { + continue; + } + + checker->ReportWarning({"extension is shadowed by a instance member function '", funcType->Name(), + funcSignature, "' in class ", objType->Name()}, + extensionFunc->Body()->Start()); + return; + } +} + +void CheckExtensionIsShadowedByMethod(checker::ETSChecker *checker, checker::ETSObjectType *objType, + ir::ScriptFunction *extensionFunc, checker::Signature *signature) +{ + if (objType == nullptr) { + return; + } + + CheckExtensionIsShadowedInCurrentClassOrInterface(checker, objType, extensionFunc, signature); + + for (auto *interface : objType->Interfaces()) { + CheckExtensionIsShadowedByMethod(checker, interface, extensionFunc, signature); + } + + CheckExtensionIsShadowedByMethod(checker, objType->SuperType(), extensionFunc, signature); +} + +void CheckExtensionMethod(checker::ETSChecker *checker, ir::ScriptFunction *extensionFunc, ir::MethodDefinition *node) +{ + auto *const classType = checker->GetApparentType(extensionFunc->Signature()->Params()[0]->TsType()); + if (!classType->IsETSObjectType() || + (!classType->AsETSObjectType()->HasObjectFlag(checker::ETSObjectFlags::CLASS) && + !classType->AsETSObjectType()->HasObjectFlag(checker::ETSObjectFlags::INTERFACE))) { + checker->ThrowTypeError("Extension function can only defined for class and interface type.", node->Start()); + } + + checker->AddStatus(checker::CheckerStatus::IN_INSTANCE_EXTENSION_METHOD); + + checker::SignatureInfo *originalExtensionSigInfo = checker->Allocator()->New( + extensionFunc->Signature()->GetSignatureInfo(), checker->Allocator()); + originalExtensionSigInfo->minArgCount -= 1; + originalExtensionSigInfo->params.erase(originalExtensionSigInfo->params.begin()); + checker::Signature *originalExtensionSigature = + checker->CreateSignature(originalExtensionSigInfo, extensionFunc->Signature()->ReturnType(), extensionFunc); + + CheckExtensionIsShadowedByMethod(checker, classType->AsETSObjectType(), extensionFunc, originalExtensionSigature); +} + +void DoBodyTypeChecking(ETSChecker *checker, ir::MethodDefinition *node, ir::ScriptFunction *scriptFunc) +{ + if (scriptFunc->HasBody() && (node->IsNative() || node->IsAbstract() || node->IsDeclare())) { + checker->ThrowTypeError("Native, Abstract and Declare methods cannot have body.", scriptFunc->Body()->Start()); + } + + if (scriptFunc->IsAsyncFunc()) { + auto *retType = scriptFunc->Signature()->ReturnType(); + if (!retType->IsETSObjectType() || + retType->AsETSObjectType()->GetOriginalBaseType() != checker->GlobalBuiltinPromiseType()) { + checker->ThrowTypeError("Return type of async function must be 'Promise'.", scriptFunc->Start()); + } + } else if (scriptFunc->HasBody() && !scriptFunc->IsExternal()) { + checker::ScopeContext scopeCtx(checker, scriptFunc->Scope()); + checker::SavedCheckerContext savedContext(checker, checker->Context().Status(), + checker->Context().ContainingClass()); + checker->Context().SetContainingSignature(checker->GetSignatureFromMethodDefinition(node)); + + if (node->IsStatic() && !node->IsConstructor() && + !checker->Context().ContainingClass()->HasObjectFlag(checker::ETSObjectFlags::GLOBAL)) { + checker->AddStatus(checker::CheckerStatus::IN_STATIC_CONTEXT); + } + + if (node->IsConstructor()) { + checker->AddStatus(checker::CheckerStatus::IN_CONSTRUCTOR); + } + + if (node->IsExtensionMethod()) { + CheckExtensionMethod(checker, scriptFunc, node); + } + + scriptFunc->Body()->Check(checker); + + // In case of inferred function's return type set it forcedly to all return statements; + if (scriptFunc->Signature()->HasSignatureFlag(checker::SignatureFlags::INFERRED_RETURN_TYPE) && + scriptFunc->ReturnTypeAnnotation() == nullptr && scriptFunc->Body() != nullptr && + scriptFunc->Body()->IsStatement()) { + scriptFunc->Body()->AsStatement()->SetReturnType(checker, scriptFunc->Signature()->ReturnType()); + } + + checker->Context().SetContainingSignature(nullptr); + } +} + +void CheckPredefinedMethodReturnType(ETSChecker *checker, ir::ScriptFunction *scriptFunc) +{ + auto const &position = scriptFunc->Start(); + + auto const hasIteratorInterface = [](ETSObjectType const *const objectType) -> bool { + for (auto const *const interface : objectType->Interfaces()) { + if (interface->Name().Is(ir::ITERATOR_INTERFACE_NAME)) { + return true; + } + } + return false; + }; + + if (scriptFunc->IsSetter() && (scriptFunc->Signature()->ReturnType() != checker->GlobalVoidType())) { + checker->ThrowTypeError("Setter must have void return type", position); + } + + if (scriptFunc->IsGetter() && (scriptFunc->Signature()->ReturnType() == checker->GlobalVoidType())) { + checker->ThrowTypeError("Getter must return a value", position); + } + + auto const name = scriptFunc->Id()->Name(); + auto const methodName = std::string {ir::PREDEFINED_METHOD} + std::string {name.Utf8()}; + + if (name.Is(compiler::Signatures::GET_INDEX_METHOD)) { + if (scriptFunc->Signature()->ReturnType() == checker->GlobalVoidType()) { + checker->ThrowTypeError(methodName + "' shouldn't have void return type.", position); + } + } else if (name.Is(compiler::Signatures::SET_INDEX_METHOD)) { + if (scriptFunc->Signature()->ReturnType() != checker->GlobalVoidType()) { + checker->ThrowTypeError(methodName + "' should have void return type.", position); + } + } else if (name.Is(compiler::Signatures::ITERATOR_METHOD)) { + auto const *returnType = scriptFunc->Signature()->ReturnType(); + + if (returnType == nullptr) { + checker->ThrowTypeError(methodName + "' doesn't have return type.", position); + } + + if (returnType->IsETSTypeParameter()) { + returnType = checker->GetApparentType(returnType->AsETSTypeParameter()->GetConstraintType()); + } + + if (returnType->IsETSUnionType() && + returnType->AsETSUnionType()->AllOfConstituentTypes( + [hasIteratorInterface](checker::Type const *const constituentType) -> bool { + return constituentType->IsETSObjectType() && + hasIteratorInterface(constituentType->AsETSObjectType()); + })) { + return; + } + + if (returnType->IsETSObjectType() && hasIteratorInterface(returnType->AsETSObjectType())) { + return; + } + + checker->ThrowTypeError(methodName + "' has invalid return type.", position); + } +} + +checker::Type *InitAnonymousLambdaCallee(checker::ETSChecker *checker, ir::Expression *callee, + checker::Type *calleeType) +{ + auto *const arrowFunc = callee->AsArrowFunctionExpression()->Function(); + + ArenaVector params {checker->Allocator()->Adapter()}; + checker->CopyParams(arrowFunc->Params(), params); + + auto *typeAnnotation = arrowFunc->ReturnTypeAnnotation(); + if (typeAnnotation != nullptr) { + typeAnnotation = typeAnnotation->Clone(checker->Allocator(), nullptr); + typeAnnotation->SetTsType(arrowFunc->ReturnTypeAnnotation()->TsType()); + } + + auto signature = ir::FunctionSignature(nullptr, std::move(params), typeAnnotation); + auto *funcType = checker->AllocNode(std::move(signature), ir::ScriptFunctionFlags::NONE); + + funcType->SetScope(arrowFunc->Scope()->AsFunctionScope()->ParamScope()); + auto *const funcIface = funcType->Check(checker); + checker->Relation()->SetNode(callee); + checker->Relation()->IsAssignableTo(calleeType, funcIface); + return funcIface; +} + +checker::Signature *ResolveCallExtensionFunction(checker::ETSFunctionType *functionType, checker::ETSChecker *checker, + ir::CallExpression *expr) +{ + auto *memberExpr = expr->Callee()->AsMemberExpression(); + expr->Arguments().insert(expr->Arguments().begin(), memberExpr->Object()); + auto *signature = + checker->ResolveCallExpressionAndTrailingLambda(functionType->CallSignatures(), expr, expr->Start()); + if (!signature->Function()->IsExtensionMethod()) { + checker->ThrowTypeError({"Property '", memberExpr->Property()->AsIdentifier()->Name(), + "' does not exist on type '", memberExpr->ObjType()->Name(), "'"}, + memberExpr->Property()->Start()); + } + expr->SetSignature(signature); + expr->SetCallee(memberExpr->Property()); + memberExpr->Property()->AsIdentifier()->SetParent(expr); + expr->Arguments()[0]->SetParent(expr); + checker->HandleUpdatedCallExpressionNode(expr); + // Set TsType for new Callee(original member expression's Object) + expr->Callee()->Check(checker); + return signature; +} + +checker::Signature *ResolveCallForETSExtensionFuncHelperType(checker::ETSExtensionFuncHelperType *type, + checker::ETSChecker *checker, ir::CallExpression *expr) +{ + checker::Signature *signature = checker->ResolveCallExpressionAndTrailingLambda( + type->ClassMethodType()->CallSignatures(), expr, expr->Start(), checker::TypeRelationFlag::NO_THROW); + + if (signature != nullptr) { + return signature; + } + + return ResolveCallExtensionFunction(type->ExtensionMethodType(), checker, expr); +} + +ArenaVector GetUnionTypeSignatures(ETSChecker *checker, checker::ETSUnionType *etsUnionType) +{ + ArenaVector callSignatures(checker->Allocator()->Adapter()); + + for (auto *constituentType : etsUnionType->ConstituentTypes()) { + if (constituentType->IsETSObjectType()) { + ArenaVector tmpCallSignatures(checker->Allocator()->Adapter()); + tmpCallSignatures = constituentType->AsETSObjectType() + ->GetOwnProperty("invoke") + ->TsType() + ->AsETSFunctionType() + ->CallSignatures(); + callSignatures.insert(callSignatures.end(), tmpCallSignatures.begin(), tmpCallSignatures.end()); + } + if (constituentType->IsETSFunctionType()) { + ArenaVector tmpCallSignatures(checker->Allocator()->Adapter()); + tmpCallSignatures = constituentType->AsETSFunctionType()->CallSignatures(); + callSignatures.insert(callSignatures.end(), tmpCallSignatures.begin(), tmpCallSignatures.end()); + } + if (constituentType->IsETSUnionType()) { + ArenaVector tmpCallSignatures(checker->Allocator()->Adapter()); + tmpCallSignatures = GetUnionTypeSignatures(checker, constituentType->AsETSUnionType()); + callSignatures.insert(callSignatures.end(), tmpCallSignatures.begin(), tmpCallSignatures.end()); + } + } + + return callSignatures; +} + +ArenaVector &ChooseSignatures(ETSChecker *checker, checker::Type *calleeType, + bool isConstructorCall, bool isFunctionalInterface, + bool isUnionTypeWithFunctionalInterface) +{ + static ArenaVector unionSignatures(checker->Allocator()->Adapter()); + unionSignatures.clear(); + if (isConstructorCall) { + return calleeType->AsETSObjectType()->ConstructSignatures(); + } + if (isFunctionalInterface) { + return calleeType->AsETSObjectType() + ->GetOwnProperty(FUNCTIONAL_INTERFACE_INVOKE_METHOD_NAME) + ->TsType() + ->AsETSFunctionType() + ->CallSignatures(); + } + if (isUnionTypeWithFunctionalInterface) { + unionSignatures = GetUnionTypeSignatures(checker, calleeType->AsETSUnionType()); + return unionSignatures; + } + return calleeType->AsETSFunctionType()->CallSignatures(); +} + +checker::ETSObjectType *ChooseCalleeObj(ETSChecker *checker, ir::CallExpression *expr, checker::Type *calleeType, + bool isConstructorCall) +{ + if (isConstructorCall) { + return calleeType->AsETSObjectType(); + } + if (expr->Callee()->IsIdentifier()) { + return checker->Context().ContainingClass(); + } + ASSERT(expr->Callee()->IsMemberExpression()); + return expr->Callee()->AsMemberExpression()->ObjType(); +} + +void ProcessExclamationMark(ETSChecker *checker, ir::UnaryExpression *expr, checker::Type *operandType) +{ + if (checker->IsNullLikeOrVoidExpression(expr->Argument())) { + auto tsType = checker->CreateETSBooleanType(true); + tsType->AddTypeFlag(checker::TypeFlag::CONSTANT); + expr->SetTsType(tsType); + return; + } + + if (operandType == nullptr || !operandType->IsConditionalExprType()) { + checker->ThrowTypeError("Bad operand type, the type of the operand must be boolean type.", + expr->Argument()->Start()); + } + + auto exprRes = operandType->ResolveConditionExpr(); + if (std::get<0>(exprRes)) { + auto tsType = checker->CreateETSBooleanType(!std::get<1>(exprRes)); + tsType->AddTypeFlag(checker::TypeFlag::CONSTANT); + expr->SetTsType(tsType); + return; + } + + expr->SetTsType(checker->GlobalETSBooleanType()); +} + +void SetTsTypeForUnaryExpression(ETSChecker *checker, ir::UnaryExpression *expr, checker::Type *operandType, + checker::Type *argType) +{ + switch (expr->OperatorType()) { + case lexer::TokenType::PUNCTUATOR_MINUS: + case lexer::TokenType::PUNCTUATOR_PLUS: { + if (operandType == nullptr || !operandType->HasTypeFlag(checker::TypeFlag::ETS_NUMERIC)) { + checker->ThrowTypeError("Bad operand type, the type of the operand must be numeric type.", + expr->Argument()->Start()); + } + + if (operandType->HasTypeFlag(checker::TypeFlag::CONSTANT) && + expr->OperatorType() == lexer::TokenType::PUNCTUATOR_MINUS) { + expr->SetTsType(checker->NegateNumericType(operandType, expr)); + break; + } + + expr->SetTsType(operandType); + break; + } + case lexer::TokenType::PUNCTUATOR_TILDE: { + if (operandType == nullptr || !operandType->HasTypeFlag(checker::TypeFlag::ETS_NUMERIC)) { + checker->ThrowTypeError("Bad operand type, the type of the operand must be numeric type.", + expr->Argument()->Start()); + } + + if (operandType->HasTypeFlag(checker::TypeFlag::CONSTANT)) { + expr->SetTsType(checker->BitwiseNegateNumericType(operandType, expr)); + break; + } + + expr->SetTsType(checker->SelectGlobalIntegerTypeForNumeric(operandType)); + break; + } + case lexer::TokenType::PUNCTUATOR_EXCLAMATION_MARK: { + ProcessExclamationMark(checker, expr, operandType); + break; + } + case lexer::TokenType::PUNCTUATOR_DOLLAR_DOLLAR: { + expr->SetTsType(argType); + break; + } + default: { + UNREACHABLE(); + break; + } + } +} + +checker::ETSObjectType *CreateSyntheticType(ETSChecker *checker, util::StringView const &syntheticName, + checker::ETSObjectType *lastObjectType, ir::Identifier *id) +{ + auto *syntheticObjType = checker->Allocator()->New( + checker->Allocator(), syntheticName, syntheticName, id, checker::ETSObjectFlags::NO_OPTS, checker->Relation()); + + auto *classDecl = checker->Allocator()->New(syntheticName); + varbinder::LocalVariable *var = + checker->Allocator()->New(classDecl, varbinder::VariableFlags::CLASS); + var->SetTsType(syntheticObjType); + lastObjectType->AddProperty(var); + syntheticObjType->SetEnclosingType(lastObjectType); + return syntheticObjType; +} + +// NOLINTBEGIN(modernize-avoid-c-arrays) +static constexpr char const INVALID_CONST_ASSIGNMENT[] = "Cannot assign a value to a constant variable "; +static constexpr char const ITERATOR_TYPE_ABSENT[] = "Cannot obtain iterator type in 'for-of' statement."; +// NOLINTEND(modernize-avoid-c-arrays) + +checker::Type *GetIteratorType(ETSChecker *checker, checker::Type *elemType, ir::AstNode *left) +{ + // Just to avoid extra nested level(s) + auto const getIterType = [checker, elemType](ir::VariableDeclarator *const declarator) -> checker::Type * { + if (declarator->TsType() == nullptr) { + if (auto *resolved = checker->FindVariableInFunctionScope(declarator->Id()->AsIdentifier()->Name()); + resolved != nullptr) { + resolved->SetTsType(elemType); + return elemType; + } + } else { + return declarator->TsType(); + } + return nullptr; + }; + + checker::Type *iterType = nullptr; + if (left->IsIdentifier()) { + if (auto *const variable = left->AsIdentifier()->Variable(); variable != nullptr) { + if (variable->Declaration()->IsConstDecl()) { + checker->ThrowTypeError({INVALID_CONST_ASSIGNMENT, variable->Name()}, + variable->Declaration()->Node()->Start()); + } + } + iterType = left->AsIdentifier()->TsType(); + } else if (left->IsVariableDeclaration()) { + if (auto const &declarators = left->AsVariableDeclaration()->Declarators(); !declarators.empty()) { + iterType = getIterType(declarators.front()); + } + } + + if (iterType == nullptr) { + checker->ThrowTypeError(ITERATOR_TYPE_ABSENT, left->Start()); + } + return iterType; +} + +void CheckArgumentVoidType(checker::Type *&funcReturnType, ETSChecker *checker, const std::string &name, + ir::ReturnStatement *st) +{ + if (name.find(compiler::Signatures::ETS_MAIN_WITH_MANGLE_BEGIN) != std::string::npos) { + if (!funcReturnType->IsETSVoidType() && !funcReturnType->IsIntType()) { + checker->ThrowTypeError("Bad return type, main enable only void or int type.", st->Start()); + } + } +} + +void CheckReturnType(ETSChecker *checker, checker::Type *funcReturnType, checker::Type *argumentType, + ir::Expression *stArgument, bool isAsync) +{ + if (funcReturnType->IsETSVoidType() || funcReturnType == checker->GlobalVoidType()) { + if (argumentType != checker->GlobalVoidType()) { + checker->ThrowTypeError("Unexpected return value, enclosing method return type is void.", + stArgument->Start()); + } + checker::AssignmentContext(checker->Relation(), stArgument, argumentType, funcReturnType, stArgument->Start(), + {"Return statement type is not compatible with the enclosing method's return type."}, + checker::TypeRelationFlag::DIRECT_RETURN); + return; + } + + if (isAsync && funcReturnType->IsETSObjectType() && + funcReturnType->AsETSObjectType()->GetOriginalBaseType() == checker->GlobalBuiltinPromiseType()) { + auto promiseArg = funcReturnType->AsETSObjectType()->TypeArguments()[0]; + checker::AssignmentContext(checker->Relation(), stArgument, argumentType, promiseArg, stArgument->Start(), {}, + checker::TypeRelationFlag::DIRECT_RETURN | checker::TypeRelationFlag::NO_THROW); + if (checker->Relation()->IsTrue()) { + return; + } + } + + const Type *targetType = checker->TryGettingFunctionTypeFromInvokeFunction(funcReturnType); + const Type *sourceType = checker->TryGettingFunctionTypeFromInvokeFunction(argumentType); + checker::AssignmentContext( + checker->Relation(), stArgument, argumentType, funcReturnType, stArgument->Start(), + {"Type '", sourceType, "' is not compatible with the enclosing method's return type '", targetType, "'"}, + checker::TypeRelationFlag::DIRECT_RETURN); +} + +void InferReturnType(ETSChecker *checker, ir::ScriptFunction *containingFunc, checker::Type *&funcReturnType, + ir::Expression *stArgument) +{ + // First (or single) return statement in the function: + funcReturnType = stArgument == nullptr ? checker->GlobalVoidType() : stArgument->Check(checker); + if (funcReturnType->HasTypeFlag(checker::TypeFlag::CONSTANT)) { + // remove CONSTANT type modifier if exists + funcReturnType = + funcReturnType->Instantiate(checker->Allocator(), checker->Relation(), checker->GetGlobalTypesHolder()); + funcReturnType->RemoveTypeFlag(checker::TypeFlag::CONSTANT); + } + /* + when st_argment is ArrowFunctionExpression, need infer type for st_argment + example code: + ``` + return () => {} + ``` + */ + if (stArgument != nullptr && stArgument->IsArrowFunctionExpression()) { + auto arrowFunc = stArgument->AsArrowFunctionExpression(); + auto typeAnnotation = arrowFunc->CreateTypeAnnotation(checker); + funcReturnType = typeAnnotation->GetType(checker); + const Type *sourceType = checker->TryGettingFunctionTypeFromInvokeFunction(arrowFunc->TsType()); + const Type *targetType = checker->TryGettingFunctionTypeFromInvokeFunction(funcReturnType); + + checker::AssignmentContext( + checker->Relation(), arrowFunc, arrowFunc->TsType(), funcReturnType, stArgument->Start(), + {"Type '", sourceType, "' is not compatible with the enclosing method's return type '", targetType, "'"}, + checker::TypeRelationFlag::DIRECT_RETURN); + } + + containingFunc->Signature()->SetReturnType(funcReturnType); + containingFunc->Signature()->RemoveSignatureFlag(checker::SignatureFlags::NEED_RETURN_TYPE); + checker->VarBinder()->AsETSBinder()->BuildFunctionName(containingFunc); + + if (stArgument != nullptr && stArgument->IsObjectExpression()) { + stArgument->AsObjectExpression()->SetPreferredType(funcReturnType); + } +} + +void ProcessReturnStatements(ETSChecker *checker, ir::ScriptFunction *containingFunc, checker::Type *&funcReturnType, + ir::ReturnStatement *st, ir::Expression *stArgument) +{ + funcReturnType = containingFunc->Signature()->ReturnType(); + + if (stArgument == nullptr) { + // previous return statement(s) have value + if (!funcReturnType->IsETSVoidType() && funcReturnType != checker->GlobalVoidType()) { + checker->ThrowTypeError("All return statements in the function should be empty or have a value.", + st->Start()); + } + } else { + // previous return statement(s) don't have any value + if (funcReturnType->IsETSVoidType() || funcReturnType == checker->GlobalVoidType()) { + checker->ThrowTypeError("All return statements in the function should be empty or have a value.", + stArgument->Start()); + } + + const auto name = containingFunc->Scope()->InternalName().Mutf8(); + CheckArgumentVoidType(funcReturnType, checker, name, st); + + if (stArgument->IsObjectExpression()) { + stArgument->AsObjectExpression()->SetPreferredType(funcReturnType); + } + + if (stArgument->IsMemberExpression()) { + checker->SetArrayPreferredTypeForNestedMemberExpressions(stArgument->AsMemberExpression(), funcReturnType); + } + + checker::Type *argumentType = stArgument->Check(checker); + // remove CONSTANT type modifier if exists + if (argumentType->HasTypeFlag(checker::TypeFlag::CONSTANT)) { + argumentType = + argumentType->Instantiate(checker->Allocator(), checker->Relation(), checker->GetGlobalTypesHolder()); + argumentType->RemoveTypeFlag(checker::TypeFlag::CONSTANT); + } + + auto *const relation = checker->Relation(); + relation->SetNode(stArgument); + + if (!relation->IsIdenticalTo(funcReturnType, argumentType)) { + checker->ResolveReturnStatement(funcReturnType, argumentType, containingFunc, st); + } + + relation->SetNode(nullptr); + relation->SetFlags(checker::TypeRelationFlag::NONE); + } +} + +} // namespace ark::es2panda::checker diff --git a/ets2panda/checker/ETSAnalyzerHelpers.h b/ets2panda/checker/ETSAnalyzerHelpers.h new file mode 100644 index 0000000000..c7669d7ef9 --- /dev/null +++ b/ets2panda/checker/ETSAnalyzerHelpers.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2021-2024 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. + */ + +#ifndef ES2PANDA_CHECKER_ETSANALYZERHELPERS_H +#define ES2PANDA_CHECKER_ETSANALYZERHELPERS_H + +#include "checker/types/type.h" +#include "varbinder/ETSBinder.h" +#include "checker/ETSchecker.h" +#include "checker/ets/castingContext.h" +#include "checker/ets/typeRelationContext.h" +#include "util/helpers.h" + +#include + +namespace ark::es2panda::checker { +void CheckExtensionIsShadowedInCurrentClassOrInterface(checker::ETSChecker *checker, checker::ETSObjectType *objType, + ir::ScriptFunction *extensionFunc, + checker::Signature *signature); +void CheckExtensionIsShadowedByMethod(checker::ETSChecker *checker, checker::ETSObjectType *objType, + ir::ScriptFunction *extensionFunc, checker::Signature *signature); +void CheckExtensionMethod(checker::ETSChecker *checker, ir::ScriptFunction *extensionFunc, ir::MethodDefinition *node); +void DoBodyTypeChecking(ETSChecker *checker, ir::MethodDefinition *node, ir::ScriptFunction *scriptFunc); +void CheckPredefinedMethodReturnType(ETSChecker *checker, ir::ScriptFunction *scriptFunc); +checker::Type *InitAnonymousLambdaCallee(checker::ETSChecker *checker, ir::Expression *callee, + checker::Type *calleeType); +checker::Signature *ResolveCallExtensionFunction(checker::ETSFunctionType *functionType, checker::ETSChecker *checker, + ir::CallExpression *expr); +checker::Signature *ResolveCallForETSExtensionFuncHelperType(checker::ETSExtensionFuncHelperType *type, + checker::ETSChecker *checker, ir::CallExpression *expr); +ArenaVector GetUnionTypeSignatures(ETSChecker *checker, checker::ETSUnionType *etsUnionType); +ArenaVector &ChooseSignatures(ETSChecker *checker, checker::Type *calleeType, + bool isConstructorCall, bool isFunctionalInterface, + bool isUnionTypeWithFunctionalInterface); +checker::ETSObjectType *ChooseCalleeObj(ETSChecker *checker, ir::CallExpression *expr, checker::Type *calleeType, + bool isConstructorCall); +void ProcessExclamationMark(ETSChecker *checker, ir::UnaryExpression *expr, checker::Type *operandType); +void SetTsTypeForUnaryExpression(ETSChecker *checker, ir::UnaryExpression *expr, checker::Type *operandType, + checker::Type *argType); +checker::ETSObjectType *CreateSyntheticType(ETSChecker *checker, util::StringView const &syntheticName, + checker::ETSObjectType *lastObjectType, ir::Identifier *id); +checker::Type *GetIteratorType(ETSChecker *checker, checker::Type *elemType, ir::AstNode *left); +void CheckArgumentVoidType(checker::Type *&funcReturnType, ETSChecker *checker, const std::string &name, + ir::ReturnStatement *st); +void CheckReturnType(ETSChecker *checker, checker::Type *funcReturnType, checker::Type *argumentType, + ir::Expression *stArgument, bool isAsync); +void InferReturnType(ETSChecker *checker, ir::ScriptFunction *containingFunc, checker::Type *&funcReturnType, + ir::Expression *stArgument); +void ProcessReturnStatements(ETSChecker *checker, ir::ScriptFunction *containingFunc, checker::Type *&funcReturnType, + ir::ReturnStatement *st, ir::Expression *stArgument); +} // namespace ark::es2panda::checker + +#endif // ES2PANDA_CHECKER_ETSANALYZERHELPERS_H -- Gitee From 2f5a4d09a434ab16c343fca3a1b074f40a3059e7 Mon Sep 17 00:00:00 2001 From: Tatiana Pivovarova Date: Mon, 4 Mar 2024 16:29:47 +0300 Subject: [PATCH 11/12] Fix tests after void reverting Signed-off-by: Tatiana Pivovarova --- .../StaticFieldAndMethodSameName-expected.txt | 60 +------------------ ...dAndMethodSameNameInheritance-expected.txt | 60 +------------------ 2 files changed, 4 insertions(+), 116 deletions(-) diff --git a/ets2panda/test/parser/ets/StaticFieldAndMethodSameName-expected.txt b/ets2panda/test/parser/ets/StaticFieldAndMethodSameName-expected.txt index 6423a67528..9f83d28f3c 100644 --- a/ets2panda/test/parser/ets/StaticFieldAndMethodSameName-expected.txt +++ b/ets2panda/test/parser/ets/StaticFieldAndMethodSameName-expected.txt @@ -159,35 +159,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 1 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 31, @@ -525,35 +497,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 34, - "column": 1 - }, - "end": { - "line": 34, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 34, - "column": 1 - }, - "end": { - "line": 34, - "column": 1 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 34, diff --git a/ets2panda/test/parser/ets/StaticFieldAndMethodSameNameInheritance-expected.txt b/ets2panda/test/parser/ets/StaticFieldAndMethodSameNameInheritance-expected.txt index cfaa72be99..bcf55316b9 100644 --- a/ets2panda/test/parser/ets/StaticFieldAndMethodSameNameInheritance-expected.txt +++ b/ets2panda/test/parser/ets/StaticFieldAndMethodSameNameInheritance-expected.txt @@ -68,35 +68,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 1 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 30, @@ -702,35 +674,7 @@ "expression": false, "params": [], "returnType": { - "type": "ETSTypeReference", - "part": { - "type": "ETSTypeReferencePart", - "name": { - "type": "Identifier", - "name": "void", - "decorators": [], - "loc": { - "start": { - "line": 37, - "column": 1 - }, - "end": { - "line": 37, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 37, - "column": 1 - }, - "end": { - "line": 37, - "column": 1 - } - } - }, + "type": "ETSPrimitiveType", "loc": { "start": { "line": 37, -- Gitee From 9f1289781bf171bfcd74c02bb01e8ec67a647b61 Mon Sep 17 00:00:00 2001 From: vagin ivan Date: Tue, 5 Mar 2024 12:12:54 +0300 Subject: [PATCH 12/12] [ets2panda] ets2ts declgen improvements * Moved ets2ts declgen into separate executable * Supported getters and setters Signed-off-by: vagin ivan --- ets2panda/BUILD.gn | 2 - ets2panda/CMakeLists.txt | 3 +- ets2panda/compiler/core/compilerImpl.cpp | 1 - .../lowering/ets/generateDeclarations.cpp | 31 ---- .../compiler/lowering/ets/lambdaLowering.cpp | 3 +- ets2panda/compiler/lowering/phase.cpp | 3 - ets2panda/declgen_ets2ts/BUILD.gn | 58 +++++++ ets2panda/declgen_ets2ts/CMakeLists.txt | 29 ++++ .../declgenEts2Ts.cpp | 162 ++++++++++-------- .../{util => declgen_ets2ts}/declgenEts2Ts.h | 17 +- .../main.cpp} | 47 +++-- ets2panda/es2panda.h | 1 - ets2panda/util/options.cpp | 5 +- ets2panda/util/options.h | 7 +- 14 files changed, 221 insertions(+), 148 deletions(-) delete mode 100644 ets2panda/compiler/lowering/ets/generateDeclarations.cpp create mode 100644 ets2panda/declgen_ets2ts/BUILD.gn create mode 100644 ets2panda/declgen_ets2ts/CMakeLists.txt rename ets2panda/{util => declgen_ets2ts}/declgenEts2Ts.cpp (82%) rename ets2panda/{util => declgen_ets2ts}/declgenEts2Ts.h (86%) rename ets2panda/{compiler/lowering/ets/generateDeclarations.h => declgen_ets2ts/main.cpp} (33%) diff --git a/ets2panda/BUILD.gn b/ets2panda/BUILD.gn index 8d5a3a07dc..4d4794b949 100644 --- a/ets2panda/BUILD.gn +++ b/ets2panda/BUILD.gn @@ -162,7 +162,6 @@ libes2panda_sources = [ "compiler/lowering/ets/bigintLowering.cpp", "compiler/lowering/ets/defaultParameterLowering.cpp", "compiler/lowering/ets/expandBrackets.cpp", - "compiler/lowering/ets/generateDeclarations.cpp", "compiler/lowering/ets/interfacePropertyDeclarations.cpp", "compiler/lowering/ets/lambdaLowering.cpp", "compiler/lowering/ets/localClassLowering.cpp", @@ -373,7 +372,6 @@ libes2panda_sources = [ "parser/statementParser.cpp", "util/arktsconfig.cpp", "util/bitset.cpp", - "util/declgenEts2Ts.cpp", "util/errorHandler.cpp", "util/helpers.cpp", "util/path.cpp", diff --git a/ets2panda/CMakeLists.txt b/ets2panda/CMakeLists.txt index a4868c6a84..19b0a13a77 100644 --- a/ets2panda/CMakeLists.txt +++ b/ets2panda/CMakeLists.txt @@ -156,7 +156,6 @@ set(ES2PANDA_LIB_SRC compiler/lowering/ets/topLevelStmts/topLevelStmts.cpp compiler/lowering/ets/lambdaLowering.cpp compiler/lowering/ets/localClassLowering.cpp - compiler/lowering/ets/generateDeclarations.cpp compiler/lowering/ets/objectIndexAccess.cpp compiler/lowering/ets/objectIterator.cpp compiler/lowering/ets/interfacePropertyDeclarations.cpp @@ -451,7 +450,6 @@ set(ES2PANDA_LIB_SRC checker/types/ts/voidType.cpp util/arktsconfig.cpp util/bitset.cpp - util/declgenEts2Ts.cpp util/errorHandler.cpp util/helpers.cpp util/path.cpp @@ -532,6 +530,7 @@ panda_add_sanitizers(TARGET es2panda-public SANITIZERS ${PANDA_SANITIZERS_LIST}) add_subdirectory(aot) +add_subdirectory(declgen_ets2ts) if(PANDA_WITH_TESTS) add_subdirectory(test) diff --git a/ets2panda/compiler/core/compilerImpl.cpp b/ets2panda/compiler/core/compilerImpl.cpp index 32196c49f7..305f24ead9 100644 --- a/ets2panda/compiler/core/compilerImpl.cpp +++ b/ets2panda/compiler/core/compilerImpl.cpp @@ -44,7 +44,6 @@ #include "checker/ASchecker.h" #include "checker/JSchecker.h" #include "public/public.h" -#include "util/declgenEts2Ts.h" namespace ark::es2panda::compiler { diff --git a/ets2panda/compiler/lowering/ets/generateDeclarations.cpp b/ets2panda/compiler/lowering/ets/generateDeclarations.cpp deleted file mode 100644 index bddef8dd24..0000000000 --- a/ets2panda/compiler/lowering/ets/generateDeclarations.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2021-2024 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. - */ - -#include "generateDeclarations.h" -#include "checker/checker.h" -#include "compiler/core/ASTVerifier.h" -#include "compiler/core/compilerContext.h" -#include "util/declgenEts2Ts.h" - -namespace ark::es2panda::compiler { - -bool GenerateTsDeclarationsPhase::Perform(public_lib::Context *ctx, parser::Program *program) -{ - auto *checker = ctx->checker; - return (ctx->compilerContext->Options()->tsDeclOut.empty() || - util::GenerateTsDeclarations(checker->AsETSChecker(), program, ctx->compilerContext->Options()->tsDeclOut)); -} - -} // namespace ark::es2panda::compiler diff --git a/ets2panda/compiler/lowering/ets/lambdaLowering.cpp b/ets2panda/compiler/lowering/ets/lambdaLowering.cpp index d3eae59018..d338f74efb 100644 --- a/ets2panda/compiler/lowering/ets/lambdaLowering.cpp +++ b/ets2panda/compiler/lowering/ets/lambdaLowering.cpp @@ -14,10 +14,9 @@ */ #include "lambdaLowering.h" -#include "checker/checker.h" +#include "checker/ETSchecker.h" #include "compiler/core/ASTVerifier.h" #include "compiler/core/compilerContext.h" -#include "util/declgenEts2Ts.h" namespace ark::es2panda::compiler { static ir::AstNode *ConvertExpression(checker::ETSChecker *const checker, ir::ArrowFunctionExpression *const arrow) diff --git a/ets2panda/compiler/lowering/phase.cpp b/ets2panda/compiler/lowering/phase.cpp index d6f7b0594e..82db8a4207 100644 --- a/ets2panda/compiler/lowering/phase.cpp +++ b/ets2panda/compiler/lowering/phase.cpp @@ -21,7 +21,6 @@ #include "compiler/lowering/ets/expandBrackets.h" #include "compiler/lowering/ets/recordLowering.h" #include "compiler/lowering/ets/topLevelStmts/topLevelStmts.h" -#include "compiler/lowering/ets/generateDeclarations.h" #include "compiler/lowering/ets/lambdaLowering.h" #include "compiler/lowering/ets/interfacePropertyDeclarations.h" #include "compiler/lowering/ets/objectIndexAccess.h" @@ -55,7 +54,6 @@ std::vector GetTrivialPhaseList() static BigIntLowering g_bigintLowering; static InterfacePropertyDeclarationsPhase g_interfacePropDeclPhase; -static GenerateTsDeclarationsPhase g_generateTsDeclarationsPhase; static LambdaConstructionPhase g_lambdaConstructionPhase; static OpAssignmentLowering g_opAssignmentLowering; static ObjectIndexLowering g_objectIndexLowering; @@ -97,7 +95,6 @@ std::vector GetETSPhaseList() &g_interfacePropDeclPhase, &g_checkerPhase, &g_pluginsAfterCheck, - &g_generateTsDeclarationsPhase, &g_opAssignmentLowering, &g_recordLowering, &g_objectIndexLowering, diff --git a/ets2panda/declgen_ets2ts/BUILD.gn b/ets2panda/declgen_ets2ts/BUILD.gn new file mode 100644 index 0000000000..326fa4c2b0 --- /dev/null +++ b/ets2panda/declgen_ets2ts/BUILD.gn @@ -0,0 +1,58 @@ +# Copyright (c) 2021-2022 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. + +import("//arkcompiler/runtime_core/static_core/ark_config.gni") +import("//build/ohos.gni") + +ohos_executable("declgen_ets2ts") { + sources = [ + "declgenEts2Ts.cpp", + "main.cpp", + ] + + include_dirs = [ "$target_gen_dir" ] + + configs = [ + sdk_libc_secshared_config, + "$ark_root:ark_config", + "$ark_es2panda_root:libes2panda_public_config", + "$ark_root/assembler:arkassembler_public_config", + "$ark_root/libpandafile:arkfile_public_config", + "$ark_root/libpandabase:arkbase_public_config", + "$ark_root/bytecode_optimizer:bytecodeopt_public_config", + "$ark_root/compiler:arkcompiler_public_config", + "$ark_root/runtime:arkruntime_public_config", + ] + + deps = [ + "$ark_es2panda_root:libes2panda_frontend_static", + "$ark_es2panda_root:libes2panda_public_frontend_static", + ] + external_deps = [ + "runtime_core:libarktsassembler_package", + "runtime_core:libarktsbase_package", + "runtime_core:libarktsbytecodeopt_package", + "runtime_core:libarktscompiler_package", + "runtime_core:libarktsfile_package", + ] + + libs = platform_libs + ldflags = platform_ldflags + if (is_linux) { + libs += [ "stdc++fs" ] + } + + install_enable = true + part_name = "ets_frontend" + subsystem_name = "arkcompiler" +} diff --git a/ets2panda/declgen_ets2ts/CMakeLists.txt b/ets2panda/declgen_ets2ts/CMakeLists.txt new file mode 100644 index 0000000000..6d0687fa1d --- /dev/null +++ b/ets2panda/declgen_ets2ts/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright (c) 2021-2024 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. + +set(DECLGEN_ETS2TS_SRC + main.cpp + declgenEts2Ts.cpp +) + +set(DECLGEN_ETS2TS_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${CMAKE_CURRENT_BINARY_DIR}/.. +) + +panda_add_executable(declgen_ets2ts ${DECLGEN_ETS2TS_SRC}) +panda_target_link_libraries(declgen_ets2ts es2panda-public es2panda-lib arkassembler arkbytecodeopt) +panda_target_include_directories(declgen_ets2ts PRIVATE ${DECLGEN_ETS2TS_INCLUDE_DIRS}) +panda_target_compile_options(declgen_ets2ts PRIVATE -fexceptions) + +panda_add_sanitizers(TARGET declgen_ets2ts SANITIZERS ${PANDA_SANITIZERS_LIST}) diff --git a/ets2panda/util/declgenEts2Ts.cpp b/ets2panda/declgen_ets2ts/declgenEts2Ts.cpp similarity index 82% rename from ets2panda/util/declgenEts2Ts.cpp rename to ets2panda/declgen_ets2ts/declgenEts2Ts.cpp index c06c512395..d46d1c6fac 100644 --- a/ets2panda/util/declgenEts2Ts.cpp +++ b/ets2panda/declgen_ets2ts/declgenEts2Ts.cpp @@ -33,7 +33,7 @@ #define DEBUG_PRINT 0 -namespace ark::es2panda::util { +namespace ark::es2panda::declgen_ets2ts { static void DebugPrint([[maybe_unused]] const std::string &msg) { @@ -85,7 +85,7 @@ void TSDeclGen::Generate() } template -void TSDeclGen::GenCommaSeparated(const T &container, const CB &cb) +void TSDeclGen::GenSeparated(const T &container, const CB &cb, const char *separator) { if (container.empty()) { return; @@ -93,7 +93,7 @@ void TSDeclGen::GenCommaSeparated(const T &container, const CB &cb) cb(container[0]); for (std::size_t i = 1; i < container.size(); ++i) { - Out(", "); + Out(separator); cb(container[i]); } } @@ -200,61 +200,71 @@ void TSDeclGen::GenLiteral(const ir::Literal *literal) ThrowError("Unexpected number literal type", literal->Start()); } -void TSDeclGen::GenFunctionType(const checker::ETSFunctionType *etsFunctionType, const ir::MethodDefinition *methodDef) +void TSDeclGen::GenFunctionBody(const ir::MethodDefinition *methodDef, const checker::Signature *sig, + const bool isConstructor, const bool isSetter) { - const bool isConstructor = methodDef != nullptr ? methodDef->IsConstructor() : false; - - if (etsFunctionType->CallSignatures().size() != 1) { - const auto loc = methodDef != nullptr ? methodDef->Start() : lexer::SourcePosition(); - ThrowError("Method overloads are not supported", loc); + if (isConstructor) { + if (state_.super != nullptr) { + Out("{ super(...{} as (ConstructorParametersTsType()); + Out(">)); }"); + } else { + Out(" {}"); + } + } else if (isSetter) { + Out(" {}"); + } else { + Out(methodDef != nullptr ? ": " : " => "); + GenType(sig->ReturnType()); + if (methodDef != nullptr && !state_.inInterface) { + Out(" { return {} as any; }"); + } } +} - for (const auto *sig : etsFunctionType->CallSignatures()) { - const auto *func = sig->Function(); - - GenTypeParameters(func->TypeParams()); - - Out("("); +void TSDeclGen::GenFunctionType(const checker::ETSFunctionType *etsFunctionType, const ir::MethodDefinition *methodDef) +{ + const bool isConstructor = methodDef != nullptr ? methodDef->IsConstructor() : false; + const bool isSetter = methodDef != nullptr ? methodDef->Kind() == ir::MethodDefinitionKind::SET : false; - GenCommaSeparated(sig->Params(), [this](varbinder::LocalVariable *param) { - Out(param->Name()); - const auto *paramType = param->TsType(); + const auto *sig = [this, methodDef, etsFunctionType]() -> const checker::Signature * { + if (methodDef != nullptr) { + return methodDef->Function()->Signature(); + } + if (etsFunctionType->CallSignatures().size() != 1) { + const auto loc = methodDef != nullptr ? methodDef->Start() : lexer::SourcePosition(); + ThrowError("Method overloads are not supported", loc); + } + return etsFunctionType->CallSignatures()[0]; + }(); - if (param->HasFlag(varbinder::VariableFlags::OPTIONAL)) { - Out("?"); - } + const auto *func = sig->Function(); + GenTypeParameters(func->TypeParams()); + Out("("); - Out(": "); - GenType(paramType); - }); + GenSeparated(sig->Params(), [this](varbinder::LocalVariable *param) { + Out(param->Name()); + const auto *paramType = param->TsType(); - const auto *sigInfo = sig->GetSignatureInfo(); - if (sigInfo->restVar != nullptr) { - if (!sig->Params().empty()) { - Out(", "); - } - Out("...", sigInfo->restVar->Name().Mutf8(), ": "); - GenType(sigInfo->restVar->TsType()); + if (param->HasFlag(varbinder::VariableFlags::OPTIONAL)) { + Out("?"); } + Out(": "); + GenType(paramType); + }); - Out(")"); - - if (isConstructor) { - if (state_.super != nullptr) { - Out("{ super(...{} as (ConstructorParametersTsType()); - Out(">)); }"); - } else { - Out(" {}"); - } - } else { - Out(methodDef != nullptr ? ": " : " => "); - GenType(sig->ReturnType()); - if (methodDef != nullptr && !state_.inInterface) { - Out(" { return {} as any; }"); - } + const auto *sigInfo = sig->GetSignatureInfo(); + if (sigInfo->restVar != nullptr) { + if (!sig->Params().empty()) { + Out(", "); } + Out("...", sigInfo->restVar->Name().Mutf8(), ": "); + GenType(sigInfo->restVar->TsType()); } + + Out(")"); + + GenFunctionBody(methodDef, sig, isConstructor, isSetter); } void TSDeclGen::GenEnumType(const checker::ETSEnumType *enumType) @@ -285,12 +295,8 @@ void TSDeclGen::GenEnumType(const checker::ETSEnumType *enumType) void TSDeclGen::GenUnionType(const checker::ETSUnionType *unionType) { - for (auto *ctype : unionType->ConstituentTypes()) { - GenType(ctype); - if (ctype != unionType->ConstituentTypes().back()) { - Out(" | "); - } - } + GenSeparated( + unionType->ConstituentTypes(), [this](checker::Type *arg) { GenType(arg); }, " | "); } void TSDeclGen::GenObjectType(const checker::ETSObjectType *objectType) @@ -326,7 +332,7 @@ void TSDeclGen::GenObjectType(const checker::ETSObjectType *objectType) const auto &typeArgs = objectType->TypeArguments(); if (!typeArgs.empty()) { Out("<"); - GenCommaSeparated(typeArgs, [this](checker::Type *arg) { GenType(arg); }); + GenSeparated(typeArgs, [this](checker::Type *arg) { GenType(arg); }); Out(">"); } } @@ -335,7 +341,7 @@ void TSDeclGen::GenTypeParameters(const ir::TSTypeParameterDeclaration *typePara { if (typeParams != nullptr) { Out("<"); - GenCommaSeparated(typeParams->Params(), [this](ir::TSTypeParameter *param) { + GenSeparated(typeParams->Params(), [this](ir::TSTypeParameter *param) { Out(param->Name()->Name()); auto *constraint = param->Constraint(); if (constraint != nullptr) { @@ -347,6 +353,14 @@ void TSDeclGen::GenTypeParameters(const ir::TSTypeParameterDeclaration *typePara } } +void TSDeclGen::GenExports(const std::string &name) +{ + Out("export {", name, "};"); + OutEndl(); + Out("exports.", name, " = ", name, ";"); + OutEndl(); +} + template void TSDeclGen::GenModifier(const T *node) { @@ -380,7 +394,7 @@ void TSDeclGen::GenImportDeclaration(const ir::ETSImportDeclaration *importDecla const auto &specifiers = importDeclaration->Specifiers(); Out("import { "); - GenCommaSeparated(specifiers, [this, &importDeclaration](ir::AstNode *specifier) { + GenSeparated(specifiers, [this, &importDeclaration](ir::AstNode *specifier) { if (!specifier->IsImportSpecifier()) { ThrowError("Only import specifiers are supported", importDeclaration->Start()); } @@ -439,6 +453,9 @@ void TSDeclGen::GenInterfaceDeclaration(const ir::TSInterfaceDeclaration *interf for (auto *prop : interfaceDecl->Body()->Body()) { if (prop->IsMethodDefinition()) { GenMethodDeclaration(prop->AsMethodDefinition()); + for (const auto *methodDef : prop->AsMethodDefinition()->Overloads()) { + GenMethodDeclaration(methodDef); + } } if (prop->IsClassProperty()) { GenPropDeclaration(prop->AsClassProperty()); @@ -467,7 +484,6 @@ void TSDeclGen::GenClassDeclaration(const ir::ClassDeclaration *classDecl) if (!state_.inGlobalClass) { Out("class ", className); - GenTypeParameters(classDef->TypeParams()); const auto *super = classDef->Super(); @@ -481,7 +497,7 @@ void TSDeclGen::GenClassDeclaration(const ir::ClassDeclaration *classDecl) if (!interfaces.empty()) { Out(" implements "); ASSERT(classDef->TsType()->IsETSObjectType()); - GenCommaSeparated(interfaces, [this](checker::ETSObjectType *interface) { GenType(interface); }); + GenSeparated(interfaces, [this](checker::ETSObjectType *interface) { GenType(interface); }); } Out(" {"); @@ -491,6 +507,9 @@ void TSDeclGen::GenClassDeclaration(const ir::ClassDeclaration *classDecl) for (const auto *prop : classDef->Body()) { if (prop->IsMethodDefinition()) { GenMethodDeclaration(prop->AsMethodDefinition()); + for (const auto *methodDef : prop->AsMethodDefinition()->Overloads()) { + GenMethodDeclaration(methodDef); + } } else if (prop->IsClassProperty()) { GenPropDeclaration(prop->AsClassProperty()); } @@ -501,24 +520,13 @@ void TSDeclGen::GenClassDeclaration(const ir::ClassDeclaration *classDecl) OutEndl(); Out("(", className, " as any) = (globalThis as any).Panda.getClass('", state_.currentClassDescriptor, "');"); OutEndl(); - Out("export {", className, "};"); + GenExports(className); OutEndl(); - Out("exports.", className, " = ", className, ";"); - OutEndl(2U); } } void TSDeclGen::GenMethodDeclaration(const ir::MethodDefinition *methodDef) { - switch (methodDef->Kind()) { - case ir::MethodDefinitionKind::GET: - case ir::MethodDefinitionKind::SET: { - ThrowError("Unsupported method kind", methodDef->Start()); - } - default: - break; - } - if (state_.inGlobalClass) { Out("function "); } else { @@ -526,6 +534,13 @@ void TSDeclGen::GenMethodDeclaration(const ir::MethodDefinition *methodDef) GenModifier(methodDef); } + if (methodDef->Kind() == ir::MethodDefinitionKind::GET) { + Out("get "); + } + if (methodDef->Kind() == ir::MethodDefinitionKind::SET) { + Out("set "); + } + const auto methodName = GetKeyName(methodDef->Key()); DebugPrint(" GenMethodDeclaration: " + methodName); Out(methodName); @@ -544,10 +559,7 @@ void TSDeclGen::GenMethodDeclaration(const ir::MethodDefinition *methodDef) Out("(", methodName, " as any) = (globalThis as any).Panda.getFunction('", state_.currentClassDescriptor, "', '", methodName, "');"); OutEndl(); - Out("export {", methodName, "};"); - OutEndl(); - Out("exports.", methodName, " = ", methodName, ";"); - OutEndl(); + GenExports(methodName); if (methodName == compiler::Signatures::INIT_METHOD) { Out(methodName, "();"); } @@ -594,4 +606,4 @@ bool GenerateTsDeclarations(checker::ETSChecker *checker, const ark::es2panda::p return true; } -} // namespace ark::es2panda::util +} // namespace ark::es2panda::declgen_ets2ts diff --git a/ets2panda/util/declgenEts2Ts.h b/ets2panda/declgen_ets2ts/declgenEts2Ts.h similarity index 86% rename from ets2panda/util/declgenEts2Ts.h rename to ets2panda/declgen_ets2ts/declgenEts2Ts.h index 238a133fe8..1934c19cab 100644 --- a/ets2panda/util/declgenEts2Ts.h +++ b/ets2panda/declgen_ets2ts/declgenEts2Ts.h @@ -13,14 +13,14 @@ * limitations under the License. */ +#ifndef ES2PANDA_DECLGEN_ETS2TS_H +#define ES2PANDA_DECLGEN_ETS2TS_H + #include "parser/program/program.h" #include "checker/ETSchecker.h" #include "libpandabase/os/file.h" -#ifndef ES2PANDA_UTIL_DECLGEN_ETS2TS_H -#define ES2PANDA_UTIL_DECLGEN_ETS2TS_H - -namespace ark::es2panda::util { +namespace ark::es2panda::declgen_ets2ts { // Consume program after checker stage and generate out_path typescript file with declarations bool GenerateTsDeclarations(checker::ETSChecker *checker, const ark::es2panda::parser::Program *program, @@ -48,6 +48,8 @@ private: void GenType(const checker::Type *checkerType); void GenFunctionType(const checker::ETSFunctionType *functionType, const ir::MethodDefinition *methodDef = nullptr); + void GenFunctionBody(const ir::MethodDefinition *methodDef, const checker::Signature *sig, const bool isConstructor, + const bool isSetter); void GenObjectType(const checker::ETSObjectType *objectType); void GenEnumType(const checker::ETSEnumType *enumType); void GenUnionType(const checker::ETSUnionType *unionType); @@ -64,9 +66,10 @@ private: template void GenModifier(const T *node); void GenTypeParameters(const ir::TSTypeParameterDeclaration *typeParams); + void GenExports(const std::string &name); template - void GenCommaSeparated(const T &container, const CB &cb); + void GenSeparated(const T &container, const CB &cb, const char *separator = ", "); void Out() {} template @@ -96,6 +99,6 @@ private: checker::ETSChecker *checker_ {}; const ark::es2panda::parser::Program *program_ {}; }; -} // namespace ark::es2panda::util +} // namespace ark::es2panda::declgen_ets2ts -#endif // ES2PANDA_UTIL_DECLGEN_ETS2TS_H +#endif // ES2PANDA_DECLGEN_ETS2TS_H diff --git a/ets2panda/compiler/lowering/ets/generateDeclarations.h b/ets2panda/declgen_ets2ts/main.cpp similarity index 33% rename from ets2panda/compiler/lowering/ets/generateDeclarations.h rename to ets2panda/declgen_ets2ts/main.cpp index a57173908c..6a719500d9 100644 --- a/ets2panda/compiler/lowering/ets/generateDeclarations.h +++ b/ets2panda/declgen_ets2ts/main.cpp @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2021-2024 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. @@ -13,23 +13,42 @@ * limitations under the License. */ -#ifndef ES2PANDA_COMPILER_LOWERING_GENERATE_DECLARATIONS_H -#define ES2PANDA_COMPILER_LOWERING_GENERATE_DECLARATIONS_H +#include "public/es2panda_lib.h" +#include "public/public.h" +#include "declgenEts2Ts.h" -#include "compiler/lowering/phase.h" +namespace ark::es2panda::declgen_ets2ts { -namespace ark::es2panda::compiler { +static int Run(int argc, const char **argv) +{ + const auto *impl = es2panda_GetImpl(ES2PANDA_LIB_VERSION); + auto *cfg = impl->CreateConfig(argc, argv); + if (cfg == nullptr) { + return 1; + } + auto *cfgImpl = reinterpret_cast(cfg); + + es2panda_Context *ctx = impl->CreateContextFromString(cfg, cfgImpl->options->ParserInput().c_str(), + cfgImpl->options->SourceFile().c_str()); + + auto *ctxImpl = reinterpret_cast(ctx); + auto *checker = reinterpret_cast(ctxImpl->checker); + + impl->ProceedToState(ctx, ES2PANDA_STATE_CHECKED); -class GenerateTsDeclarationsPhase : public Phase { -public: - std::string_view Name() const override - { - return "GenerateTsDeclarationsPhase"; + int res = 0; + if (!GenerateTsDeclarations(checker, ctxImpl->parserProgram, cfgImpl->options->CompilerOutput())) { + res = 1; } - bool Perform(public_lib::Context *ctx, parser::Program *program) override; -}; + impl->DestroyContext(ctx); + impl->DestroyConfig(cfg); -} // namespace ark::es2panda::compiler + return res; +} +} // namespace ark::es2panda::declgen_ets2ts -#endif +int main(int argc, const char **argv) +{ + return ark::es2panda::declgen_ets2ts::Run(argc, argv); +} diff --git a/ets2panda/es2panda.h b/ets2panda/es2panda.h index ce08d1a5fb..55a593983b 100644 --- a/ets2panda/es2panda.h +++ b/ets2panda/es2panda.h @@ -105,7 +105,6 @@ struct CompilerOptions { bool verifierAllChecks {}; bool verifierFullProgram {}; std::string stdLib {}; - std::string tsDeclOut {}; std::vector plugins {}; std::unordered_set skipPhases {}; std::unordered_set verifierWarnings {}; diff --git a/ets2panda/util/options.cpp b/ets2panda/util/options.cpp index 4c19590eca..22519a040f 100644 --- a/ets2panda/util/options.cpp +++ b/ets2panda/util/options.cpp @@ -170,7 +170,6 @@ bool Options::Parse(int argc, const char **argv) ark::PandArg opDumpDebugInfo("dump-debug-info", false, "Dump debug info"); ark::PandArg opOptLevel("opt-level", 0, "Compiler optimization level (options: 0 | 1 | 2)"); ark::PandArg opEtsModule("ets-module", false, "Compile the input as ets-module"); - ark::PandArg opTsDeclOut("gen-ts-decl", "", "For given .ets file, generate .ts interop file"); auto constexpr DEFAULT_THREAD_COUNT = 0; ark::PandArg opThreadCount("thread", DEFAULT_THREAD_COUNT, "Number of worker threads"); @@ -255,7 +254,6 @@ bool Options::Parse(int argc, const char **argv) argparser_->Add(&dumpAfterPhases); argparser_->Add(&dumpEtsSrcBeforePhases); argparser_->Add(&arktsConfig); - argparser_->Add(&opTsDeclOut); argparser_->PushBackTail(&inputFile); argparser_->EnableTail(); @@ -342,7 +340,7 @@ bool Options::Parse(int argc, const char **argv) compilerOptions_.arktsConfig = std::make_shared(arktsConfig.GetValue()); // Some additional checks for ETS extension - if (!CheckEtsSpecificOptions(opTsDeclOut, compilationMode, arktsConfig)) { + if (!CheckEtsSpecificOptions(compilationMode, arktsConfig)) { return false; } @@ -352,7 +350,6 @@ bool Options::Parse(int argc, const char **argv) return false; } - compilerOptions_.tsDeclOut = opTsDeclOut.GetValue(); compilerOptions_.dumpAsm = opDumpAssembly.GetValue(); compilerOptions_.dumpAst = opDumpAst.GetValue(); compilerOptions_.opDumpAstOnlySilent = opDumpAstOnlySilent.GetValue(); diff --git a/ets2panda/util/options.h b/ets2panda/util/options.h index 969cc7009a..38884464f2 100644 --- a/ets2panda/util/options.h +++ b/ets2panda/util/options.h @@ -210,8 +210,7 @@ public: } } - bool CheckEtsSpecificOptions(const ark::PandArg &opTsDeclOut, - const es2panda::CompilationMode &compMode, + bool CheckEtsSpecificOptions(const es2panda::CompilationMode &compMode, const ark::PandArg &arktsConfig) { if (extension_ != es2panda::ScriptExtension::ETS) { @@ -219,10 +218,6 @@ public: errorMsg_ = "Error: only --extension=ets is supported for project compilation mode."; return false; } - if (!opTsDeclOut.GetValue().empty()) { - errorMsg_ = "Error: only --extension=ets is supported for --gen-ts-decl option"; - return false; - } } else { if (!compilerOptions_.arktsConfig->Parse()) { errorMsg_ = "Invalid ArkTsConfig: "; -- Gitee