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


C# Context.HasFeature方法代码示例

本文整理汇总了C#中EcmaScript.NET.Context.HasFeature方法的典型用法代码示例。如果您正苦于以下问题:C# Context.HasFeature方法的具体用法?C# Context.HasFeature怎么用?C# Context.HasFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EcmaScript.NET.Context的用法示例。


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

示例1: initFromContext

        public virtual void initFromContext (Context cx)
        {
            setErrorReporter (cx.ErrorReporter);
            this.languageVersion = cx.Version;
            useDynamicScope = cx.compileFunctionsWithDynamicScopeFlag;
            generateDebugInfo = (!cx.GeneratingDebugChanged || cx.GeneratingDebug);
            reservedKeywordAsIdentifier = cx.HasFeature (Context.Features.ReservedKeywordAsIdentifier);
            allowMemberExprAsFunctionName = cx.HasFeature (Context.Features.MemberExprAsFunctionName);
            xmlAvailable = cx.HasFeature (Context.Features.E4x);
            getterAndSetterSupport = cx.HasFeature (Context.Features.GetterAndSetter);

            optimizationLevel = cx.OptimizationLevel;

            generatingSource = cx.GeneratingSource;
            activationNames = cx.activationNames;
        }
开发者ID:rumincayman,项目名称:EcmaScript.NET,代码行数:16,代码来源:CompilerEnvirons.cs

示例2: createSpecial

        internal static IRef createSpecial (Context cx, object obj, string name)
        {
            IScriptable target = ScriptConvert.ToObjectOrNull (cx, obj);
            if (target == null) {
                throw ScriptRuntime.UndefReadError (obj, name);
            }

            Types type;
            if (name.Equals ("__proto__")) {
                type = Types.Proto;
            }
            else if (name.Equals ("__parent__")) {
                type = Types.Parent;
            }
            else {
                throw new ArgumentException (name);
            }

            if (!cx.HasFeature (Context.Features.ParentProtoProperties)) {
                // Clear special after checking for valid name!
                type = Types.None;
            }

            return new SpecialRef (target, type, name);
        }
开发者ID:rumincayman,项目名称:EcmaScript.NET,代码行数:25,代码来源:SpecialRef.cs

示例3: evalSpecial

        /// <summary> The eval function property of the global object.
        /// 
        /// See ECMA 15.1.2.1
        /// </summary>
        public static object evalSpecial(Context cx, IScriptable scope, object thisArg, object [] args, string filename, int lineNumber)
        {
            if (args.Length < 1)
                return Undefined.Value;
            object x = args [0];
            if (!(x is string)) {
                if (cx.HasFeature (Context.Features.StrictEval)) {
                    throw Context.ReportRuntimeErrorById ("msg.eval.nonstring.strict");
                }
                string message = ScriptRuntime.GetMessage ("msg.eval.nonstring");
                Context.ReportWarning (message);
                return x;
            }
            if (filename == null) {
                int [] linep = new int [1];
                filename = Context.GetSourcePositionFromStack (linep);
                if (filename != null) {
                    lineNumber = linep [0];
                }
                else {
                    filename = "";
                }
            }
            string sourceName = ScriptRuntime.makeUrlForGeneratedScript (true, filename, lineNumber);

            ErrorReporter reporter;
            reporter = DefaultErrorReporter.ForEval (cx.ErrorReporter);

            // Compile with explicit interpreter instance to force interpreter
            // mode.
            IScript script = cx.CompileString ((string)x, new Interpreter (), reporter, sourceName, 1, (object)null);
            ((InterpretedFunction)script).idata.evalScriptFlag = true;
            ICallable c = (ICallable)script;
            return c.Call (cx, scope, (IScriptable)thisArg, ScriptRuntime.EmptyArgs);
        }
开发者ID:arifbudiman,项目名称:TridionMinifier,代码行数:39,代码来源:ScriptRuntime.cs

