Exemplo n.º 1
0
        public List <string> GetListFunction(string ObjName)
        {
            object ObjValue;

            if (!ObjValues.TryGetValue(ObjName, out ObjValue))
            {
                throw new ApplicationException(string.Concat(
                                                   "Obyek ", ObjName, " tidak ditemukan"));
            }

            Dictionary <string, ObjMember> Members;

            if (!ObjDict.TryGetValue(ObjValue.GetType().Name, out Members))
            {
                throw new ApplicationException(string.Concat(
                                                   "Obyek ", ObjName, " tidak ditemukan"));
            }

            List <string> RetVal = new List <string>();

            foreach (ObjMember objm in Members.Values)
            {
                string Tmpf = objm.ToString();
                if (Tmpf.Length > 0)
                {
                    RetVal.Add(Tmpf);
                }
            }
            return(RetVal);
        }
Exemplo n.º 2
0
        public override bool Call(bool isCallvirt, DmdMethodBase method, ILValue[] arguments, out ILValue?returnValue)
        {
            switch (method.SpecialMethodKind)
            {
            case DmdSpecialMethodKind.Array_Get:
                returnValue = LoadArrayElement(GetZeroBasedIndex(arguments, arguments.Length));
                return(returnValue is not null);

            case DmdSpecialMethodKind.Array_Set:
                StoreArrayElement(GetZeroBasedIndex(arguments, arguments.Length - 1), arguments[arguments.Length - 1]);
                returnValue = null;
                return(true);

            case DmdSpecialMethodKind.Array_Address:
                uint index     = GetZeroBasedIndex(arguments, arguments.Length);
                var  addrValue = ObjValue.GetArrayElementAddressAt(index);
                if (addrValue is not null)
                {
                    runtime.RecordValue(addrValue.Value);
                    Debug.Assert(addrValue.Value.Value !.Type.IsByRef);
                    returnValue = new ByRefILValueImpl(runtime, addrValue.Value.Value);
                }
                else
                {
                    returnValue = new ArrayElementAddress(runtime, this, index);
                }
                return(true);
            }

            return(base.Call(isCallvirt, method, arguments, out returnValue));
        }
Exemplo n.º 3
0
        public bool Equals(S other)
        {
            if (other == null)
            {
                return(false);
            }

            return(ObjValue.Equals(other.ObjValue));
        }
Exemplo n.º 4
0
        public override bool Equals(Object obj)
        {
            //Check for null and compare run-time types.
            if ((obj == null) || (!(obj is S)))
            {
                return(false);
            }

            return(ObjValue.Equals(((S)obj).ObjValue));
        }
Exemplo n.º 5
0
 void InitializeArrayInfo()
 {
     if (dimensionInfos is not null)
     {
         return;
     }
     if (!ObjValue.GetArrayInfo(out elementCount, out dimensionInfos))
     {
         throw new InvalidOperationException();
     }
 }
Exemplo n.º 6
0
        public object GetValue(string ObjName,
                               string MemberName, params object[] Parameters)
        {
            object ObjValue;

            if (!ObjValues.TryGetValue(ObjName, out ObjValue))
            {
                if (ObjName.Length > 0)
                {
                    throw new ApplicationException(string.Concat(
                                                       "Obyek ", ObjName, " tidak ditemukan"));
                }
                else
                {
                    throw new ApplicationException(string.Concat(
                                                       "Variabel '", MemberName, "' tidak ditemukan"));
                }
            }

            Dictionary <string, ObjMember> Members;

            if (!ObjDict.TryGetValue(ObjValue.GetType().Name, out Members))
            {
                if (ObjName.Length > 0)
                {
                    throw new ApplicationException(string.Concat(
                                                       "Obyek ", ObjName, " tidak ditemukan"));
                }
                else
                {
                    throw new ApplicationException(string.Concat(
                                                       "Variabel '", MemberName, "' tidak ditemukan"));
                }
            }

            ObjMember ObjMember;

            if (Members.TryGetValue(MemberName, out ObjMember))
            {
                return(ObjMember.GetValue(ObjValue, Parameters));
            }
            else if (ObjName.Length > 0)
            {
                throw new ApplicationException(string.Concat(
                                                   "Obyek ", ObjName, " Member ", MemberName,
                                                   " tidak ditemukan"));
            }
            else
            {
                throw new ApplicationException(string.Concat(
                                                   "Variabel '", MemberName, "' tidak ditemukan"));
            }
        }
Exemplo n.º 7
0
 public override string ToString()
 {
     return(ObjValue.ToString());
 }