From 7069b420239fcfb5315b6c5dc3e13218b29c3411 Mon Sep 17 00:00:00 2001 From: Kevin Glynn Date: Mon, 12 Jul 2010 20:11:50 -0500 Subject: [PATCH] Turn C# destructors into finalize() methods. TODO: probably should call super.finalize() --- .../antlr2/Translator/CSharpTranslator.g | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/CSharpTranslator/antlr2/Translator/CSharpTranslator.g b/CSharpTranslator/antlr2/Translator/CSharpTranslator.g index 0d7a6bf..78963a7 100644 --- a/CSharpTranslator/antlr2/Translator/CSharpTranslator.g +++ b/CSharpTranslator/antlr2/Translator/CSharpTranslator.g @@ -1424,12 +1424,18 @@ staticConstructorBody [Object w] : body[w] ; -destructorDeclaration [Object w] +destructorDeclaration! [Object w] : #( DTOR_DECL attributes[w] modifiers[w] identifier[w] - destructorBody[w] - ) + b:destructorBody[w] + ) + { ## = #( [METHOD_DECL], + #( [MODIFIERS], [PROTECTED, "protected"] ), + #( [TYPE], [VOID, "void"], #( [ARRAY_RANKS] ) ), + #( [IDENTIFIER, "finalize"]) , + #( [FORMAL_PARAMETER_LIST] ), #( [THROWS, "throws"], [IDENTIFIER, "Throwable"] ), + astFactory.dupTree(#b) ); } ; - + destructorBody [Object w] : body[w] ;