Beispiel #1
0
 /// <summary>
 /// Initialize a new instance of the <see cref="NativeClass"/> class using the specified parameters.
 /// </summary>
 /// <param name="name">The name of the class.</param>
 /// <param name="super">The super class.</param>
 /// <param name="constructor">The constructor of the class.</param>
 public NativeClass(
     string name,
     ClassObject super,
     NativeConstructor constructor)
     : base(name, super)
 {
     Constructor = constructor;
 }
Beispiel #2
0
 /// <summary>
 /// Initialize a new instance of the <see cref="InstanceObject"/> class using the specified parameters.
 /// </summary>
 /// <param name="cls">The class that the instance belongs to.</param>
 /// <exception cref="ArgumentNullException">The parameter is <see langword="null"/>.</exception>
 public InstanceObject(ClassObject cls)
 {
     if (cls == null)
     {
         throw new ArgumentNullException();
     }
     Class  = cls;
     Fields = new Dictionary <string, IScriptObject>();
 }
Beispiel #3
0
 internal ClassObject(
     string name,
     ClassObject super)
 {
     Name            = name;
     Super           = super;
     InstanceMembers = new Dictionary <string, ClassMember>();
     StaticFields    = new Dictionary <string, IScriptObject>();
     StaticMembers   = new Dictionary <string, ClassMember>();
 }
Beispiel #4
0
        public static bool IsExtendedFrom(this ClassObject value, ClassObject other)
        {
            if (value == null)
            {
                return(false);
            }
            ClassObject cls = value.Super;

            while (cls != null)
            {
                if (cls == other)
                {
                    return(true);
                }
                else
                {
                    cls = cls.Super;
                }
            }
            return(false);
        }