-
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Finalize() method that calls __destruct() (through synthesized IDisposable.Dispose()) - Dispose() calls __destruct() just once - ref #489
- Loading branch information
1 parent
12c537a
commit 4ec4469
Showing
3 changed files
with
146 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
src/Peachpie.CodeAnalysis/Symbols/Synthesized/SynthesizedFinalizeSymbol.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Immutable; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.CodeAnalysis; | ||
using System.Diagnostics; | ||
using Devsense.PHP.Syntax; | ||
using System.Threading; | ||
using Peachpie.CodeAnalysis.Utilities; | ||
|
||
namespace Pchp.CodeAnalysis.Symbols | ||
{ | ||
#region SynthesizedDtorSymbol // generated Finalize method | ||
|
||
internal class SynthesizedFinalizeSymbol : SynthesizedMethodSymbol | ||
{ | ||
public SynthesizedFinalizeSymbol(NamedTypeSymbol/*!*/container) | ||
: base(container, WellKnownMemberNames.DestructorName, false, true, container.DeclaringCompilation.CoreTypes.Void, phphidden: true) | ||
{ | ||
Debug.Assert(!container.IsStatic); | ||
|
||
ExplicitOverride = (MethodSymbol)container.DeclaringCompilation | ||
.GetSpecialType(SpecialType.System_Object) | ||
.GetMembers(WellKnownMemberNames.DestructorName) | ||
.Single(); | ||
} | ||
|
||
public override bool HidesBaseMethodsByName => false; | ||
|
||
internal override bool HasSpecialName => false; | ||
|
||
public override Accessibility DeclaredAccessibility => Accessibility.Protected; | ||
|
||
public sealed override bool IsAbstract => false; | ||
|
||
public sealed override bool IsExtern => false; | ||
|
||
public sealed override bool IsSealed => false; | ||
|
||
public sealed override MethodKind MethodKind => MethodKind.Destructor; | ||
|
||
internal override bool IsExplicitInterfaceImplementation => false; | ||
|
||
internal override ObsoleteAttributeData ObsoleteAttributeData => null; | ||
|
||
internal override bool IsMetadataNewSlot(bool ignoreInterfaceImplementationChanges = false) => false; | ||
|
||
internal override bool IsMetadataVirtual(bool ignoreInterfaceImplementationChanges = false) => true; | ||
|
||
internal override bool IsMetadataFinal => false; | ||
|
||
public override ImmutableArray<SyntaxReference> DeclaringSyntaxReferences | ||
{ | ||
get | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
|
||
public override ImmutableArray<Location> Locations | ||
{ | ||
get | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
|
||
public override ImmutableArray<ParameterSymbol> Parameters => ImmutableArray<ParameterSymbol>.Empty; | ||
} | ||
|
||
#endregion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters