当前位置: 首页>>代码示例>>C#>>正文


C# JsDictionaryObject类代码示例

本文整理汇总了C#中JsDictionaryObject的典型用法代码示例。如果您正苦于以下问题:C# JsDictionaryObject类的具体用法?C# JsDictionaryObject怎么用?C# JsDictionaryObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JsDictionaryObject类属于命名空间,在下文中一共展示了JsDictionaryObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Set

 public override void Set(JsDictionaryObject that, JsInstance value)
 {
     if (SetFunction == null)
         throw new JsException(global.TypeErrorClass.New());
     //JsDictionaryObject that = global.Visitor.CallTarget;
     global.Visitor.ExecuteFunction(SetFunction, that, new JsInstance[] { value });
 }
开发者ID:pusp,项目名称:o2platform,代码行数:7,代码来源:PropertyDescriptor.cs

示例2: Execute

        public override JsInstance Execute(IJintVisitor visitor, JsDictionaryObject that, JsInstance[] parameters)
        {
            JsFunction function = that as JsFunction;

            if (function == null) {
                throw new ArgumentException("the target of call() must be a function");
            }
            JsDictionaryObject _this;
            JsInstance[] _parameters;
            if (parameters.Length >= 1)
                _this = parameters[0] as JsDictionaryObject;
            else
                _this = visitor.Global as JsDictionaryObject;

            if (parameters.Length >= 2 && parameters[1] != JsNull.Instance) {
                JsObject arguments = parameters[1] as JsObject;
                if (arguments == null)
                    throw new JsException(visitor.Global.TypeErrorClass.New("second argument must be an array"));
                _parameters = new JsInstance[arguments.Length];
                for (int i = 0; i < arguments.Length; i++) {
                    _parameters[i] = arguments[i.ToString()];
                }
            }
            else {
                _parameters = JsInstance.EMPTY;
            }

            // Executes the statements in 'that' and use _this as the target of the call
            visitor.ExecuteFunction(function, _this, _parameters);
            return visitor.Result;
            //visitor.CallFunction(function, _this, _parameters);

            //return visitor.Result;
        }
开发者ID:nate-yocom,项目名称:jint,代码行数:34,代码来源:JsApplyFunction.cs

示例3: Execute

        public override JsInstance Execute(IJintVisitor visitor, JsDictionaryObject that, JsInstance[] parameters)
        {
            if (that == null)
            {
                JsArray array = Global.ArrayClass.New();

                for (int i = 0; i < parameters.Length; i++)
                {
                    array[i.ToString()] = parameters[i];
                }

                visitor.Return(array);
            }
            else
            {
                // When called as part of a new expression, it is a constructor: it initialises the newly created object.
                for (int i = 0; i < parameters.Length; i++)
                {
                    that[i.ToString()] = parameters[i];
                }

                visitor.Return(that);
            }

            return that;
        }
开发者ID:Fedorm,项目名称:core-master,代码行数:26,代码来源:JsArrayConstructor.cs

示例4: Execute

        public override JsInstance Execute(IJintVisitor visitor, JsDictionaryObject that, JsInstance[] parameters)
        {
            if (that == null)
            {
                // 15.5.1 - When String is called as a function rather than as a constructor, it performs a type conversion.
                if (parameters.Length > 0)
                {
                    return visitor.Return(Global.StringClass.New(parameters[0].ToString()));
                }
                else
                {
                    return visitor.Return(Global.StringClass.New(String.Empty));
                }
            }
            else
            {
                // 15.5.2 - When String is called as part of a new expression, it is a constructor: it initialises the newly created object.
                if (parameters.Length > 0)
                {
                    that.Value = parameters[0].ToString();
                }
                else
                {
                    that.Value = String.Empty;
                }

                return visitor.Return(that);
            }
        }
开发者ID:pusp,项目名称:o2platform,代码行数:29,代码来源:JsStringConstructor.cs

示例5: Execute

        public override JsInstance Execute(IJintVisitor visitor, JsDictionaryObject that, JsInstance[] parameters)
        {
            JsFunction function = that as JsFunction;

            if (function == null)
            {
                throw new ArgumentException("the target of call() must be a function");
            }

            JsDictionaryObject _this;
            JsInstance[] _parameters;
            if (parameters.Length >= 1 && parameters[0] != JsUndefined.Instance && parameters[0] != JsNull.Instance)
                _this = parameters[0] as JsDictionaryObject;
            else
                _this = visitor.Global as JsDictionaryObject;

            if (parameters.Length >= 2 && parameters[1] != JsNull.Instance)
            {
                _parameters = new JsInstance[parameters.Length - 1];
                for (int i = 1; i < parameters.Length; i++)
                {
                    _parameters[i - 1] = parameters[i];
                }
            }
            else
            {
                _parameters = JsInstance.EMPTY;
            }
            // Executes the statements in 'that' and use _this as the target of the call
            visitor.ExecuteFunction(function, _this, _parameters);
            return visitor.Result;
            //visitor.CallFunction(function, _this, _parameters);

            //return visitor.Result;
        }
开发者ID:pusp,项目名称:o2platform,代码行数:35,代码来源:JsCallFunction.cs

示例6: ValueDescriptor

 public ValueDescriptor(JsDictionaryObject owner, string name)
     : base(owner, name)
 {
     Enumerable = true;
     Writable = true;
     Configurable = true;
 }
开发者ID:pusp,项目名称:o2platform,代码行数:7,代码来源:ValueDescriptor.cs

