diff --git a/es2panda/ir/base/classDefinition.cpp b/es2panda/ir/base/classDefinition.cpp index 1dcd5c4eddc1e0c95657510f5b3cab3852116725..3a6290291eaece5a3d31c6b12017e82c2a9a8707 100644 --- a/es2panda/ir/base/classDefinition.cpp +++ b/es2panda/ir/base/classDefinition.cpp @@ -246,6 +246,10 @@ void ClassDefinition::CompileMissingProperties(compiler::PandaGen *pg, const uti continue; } + if (prop->IsAbstract()) { + continue; + } + compiler::VReg dest = prop->IsStatic() ? classReg : protoReg; compiler::RegScope rs(pg); diff --git a/es2panda/test/compiler/ts/cases/conformance/classes/test-ts-classes-25-expected.txt b/es2panda/test/compiler/ts/cases/conformance/classes/test-ts-classes-25-expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..680e53d55e5fb10d0561b99f383012af710a6852 --- /dev/null +++ b/es2panda/test/compiler/ts/cases/conformance/classes/test-ts-classes-25-expected.txt @@ -0,0 +1,2 @@ +derived derived +ok ok diff --git a/es2panda/test/compiler/ts/cases/conformance/classes/test-ts-classes-25.ts b/es2panda/test/compiler/ts/cases/conformance/classes/test-ts-classes-25.ts new file mode 100644 index 0000000000000000000000000000000000000000..00e2896f429a6873e3c844d735b87c91242fef2b --- /dev/null +++ b/es2panda/test/compiler/ts/cases/conformance/classes/test-ts-classes-25.ts @@ -0,0 +1,35 @@ +/* + * 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. + */ + + +abstract class Base { + abstract name: string; + abstract get Name(); + abstract set Name(value: string); +} + +class Divied extends Base { + name = "derived"; + get Name() { + return 'ok'; + } + set Name(value: string) { + this.name = value; + } +} + +let d = new Divied(); +print(d.name, "derived"); +print(d.Name, "ok");