示例4: DoTopCall

        public static object DoTopCall(ICallable callable, Context cx, IScriptable scope, IScriptable thisObj, object [] args)
        {
            if (scope == null)
                throw new ArgumentException ();
            if (cx.topCallScope != null)
                throw new ApplicationException ();

            object result;
            cx.topCallScope = ScriptableObject.GetTopLevelScope (scope);
            cx.useDynamicScope = cx.HasFeature (Context.Features.DynamicScope);
            ContextFactory f = cx.Factory;
            try {
                result = f.DoTopCall (callable, cx, scope, thisObj, args);
            }
            finally {
                cx.topCallScope = null;
                // Cleanup cached references
                cx.cachedXMLLib = null;

                if (cx.currentActivationCall != null) {
                    // Function should always call exitActivationFunction
                    // if it creates activation record
                    throw new ApplicationException (
                        "ActivationCall without exitActivationFunction() invokation."
                    );
                }
            }
            return result;
        }
开发者ID:arifbudiman,项目名称:TridionMinifier,代码行数:29,代码来源:ScriptRuntime.cs

示例5: setName

 public static object setName(IScriptable bound, object value, Context cx, IScriptable scope, string id)
 {
     if (bound != null) {
         if (bound is XMLObject) {
             XMLObject xmlObject = (XMLObject)bound;
             xmlObject.EcmaPut (cx, id, value);
         }
         else {
             ScriptableObject.PutProperty (bound, id, value);
         }
     }
     else {
         // "newname = 7;", where 'newname' has not yet
         // been defined, creates a new property in the
         // top scope unless strict mode is specified.
         if (cx.HasFeature (Context.Features.StrictVars)) {
             throw Context.ReportRuntimeErrorById ("msg.assn.create.strict", id);
         }
         // Find the top scope by walking up the scope chain.
         bound = ScriptableObject.GetTopLevelScope (scope);
         if (cx.useDynamicScope) {
             bound = checkDynamicScope (cx.topCallScope, bound);
         }
         bound.Put (id, bound, value);
     }
     return value;
 }
开发者ID:arifbudiman,项目名称:TridionMinifier,代码行数:27,代码来源:ScriptRuntime.cs

示例6: InitStandardObjects

        public static ScriptableObject InitStandardObjects(Context cx, ScriptableObject scope, bool zealed)
        {
            if (scope == null) {
                scope = new BuiltinObject ();
            }
            scope.AssociateValue (LIBRARY_SCOPE_KEY, scope);

            BaseFunction.Init (scope, zealed);
            BuiltinObject.Init (scope, zealed);

            IScriptable objectProto = ScriptableObject.GetObjectPrototype (scope);

            // Function.prototype.__proto__ should be Object.prototype
            IScriptable functionProto = ScriptableObject.GetFunctionPrototype (scope);
            functionProto.SetPrototype (objectProto);

            // Set the prototype of the object passed in if need be
            if (scope.GetPrototype () == null)
                scope.SetPrototype (objectProto);

            // must precede NativeGlobal since it's needed therein
            BuiltinError.Init (scope, zealed);
            BuiltinGlobal.Init (cx, scope, zealed);

            if (scope is BuiltinGlobalObject) {
                ((BuiltinGlobalObject)scope).Init (scope, zealed);
            }

            BuiltinArray.Init (scope, zealed);
            BuiltinString.Init (scope, zealed);
            BuiltinBoolean.Init (scope, zealed);
            BuiltinNumber.Init (scope, zealed);
            BuiltinDate.Init (scope, zealed);
            BuiltinMath.Init (scope, zealed);

            BuiltinWith.Init (scope, zealed);
            BuiltinCall.Init (scope, zealed);
            BuiltinScript.Init (scope, zealed);

            BuiltinRegExp.Init (scope, zealed);

            if (cx.HasFeature (Context.Features.E4x)) {
                Types.E4X.XMLLib.Init (scope, zealed);
            }

            Continuation.Init (scope, zealed);

            if (cx.HasFeature (Context.Features.NonEcmaItObject)) {
                InitItObject (cx, scope);
            }

            return scope;
        }
开发者ID:arifbudiman,项目名称:TridionMinifier,代码行数:53,代码来源:ScriptRuntime.cs


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