-
Notifications
You must be signed in to change notification settings - Fork 0
Claude/zen pasteur 76hfs1 #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
518ab13
3e4ce4c
f01dcdc
1470834
dc983a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -357,8 +357,45 @@ | |
| nodes.Add(new { op = "while", line = LineOf(fors), body = bodyNodes }); | ||
| return true; | ||
| } | ||
| case TryStatementSyntax trys: | ||
| { | ||
| // try { A } [catch { C }...] [finally { B }]: lower A then B SEQUENTIALLY | ||
| // (no exception edges yet). A resource acquired in `try` and released in | ||
| // `finally` stays balanced -> silent (the safe dispose pattern); one never | ||
| // released anywhere leaks -> caught. This un-skips try-methods, the big | ||
| // recall slice (a plain undisposed local living inside a try). NOT modelled | ||
| // yet: dispose-on-throw (released in `try`, not `finally`) reads as released | ||
| // here — that needs per-statement exceptional exits (a later slice). | ||
| // | ||
| // A `return` inside the try makes a finally's release UNREACHABLE in this | ||
| // sequential model (the core treats `return` as terminal), which would | ||
| // FALSELY flag a resource the finally disposes. Until finally-before-return | ||
| // is modelled, bail when a try-with-finally contains a return: the common | ||
| // `try { …; return x; } finally { r.Dispose(); }` is safe anyway, so skipping | ||
| // it is sound (a real leak in that shape is rare). | ||
| if (trys.Finally is not null | ||
| && trys.Block.DescendantNodes().OfType<ReturnStatementSyntax>().Any()) | ||
| return false; | ||
| // Catch bodies are not lowered; to stay SOUND, bail if any catch disposes, so | ||
| // a release that only happens in a catch is never missed (no false leak). Match | ||
| // both `x.Dispose()` (member access) and `x?.Dispose()` (member binding). | ||
| foreach (var cc in trys.Catches) | ||
| if (cc.Block.DescendantNodes().OfType<InvocationExpressionSyntax>() | ||
| .Any(i => (i.Expression switch | ||
| { | ||
| MemberAccessExpressionSyntax ma => ma.Name.Identifier.Text, | ||
| MemberBindingExpressionSyntax mb => mb.Name.Identifier.Text, | ||
| _ => (string?)null, | ||
| }) is "Dispose" or "Close" or "DisposeAsync")) | ||
| return false; | ||
| if (!LowerFlowStmt(trys.Block, tracked, nodes)) | ||
| return false; | ||
| if (trys.Finally is { } fin && !LowerFlowStmt(fin.Block, tracked, nodes)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a Useful? React with 👍 / 👎.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch — fixed in dc983a6. You're right: the Generated by Claude Code |
||
| return false; | ||
| return true; | ||
| } | ||
| default: | ||
| return false; // unmodelled (do/try/switch/...) -> bail the method | ||
| return false; // unmodelled (do/switch/...) -> bail the method | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -456,7 +493,7 @@ | |
| .Split(Path.PathSeparator, StringSplitOptions.RemoveEmptyEntries) | ||
| .Where(p => p.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)) | ||
| .ToList(); | ||
| var refNames = new HashSet<string>(tpa.Select(Path.GetFileName), StringComparer.OrdinalIgnoreCase); | ||
|
Check warning on line 496 in frontend/roslyn/OwnSharp.Extractor/Program.cs
|
||
| var references = tpa.Select(p => (MetadataReference)MetadataReference.CreateFromFile(p)).ToList(); | ||
| // P-004 WPF profile: widen the reference set with assemblies named by the | ||
| // OWN_EXTRA_REF_DIRS env var (colon-separated dirs) — e.g. the WindowsDesktop ref | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.