Esempio n. 1
0
        public override P5Scalar Assign(Runtime runtime, IP5Any other)
        {
            var ob = other.AsScalar(runtime).Body;
            var obr = ob as P5Reference;
            var obb = ob as P5TypeglobBody;

            if (obb != null)
                body = globBody = obb;
            else if (obr != null)
            {
                var referred = obr.Referred;
                var code = referred as P5Code;
                var scalar = referred as P5Scalar;
                var array = referred as P5Array;
                var hash = referred as P5Hash;

                if (code != null)
                    globBody.Code = code;
                else if (scalar != null)
                    globBody.Scalar = scalar;
                else if (array != null)
                    globBody.Array = array;
                else if (hash != null)
                    globBody.Hash = hash;
            }
            else
            {
                throw new System.NotImplementedException("Assign either glob or reference");
            }

            return this;
        }
Esempio n. 2
0
        // IP5ScalarBody implementation
        public virtual IP5ScalarBody CloneBody(Runtime runtime)
        {
            var newBody = new P5TypeglobBody(runtime, name);

            newBody.scalar = scalar;
            newBody.array = array;
            newBody.hash = hash;
            newBody.handle = handle;
            newBody.code = code;

            return newBody;
        }
Esempio n. 3
0
 public P5Typeglob(Runtime runtime, string name)
 {
     body = globBody = new P5TypeglobBody(runtime, name);
 }