-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNodeClassType.cs
More file actions
84 lines (61 loc) · 2.12 KB
/
Copy pathNodeClassType.cs
File metadata and controls
84 lines (61 loc) · 2.12 KB
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
using NodeDev.Core.Class;
namespace NodeDev.Core.Types
{
public class NodeClassType : TypeBase
{
public readonly NodeClass NodeClass;
public NodeClassType(NodeClass nodeClass, TypeBase[] generics)
{
if (generics.Length != 0)
throw new NotImplementedException("Generics are not supported yet for NodeClass");
NodeClass = nodeClass;
Generics = generics;
}
public override string Name => NodeClass.Name;
public override string FullName => NodeClass.Namespace + "." + NodeClass.Name;
public override TypeBase[] Generics { get; }
override public TypeBase? BaseType => null;
public override string FriendlyName => Name;
public override bool IsArray => false;
public override TypeBase ArrayInnerType => throw new NotImplementedException();
public override TypeBase ArrayType => new NodeClassArrayType(this, 1);
public override TypeBase[] Interfaces => [];
public override IEnumerable<IMemberInfo> GetMembers() => NodeClass.Properties;
public NodeClassType GetNonArray()
{
if (!IsArray)
return this;
return NodeClass.Project.GetNodeClassType(NodeClass, Generics);
}
internal protected override string Serialize()
{
return FullName;
}
public override TypeBase CloneWithGenerics(TypeBase[] newGenerics)
{
if (Generics.Length != newGenerics.Length)
throw new ArgumentException("Generics count mismatch");
return new NodeClassType(NodeClass, newGenerics);
}
public static NodeClassType Deserialize(TypeFactory typeFactory, string typeName)
{
return typeFactory.Project.GetNodeClassType(typeFactory.Project.Classes.First(x => x.Namespace + "." + x.Name == typeName));
}
public override IEnumerable<IMethodInfo> GetMethods()
{
return NodeClass.Methods;
}
public override IEnumerable<IMethodInfo> GetMethods(string name)
{
return NodeClass.Methods.Where(x => x.Name == name);
}
public override Type MakeRealType()
{
return NodeClass.Project.GetCreatedClassType(NodeClass);
}
public override bool IsSameBackend(TypeBase typeBase)
{
return typeBase is NodeClassType nodeClassType && nodeClassType.NodeClass == NodeClass;
}
}
}