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


C# IArgs类代码示例

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


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

示例1: HasOwnProperty

 private static IDynamic HasOwnProperty(IEnvironment environment, IArgs args)
 {
     if (args.IsEmpty) return environment.False;
     var obj = environment.Context.ThisBinding.ConvertToObject();
     var desc = obj.GetOwnProperty(args[0].ConvertToString().BaseValue);
     return environment.CreateBoolean(desc != null);
 }
开发者ID:ChaosPandion,项目名称:Machete,代码行数:7,代码来源:PObject.cs

示例2: Call

        public virtual IDynamic Call(IEnvironment environment, IDynamic thisBinding, IArgs args)
        {
            var oldContext = environment.Context;
            var newEnvironment = Scope.NewDeclarativeEnvironment();
            using (var newContext = environment.EnterContext())
            {
                newContext.LexicalEnviroment = newEnvironment;
                newContext.VariableEnviroment = newEnvironment;
                newContext.Strict = ExecutableCode.Strict;
                if (ExecutableCode.Strict)
                {
                    newContext.ThisBinding = thisBinding;
                }
                else
                {
                    switch (thisBinding.TypeCode)
                    {
                        case LanguageTypeCode.Undefined:
                        case LanguageTypeCode.Null:
                            newContext.ThisBinding = Environment.GlobalObject;
                            break;
                        default:
                            newContext.ThisBinding = thisBinding.ConvertToObject();
                            break;
                    }
                }

                BindFormalParameters(args);
                Environment.BindFunctionDeclarations(ExecutableCode.FunctionDeclarations, ExecutableCode.Strict, true);
                BindArgumentsObject(args);
                Environment.BindVariableDeclarations(ExecutableCode.VariableDeclarations, ExecutableCode.Strict, true);
                return ExecutableCode.Code(environment, args);
            }
        }
开发者ID:ChaosPandion,项目名称:Machete,代码行数:34,代码来源:NFunction.cs

示例3: CreateIterator

 public override IDynamic CreateIterator(IEnvironment environment, IArgs args)
 {
     var scope = Scope.NewDeclarativeEnvironment();
     var generator = new Generator(new GeneratorSteps(Steps));
     var iterator = new HGeneratorIterator(environment, generator, VariableDeclarations, scope);
     return iterator;
 }
开发者ID:ChaosPandion,项目名称:Machete,代码行数:7,代码来源:HGeneratorIterable.cs

示例4: Stringify

 internal static IDynamic Stringify(IEnvironment environment, IArgs args)
 {
     var value = args[0];
     var replacer = args[1];
     var space = args[2];
     return Machete.Compiler.JsonParser.Stringify(environment, value, replacer, space);
 }
开发者ID:ChaosPandion,项目名称:Machete,代码行数:7,代码来源:BJson.cs

示例5: IsArray

        internal static IDynamic IsArray(IEnvironment environment, IArgs args)
        {
            // 15.4.3.2 Array.isArray ( arg )

            var arg = args[0] as IObject;
            return environment.CreateBoolean(arg != null && arg.Class == "Array");
        }
开发者ID:ChaosPandion,项目名称:Machete,代码行数:7,代码来源:CArray.cs

示例6: Call

 protected override sealed IDynamic Call(IEnvironment environment, IArgs args)
 {
     if (args.Count > 0)
     {
         return args[0].ConvertToString();
     }
     return environment.CreateString("");
 }
开发者ID:ChaosPandion,项目名称:Machete,代码行数:8,代码来源:CString.cs

示例7: Call

 protected override sealed IDynamic Call(IEnvironment environment, IArgs args)
 {
     if (args.Count > 0)
     {
         return args[0].ConvertToNumber();
     }
     return environment.CreateNumber(0.0);
 }
开发者ID:ChaosPandion,项目名称:Machete,代码行数:8,代码来源:CNumber.cs

示例8: Call

 public IDynamic Call(IEnvironment environment, IDynamic thisBinding, IArgs args)
 {
     using (var newContext = environment.EnterContext())
     {
         Environment.Context.ThisBinding = thisBinding;
         return _code(environment, args);
     }
 }
开发者ID:ChaosPandion,项目名称:Machete,代码行数:8,代码来源:BFunction.cs

示例9: Construct

 public override IObject Construct(IEnvironment environment, IArgs args)
 {
     var func = TargetFunction as NFunction;
     if (func == null)
     {
         throw Environment.CreateTypeError("");
     }
     return func.Construct(environment, environment.ConcatArgs(BoundArguments, args));
 }
开发者ID:ChaosPandion,项目名称:Machete,代码行数:9,代码来源:NBoundFunction.cs

示例10: Construct

 public override IObject Construct(IEnvironment environment, IArgs args)
 {
     var obj = new NBoolean(environment);
     obj.Class = "Boolean";
     obj.Extensible = true;
     obj.PrimitiveValue = args[0].ConvertToBoolean();
     obj.Prototype = environment.BooleanPrototype;
     return obj;
 }
开发者ID:ChaosPandion,项目名称:Machete,代码行数:9,代码来源:CBoolean.cs

示例11: Call

 protected override sealed IDynamic Call(IEnvironment environment, IArgs args)
 {
     var patternObject = args[0] as IObject;
     if (patternObject != null && patternObject.Class == "RegExp")
     {
         return patternObject;
     }
     return Construct(environment, args);
 }
开发者ID:ChaosPandion,项目名称:Machete,代码行数:9,代码来源:CRegExp.cs

示例12: FromCharCode

 internal static IDynamic FromCharCode(IEnvironment environment, IArgs args)
 {
     var sb = new StringBuilder(args.Count);
     foreach (var arg in args)
     {
         sb.Append((char)arg.ConvertToUInt16().BaseValue);
     }
     return environment.CreateString(sb.ToString());
 }
开发者ID:ChaosPandion,项目名称:Machete,代码行数:9,代码来源:CString.cs

示例13: Filter

 internal static IDynamic Filter(IEnvironment environment, IArgs args)
 {
     if (args.Count < 2)
         throw environment.CreateTypeError("The arguments 'iterable' and 'predicate' are required.");
     var iterable = args[1].ConvertToObject();
     var predicate = args[0].ConvertToObject() as ICallable;
     if (predicate == null)
         throw environment.CreateTypeError("The argument 'predicate' must be a callable function.");
     return new HFilterIterable(environment, iterable, predicate);
 }
开发者ID:ChaosPandion,项目名称:Machete,代码行数:10,代码来源:HIterable.cs

示例14: Assert

 internal static IDynamic Assert(IEnvironment environment, IArgs args)
 {
     var condition = args[0].ConvertToBoolean().BaseValue;
     if (!condition)
     {
         var message = args[1].ConvertToString().BaseValue;
         throw environment.CreateError(message);
     }
     return environment.Undefined;
 }
开发者ID:ChaosPandion,项目名称:Machete,代码行数:10,代码来源:BGlobal.cs

示例15: Next

 public override IDynamic Next(IEnvironment environment, IArgs args)
 {
     if (_complete)
         return environment.False;
     _initialized = true;
     if (++_index < _length)
         return environment.True;
     _complete = true;
     return environment.False;
 }
开发者ID:ChaosPandion,项目名称:Machete,代码行数:10,代码来源:HStringIterator.cs


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