@descryy/adapter-csharp 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -0
- package/dist/adapter.d.ts +3 -8
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +57 -65
- package/dist/adapter.js.map +1 -1
- package/dist/aspnetcore.d.ts +53 -95
- package/dist/aspnetcore.d.ts.map +1 -1
- package/dist/aspnetcore.js +56 -101
- package/dist/aspnetcore.js.map +1 -1
- package/dist/client-base.d.ts +51 -88
- package/dist/client-base.d.ts.map +1 -1
- package/dist/client-base.js +46 -79
- package/dist/client-base.js.map +1 -1
- package/dist/client.d.ts +42 -106
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +83 -172
- package/dist/client.js.map +1 -1
- package/dist/efcore.d.ts +59 -113
- package/dist/efcore.d.ts.map +1 -1
- package/dist/efcore.js +119 -204
- package/dist/efcore.js.map +1 -1
- package/dist/extract.d.ts +27 -50
- package/dist/extract.d.ts.map +1 -1
- package/dist/extract.js +154 -248
- package/dist/extract.js.map +1 -1
- package/dist/nullability.d.ts +46 -78
- package/dist/nullability.d.ts.map +1 -1
- package/dist/nullability.js +47 -80
- package/dist/nullability.js.map +1 -1
- package/dist/parse.d.ts +62 -102
- package/dist/parse.d.ts.map +1 -1
- package/dist/parse.js +60 -101
- package/dist/parse.js.map +1 -1
- package/dist/projects.d.ts +24 -40
- package/dist/projects.d.ts.map +1 -1
- package/dist/projects.js +38 -65
- package/dist/projects.js.map +1 -1
- package/package.json +15 -6
package/dist/extract.d.ts
CHANGED
|
@@ -1,40 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* C# files to Canonical IR.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Identity is project + declared namespace, not namespace alone: namespaces
|
|
5
|
+
* don't follow directories and can span projects, so two `.csproj` files may
|
|
6
|
+
* both declare `Shop.Orders.OrderService` (DEC-077's collision — the project
|
|
7
|
+
* is C#'s equivalent of Java's source set).
|
|
5
8
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* collision — the Java case where one fully-qualified name existed under two
|
|
10
|
-
* source sets and stopped identifying anything — and the project is C#'s
|
|
11
|
-
* equivalent separator.
|
|
9
|
+
* DEC-083: `partial class` is the first multi-file declaration here. Parts
|
|
10
|
+
* merge into one node (ids never carry a file path) — `file` is the
|
|
11
|
+
* lexicographically first declaring path, every part listed in `attrs.declaredIn`.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* DEC-084: `class A : B, IC` doesn't say which entry is the base class, but
|
|
14
|
+
* the language does — at most one, and it's first. So later entries are
|
|
15
|
+
* `IMPLEMENTS` unconditionally, and only the first entry per class ever needs
|
|
16
|
+
* resolving. The `IFoo` naming convention is never read (`System.Exception`
|
|
17
|
+
* disproves it; golden pattern 12 punishes inferring edges from naming habits).
|
|
14
18
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* declaring path and every part is listed in `attrs.declaredIn`, which is what
|
|
20
|
-
* a precision adjudicator has to search instead of `file`.
|
|
21
|
-
*
|
|
22
|
-
* **DEC-084, the base list.** `class A : B, IC` does not say which entry is the
|
|
23
|
-
* class, but the language does: at most one base class, and it must be first.
|
|
24
|
-
* So entries after the first are `IMPLEMENTS` unconditionally, a struct's and an
|
|
25
|
-
* interface's entries are all `IMPLEMENTS`, and exactly one entry per class ever
|
|
26
|
-
* needs resolving. The `IFoo` prefix is never read — it is a convention,
|
|
27
|
-
* `System.Exception` disproves it in the other direction, and inferring an edge
|
|
28
|
-
* from a naming habit is what golden pattern 12 exists to punish.
|
|
29
|
-
*
|
|
30
|
-
* ## Ambiguity is disclosed, never broken
|
|
31
|
-
*
|
|
32
|
-
* A `using` imports a whole namespace, so a bare name can be found under two of
|
|
33
|
-
* them at once. Real C# resolves that with the full type environment; this
|
|
34
|
-
* adapter has names only, so two candidates produce a ledger entry and no edge.
|
|
35
|
-
* Extension methods are the same answer for the same reason: `x.Foo()` where
|
|
36
|
-
* `Foo` is a static method on an unrelated class, selected by the receiver's
|
|
37
|
-
* type, is not decidable from names.
|
|
19
|
+
* Ambiguity is disclosed, not guessed: a `using` imports a whole namespace, so
|
|
20
|
+
* a bare name can match two of them — real C# resolves via the full type
|
|
21
|
+
* environment, this adapter has names only, so two candidates ledger and mint
|
|
22
|
+
* no edge. Extension methods are the same call for the same reason.
|
|
38
23
|
*/
|
|
39
24
|
import { type IdentityScope, type IREdge, type IRNode, type ResolutionLevel, type UnresolvedRef } from "@descryy/ir";
|
|
40
25
|
import type { CsFile } from "./parse.ts";
|
|
@@ -49,28 +34,20 @@ export interface ExtractInput {
|
|
|
49
34
|
/**
|
|
50
35
|
* Repo-relative path -> source text, for the framework extractors.
|
|
51
36
|
*
|
|
52
|
-
*
|
|
53
|
-
* declarations
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* made — see their file comments. They need the text to do it.
|
|
57
|
-
*
|
|
58
|
-
* Empty when the caller has none: both extractors then see no files, emit
|
|
59
|
-
* nothing, and the language half is unaffected.
|
|
37
|
+
* Fluent API and minimal-API registrations are call chains, not
|
|
38
|
+
* declarations — `efcore.ts`/`aspnetcore.ts` read them textually and refuse
|
|
39
|
+
* what they can't evaluate. Empty when the caller has none: both extractors
|
|
40
|
+
* then emit nothing, and the language half is unaffected.
|
|
60
41
|
*/
|
|
61
42
|
readonly sources?: ReadonlyMap<string, string>;
|
|
62
43
|
/**
|
|
63
|
-
* The NRT context governing a file, resolved by the caller
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* That fallback is honest degradation rather than a guess, and it is the wrong
|
|
72
|
-
* answer for a fixture: the conformance corpus declares `<Nullable>enable</Nullable>`
|
|
73
|
-
* in `Shop.csproj` and golden 06's `discount_code` is a nullable `string?`.
|
|
44
|
+
* The NRT context governing a file, resolved by the caller (the adapter,
|
|
45
|
+
* which alone holds `.csproj`/`Directory.Build.props` — DEC-180 §1's 2nd
|
|
46
|
+
* and 3rd sources). Without it, falls back to `#nullable` directives alone,
|
|
47
|
+
* answering `absent` where the declaration is in project files — honest
|
|
48
|
+
* degradation, but the wrong answer for the fixture corpus
|
|
49
|
+
* (`Shop.csproj` declares `<Nullable>enable</Nullable>`, golden 06's
|
|
50
|
+
* `discount_code` is `string?`).
|
|
74
51
|
*/
|
|
75
52
|
readonly nullableContextOf?: (file: string) => NullableContext;
|
|
76
53
|
}
|
package/dist/extract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,MAAM,EAAwD,MAAM,YAAY,CAAC;AAG/F,OAAO,EAAuC,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAI7F,eAAO,MAAM,QAAQ,WAAW,CAAC;AA2CjC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C;;;;;;;;OAQG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,eAAe,CAAC;CAChE;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;CAC/C;AAgCD,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,CA8gCvD"}
|