示例7: Execute

        public override JsInstance Execute(IJintVisitor visitor, JsDictionaryObject that, JsInstance[] parameters)
        {
            if (that == null)
            {
                // 15.7.1 - When Number is called as a function rather than as a constructor, it performs a type conversion.
                if (parameters.Length > 0)
                {
                    return visitor.Return(new JsNumber(parameters[0].ToNumber()));
                }
                else
                {
                    return visitor.Return(new JsNumber(0));
                }
            }
            else
            {
                // 15.7.2 - When Number is called as part of a new expression, it is a constructor: it initialises the newly created object.
                if (parameters.Length > 0)
                {
                    that.Value = parameters[0].ToNumber();
                }
                else
                {
                    that.Value = 0;
                }

                visitor.Return(that);
            }

            return that;
        }
开发者ID:pusp,项目名称:o2platform,代码行数:31,代码来源:JsNumberConstructor.cs

示例8: Execute

        public override JsInstance Execute(IJintVisitor visitor, JsDictionaryObject that, JsInstance[] parameters) {
            if (parameters.Length == 0) {
                return visitor.Return(New());
                //throw new ArgumentNullException("pattern");
            }

            return visitor.Return(New(parameters[0].ToString(), false, false, false));
        }
开发者ID:joelmartinez,项目名称:Jint.Phone,代码行数:8,代码来源:JsRegExpConstructor.cs

示例9: JsScope

 public JsScope(JsScope outer, JsDictionaryObject bag)
     : base(outer) {
     if (outer == null)
         throw new ArgumentNullException("outer");
     if (bag == null)
         throw new ArgumentNullException("bag");
     globalScope = outer.Global;
     this.bag = bag;
 }
开发者ID:925coder,项目名称:ravendb,代码行数:9,代码来源:JsScope.cs

示例10: LinkedDescriptor

 /// <summary>
 /// Constructs new descriptor
 /// </summary>
 /// <param name="owner">An owner of the new descriptor</param>
 /// <param name="name">A name of the new descriptor</param>
 /// <param name="source">A property descriptor of the target object to which we should link to</param>
 /// <param name="that">A target object to whose property we are linking. This parameter will be
 /// used in the calls to a 'Get' and 'Set' properties of the source descriptor.</param>
 public LinkedDescriptor(JsDictionaryObject owner, string name, Descriptor source, JsDictionaryObject that)
     : base(owner, name)
 {
     d = source;
     Enumerable = true;
     Writable = true;
     Configurable = true;
     m_that = that;
 }
开发者ID:splhack,项目名称:unity-jint,代码行数:17,代码来源:LinkedDescriptor.cs

示例11: NativeDescriptor

 public NativeDescriptor(JsDictionaryObject owner, NativeDescriptor src)
     : base(owner, src.Name)
 {
     getter = src.getter;
     setter = src.setter;
     Writable = src.Writable;
     Configurable = src.Configurable;
     Enumerable = src.Enumerable;
 }
开发者ID:joelmartinez,项目名称:Jint.Phone,代码行数:9,代码来源:NativeDescriptor.cs

示例12: ConcatImpl

        /// <summary>
        /// 15.5.4.6
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public JsInstance ConcatImpl(JsDictionaryObject target, JsInstance[] parameters)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(target.ToString());

            for (int i = 0; i < parameters.Length; i++) {
                sb.Append(parameters[i].ToString());
            }

            return Global.StringClass.New(sb.ToString());
        }
开发者ID:nate-yocom,项目名称:jint,代码行数:17,代码来源:JsStringConstructor.cs

示例13: CharCodeAtImpl

        /// <summary>
        /// 15.5.4.5
        /// </summary>
        /// <param name="target"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public JsInstance CharCodeAtImpl(JsDictionaryObject target, JsInstance[] parameters)
        {
            var r = target.ToString();
            var at = (int)parameters[0].ToNumber();

            if (r == String.Empty || at > r.Length - 1) {
                return Global.NaN;
            }
            else {
                return Global.NumberClass.New(Convert.ToInt32(r[at]));
            }
        }
开发者ID:nate-yocom,项目名称:jint,代码行数:18,代码来源:JsStringConstructor.cs

示例14: LinkedDescriptor

 /// <summary>
 /// Constructs new descriptor
 /// </summary>
 /// <param name="owner">An owner of the new descriptor</param>
 /// <param name="name">A name of the new descriptor</param>
 /// <param name="source">A property descriptor of the target object to which we should link to</param>
 /// <param name="that">A target object to whose property we are linking. This parameter will be
 /// used in the calls to a 'Get' and 'Set' properties of the source descriptor.</param>
 public LinkedDescriptor(JsDictionaryObject owner, string name, Descriptor source, JsDictionaryObject that)
     : base(owner, name) {
     if (source.isReference) {
         LinkedDescriptor sourceLink = source as LinkedDescriptor;
         d = sourceLink.d;
         m_that = sourceLink.m_that;
     } else
         d = source;
     Enumerable = true;
     Writable = true;
     Configurable = true;
     m_that = that;
 }
开发者ID:925coder,项目名称:ravendb,代码行数:21,代码来源:LinkedDescriptor.cs

示例15: Execute

        public override JsInstance Execute(IJintVisitor visitor, JsDictionaryObject that, JsInstance[] parameters) {
            if (that == null || (that as IGlobal) == visitor.Global ) {
                return visitor.Return(Construct(parameters,null,visitor));
            }
            else {
                // When called as part of a new expression, it is a constructor: it initialises the newly created object.
                for (int i = 0; i < parameters.Length; i++) {
                    that[i.ToString()] = parameters[i];
                }

                return visitor.Return(that);
            }
        }
开发者ID:robashton,项目名称:ravendb,代码行数:13,代码来源:JsArrayConstructor.cs


注:本文中的JsDictionaryObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。