From ea2031c0e0991b9f6abcca88b20c192951fb47f5 Mon Sep 17 00:00:00 2001 From: ctw Date: Tue, 31 May 2022 17:43:39 +0800 Subject: [PATCH] fix duplicate method name of class Signed-off-by: ctw Change-Id: I0160e9126c946a11a5c060a100a50a599b87a4f0 --- ts2panda/src/statement/classStatement.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ts2panda/src/statement/classStatement.ts b/ts2panda/src/statement/classStatement.ts index ed9498afbf..5ae50ace24 100644 --- a/ts2panda/src/statement/classStatement.ts +++ b/ts2panda/src/statement/classStatement.ts @@ -785,8 +785,20 @@ function checkAndUpdateProperty(namedPropertyMap: Map, name: s prop!.setSetter(valueNode); } } else { - if (!scalarArrayEquals(prop!.getValue(), valueNode)) { - return false; + if (prop!.getKind() == PropertyKind.Accessor) { + if (prop!.getGetter()) { + if (!scalarArrayEquals(prop!.getGetter(), valueNode)) { + return false; + } + } else { // prop is setter + if (!scalarArrayEquals(prop!.getSetter(), valueNode)) { + return false; + } + } + } else { + if (!scalarArrayEquals(prop!.getValue(), valueNode)) { + return false; + } } prop!.setValue(valueNode); prop!.setKind(propKind); -- Gitee