-
Notifications
You must be signed in to change notification settings - Fork 5
/
Types.fs
91 lines (77 loc) · 1.55 KB
/
Types.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
module Fint.Types
open System
open Fint.Enums
open Fint.MethodBody
open Fint.CodedIndex
open Fint.Signature
// data types of metadata column
type ColumnType =
| Int16 of int16
| Int32 of int32
| StringIndex of int32
| BlobIndex of int32
| GuidIndex of int32
| TableIndex of TableIndex
| CodedIndex of CodedIndex
type Cell =
| Int16Cell of int16
| Int32Cell of int32
| StringCell of (unit -> string)
| BlobCell of (unit -> byte array)
| GuidCell of (unit -> Guid)
| TableIndexCell of TableIndex
type Column = {
index: int;
name: string;
value: ColumnType;
}
type ComputedColumn = {
name: string;
value: ColumnType;
size: int;
}
type Table = {
id: TableId;
rowCount: int;
rowSize: int;
offset: int64;
size: int;
isSorted: bool;
columns: ComputedColumn array;
}
type Row = {
table: TableId;
cells: Cell array;
}
type TokenValue =
| StringToken of string
| RowToken of Row
type MethodDef = {
rva: uint32;
name: string;
flags: MethodAttributes;
signature: MethodSignature;
body: unit -> MethodBody option;
localVars: unit -> LocalVar array;
};
let IsStaticMethod m = int (m.flags &&& MethodAttributes.Static) <> 0
let IsVoidMethod m =
match m.signature.ReturnType with
| PrimitiveTypeSig t -> t = ElementType.Void
| _ -> false
type TypeDef = {
ns: string;
name: string;
};
type TypeRef = {
ns: string;
name: string;
};
type MemberRefParent =
| TypeDefParent of TypeDef
| TypeRefParent of TypeRef
type MemberRef = {
parent: MemberRefParent;
name: string;
signature: MethodSignature;
};