BadScript 2
Loading...
Searching...
No Matches
BadReflectedObject.cs
Go to the documentation of this file.
3
5
10{
15
20 public BadReflectedObject(object instance)
21 {
22 Instance = instance;
23 Type = instance.GetType();
25 }
26
30 public Type Type { get; }
31
35 public object Instance { get; }
36
41
42
45 {
46 return Prototype;
47 }
48
50 public override string ToSafeString(List<BadObject> done)
51 {
52 return Instance.ToString();
53 }
54
56 public override BadObjectReference GetProperty(string propName, BadScope? caller = null)
57 {
58 if (Members.Contains(propName))
59 {
60 return Members.GetMember(Instance, propName);
61 }
62
63 return base.GetProperty(propName, caller);
64 }
65
67 public override bool HasProperty(string propName, BadScope? caller = null)
68 {
69 return Members.Contains(propName) || base.HasProperty(propName, caller);
70 }
71}
Implements the Scope for the Script Engine.
Definition BadScope.cs:238
Implements a Member Table for a specific Type, including a Caching Mechanism for Reflected Members to...
static BadReflectedMemberTable Create(Type t)
Creates a new Member Table for the given Type.
bool Contains(string name)
Returns true if the Member Table contains the given Member.
BadObjectReference GetMember(object instance, string name)
Returns a reference to the Member with the given Name.
BadReflectedObject(object instance)
Creates a new Reflected Object.
override BadObjectReference GetProperty(string propName, BadScope? caller=null)
Returns a Reference to the Property with the given Name.The Property Reference
BadReflectedMemberTable Members
The Member Table for the Reflected Object.
static readonly BadClassPrototype Prototype
The Prototype for the Reflected Object Type.
override bool HasProperty(string propName, BadScope? caller=null)
Returns true if the object contains a given property or there exists an extension for the current Ins...
Implements a Reflected Object Prototype(not usable, just to satisfy the prototype chain)
The Base Class for all BadScript Objects.
Definition BadObject.cs:14
virtual BadObjectReference GetProperty(string propName, BadScope? caller=null)
Returns a Reference to the Property with the given Name.
Definition BadObject.cs:129
Implements the base functionality for a BadScript Reference.
Implements a Class Prototype for the BadScript Language.
Contains the Classes for Reflection Objects.
Contains the Runtime Objects.
Definition BadArray.cs:10