• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# JsDictionaryObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Execute

 public override JsInstance Execute(IJintVisitor visitor, JsDictionaryObject that, JsInstance[] parameters, Type[] genericArguments)
 {
     if (m_generics.Count == 0 && (genericArguments != null && genericArguments.Length > 0))
         return base.Execute(visitor, that, parameters, genericArguments);
     else
     {
         JsMethodImpl impl = m_overloads.ResolveOverload(parameters, genericArguments);
         if (impl == null)
             throw new JintException(String.Format("No matching overload found {0}<{1}>", Name, genericArguments));
         visitor.Return(impl(visitor.Global, that, parameters));
         return that;
     }
 }
开发者ID:cosh,项目名称:Jint,代码行数:13,代码来源:NativeMethodOverload.cs


示例17: Execute

        /// <summary>
        /// 15.2.2.1
        /// </summary>
        public override JsInstance Execute(IJintVisitor visitor, JsDictionaryObject that, JsInstance[] parameters)
        {
            if (parameters.Length > 0) {
                switch (parameters[0].Class) {
                    case JsInstance.CLASS_STRING: return Global.StringClass.New(parameters[0].ToString());
                    case JsInstance.CLASS_NUMBER: return Global.NumberClass.New(parameters[0].ToNumber());
                    case JsInstance.CLASS_BOOLEAN: return Global.BooleanClass.New(parameters[0].ToBoolean());
                    default:
                        return parameters[0];
                }
            }

            return New(this);
        }
开发者ID:splhack,项目名称:unity-jint,代码行数:17,代码来源:JsObjectConstructor.cs


示例18: Execute

        public override JsInstance Execute(IJintVisitor visitor, JsDictionaryObject that, JsInstance[] parameters)
        {
            int clrParameterCount = Delegate.Method.GetParameters().Length;
            object[] clrParameters = new object[clrParameterCount];

            for (int i = 0; i < parameters.Length; i++) {
                // First see if either the JsInstance or it's value can be directly accepted without converstion
                if (typeof(JsInstance).IsAssignableFrom(Parameters[i].ParameterType) && Parameters[i].ParameterType.IsInstanceOfType(parameters[i])) {
                    clrParameters[i] = parameters[i];
                }
                else if (Parameters[i].ParameterType.IsInstanceOfType(parameters[i].Value)) {
                    clrParameters[i] = parameters[i].Value;
                }
                else {
                    clrParameters[i] = visitor.Global.Marshaller.MarshalJsValue<object>(parameters[i]);
                }
            }

            object result;

            try {
                result = Delegate.DynamicInvoke(clrParameters);
            }
            catch (TargetInvocationException e) {
                throw e.InnerException;
            }
            catch (Exception e) {
                if (e.InnerException is JsException) {
                    throw e.InnerException;
                }

                throw;
            }

            if (result != null) {
                // Don't wrap if the result should be a JsInstance
                if (typeof(JsInstance).IsInstanceOfType(result)) {
                    visitor.Return((JsInstance)result);
                }
                else {
                    visitor.Return(visitor.Global.WrapClr(result));
                }
            }
            else {
                visitor.Return(JsUndefined.Instance);
            }

            return null;
        }
开发者ID:chrisadd,项目名称:Jint,代码行数:49,代码来源:ClrFunction.cs


示例19: ToPropertyDesciptor

        /// <summary>
        /// 8.10.5
        /// </summary>
        /// <param name="global"></param>
        /// <param name="obj"></param>
        /// <returns></returns>
        internal static Descriptor ToPropertyDesciptor(IGlobal global, JsDictionaryObject owner, string name, JsInstance jsInstance) {
            if (jsInstance.Class != JsInstance.CLASS_OBJECT) {
                throw new JsException(global.TypeErrorClass.New("The target object has to be an instance of an object"));
            }

            JsObject obj = (JsObject)jsInstance;
            if ((obj.HasProperty("value") || obj.HasProperty("writable")) && (obj.HasProperty("set") || obj.HasProperty("get"))) {
                throw new JsException(global.TypeErrorClass.New("The property cannot be both writable and have get/set accessors or cannot have both a value and an accessor defined"));
            }

            Descriptor desc;
            JsInstance result = null;

            if (obj.HasProperty("value")) {
                desc = new ValueDescriptor(owner, name, obj["value"]);
            }
            else {
                desc = new PropertyDescriptor(global, owner, name);
            }

            if (obj.TryGetProperty("enumerable", out result)) {
                desc.Enumerable = result.ToBoolean();
            }

            if (obj.TryGetProperty("configurable", out result)) {
                desc.Configurable = result.ToBoolean();
            }

            if (obj.TryGetProperty("writable", out result)) {
                desc.Writable = result.ToBoolean();
            }

            if (obj.TryGetProperty("get", out result)) {
                if (!(result is JsFunction))
                    throw new JsException(global.TypeErrorClass.New("The getter has to be a function"));

                ((PropertyDescriptor)desc).GetFunction = (JsFunction)result;
            }

            if (obj.TryGetProperty("set", out result)) {
                if (!(result is JsFunction))
                    throw new JsException(global.TypeErrorClass.New("The setter has to be a function"));

                ((PropertyDescriptor)desc).SetFunction = (JsFunction)result;
            }

            return desc;
        }
开发者ID:925coder,项目名称:ravendb,代码行数:54,代码来源:Descriptor.cs


示例20: JsFunctionDelegate

 public JsFunctionDelegate(IJintVisitor visitor, JsFunction function, JsDictionaryObject that,Type delegateType)
 {
     if (visitor == null)
         throw new ArgumentNullException("visitor");
     if (function == null)
         throw new ArgumentNullException("function");
     if (delegateType == null)
         throw new ArgumentNullException("delegateType");
     if (!typeof(Delegate).IsAssignableFrom(delegateType))
         throw new ArgumentException("A delegate type is required", "delegateType");
     m_visitor = visitor;
     m_function = function;
     m_delegateType = delegateType;
     m_that = that;
     m_marshaller = visitor.Global.Marshaller;
 }
开发者ID:cosh,项目名称:Jint,代码行数:16,代码来源:JsFunctionDelegate.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# JsExpression类代码示例发布时间:2022-05-24
下一篇:
C# JsDate类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap