BadScript 2
Loading...
Searching...
No Matches
ObjectModel.cs
Go to the documentation of this file.
1using System;
2using Microsoft.CodeAnalysis;
3
5
6public readonly struct ObjectModel : IEquatable<ObjectModel>
7{
8 public readonly string Namespace;
9 public readonly string ClassName;
10 public readonly string ObjectName;
11 public readonly string? BaseClassName;
12 public readonly MethodModel Constructor;
13 public readonly MethodModel[] Methods;
14 public readonly PropertyModel[] Properties;
15 public readonly Diagnostic[] Diagnostics;
16
17 public ObjectModel(string ns,
18 string className,
19 MethodModel[] methods,
20 string objectName,
21 Diagnostic[] diagnostics,
22 PropertyModel[] properties, MethodModel constructor, string? baseClassName)
23 {
24 Namespace = ns;
25 ClassName = className;
26 Methods = methods;
27 ObjectName = objectName;
28 Diagnostics = diagnostics;
29 Properties = properties;
30 Constructor = constructor;
31 BaseClassName = baseClassName;
32 }
33 public bool Equals(ObjectModel other)
34 {
35 return Namespace == other.Namespace && ClassName == other.ClassName && ObjectName == other.ObjectName && Constructor.Equals(other.Constructor) && Methods.Equals(other.Methods) && Properties.Equals(other.Properties) && Diagnostics.Equals(other.Diagnostics);
36 }
37 public override bool Equals(object? obj)
38 {
39 return obj is ObjectModel other && Equals(other);
40 }
41 public override int GetHashCode()
42 {
43 unchecked
44 {
45 var hashCode = Namespace.GetHashCode();
46 hashCode = (hashCode * 397) ^ ClassName.GetHashCode();
47 hashCode = (hashCode * 397) ^ ObjectName.GetHashCode();
48 hashCode = (hashCode * 397) ^ Constructor.GetHashCode();
49 hashCode = (hashCode * 397) ^ Methods.GetHashCode();
50 hashCode = (hashCode * 397) ^ Properties.GetHashCode();
51 hashCode = (hashCode * 397) ^ Diagnostics.GetHashCode();
52 return hashCode;
53 }
54 }
55 public static bool operator ==(ObjectModel left, ObjectModel right)
56 {
57 return left.Equals(right);
58 }
59 public static bool operator !=(ObjectModel left, ObjectModel right)
60 {
61 return !left.Equals(right);
62 }
63}
static bool operator==(ObjectModel left, ObjectModel right)
static bool operator!=(ObjectModel left, ObjectModel right)
ObjectModel(string ns, string className, MethodModel[] methods, string objectName, Diagnostic[] diagnostics, PropertyModel[] properties, MethodModel constructor, string? baseClassName)