コード例 #1
0
ファイル: XMLCtor.cs プロジェクト: lichuan80/EcmaScript.NET
        protected internal override void SetInstanceIdValue(int id, System.Object value_Renamed)
        {
            switch (id - base.MaxInstanceId)
            {
            case Id_ignoreComments:
                lib.ignoreComments = ScriptConvert.ToBoolean(value_Renamed);
                return;

            case Id_ignoreProcessingInstructions:
                lib.ignoreProcessingInstructions = ScriptConvert.ToBoolean(value_Renamed);
                return;

            case Id_ignoreWhitespace:
                lib.ignoreWhitespace = ScriptConvert.ToBoolean(value_Renamed);
                return;

            case Id_prettyIndent:
                lib.prettyIndent = ScriptConvert.ToInt32(value_Renamed);
                return;

            case Id_prettyPrinting:
                lib.prettyPrinting = ScriptConvert.ToBoolean(value_Renamed);
                return;
            }
            base.SetInstanceIdValue(id, value_Renamed);
        }
コード例 #2
0
        protected internal override void SetInstanceIdValue(int id, object value)
        {
            int shifted = id - base.MaxInstanceId;

            switch (shifted)
            {
            case Id_multiline:
            case Id_STAR:
                Impl.multiline = ScriptConvert.ToBoolean(value);
                return;


            case Id_input:
            case Id_UNDERSCORE:
                Impl.input = ScriptConvert.ToString(value);
                return;
            }
            base.SetInstanceIdValue(id, value);
        }
コード例 #3
0
        public override object ExecIdCall(IdFunctionObject f, Context cx, IScriptable scope, IScriptable thisObj, object [] args)
        {
            if (!f.HasTag(BOOLEAN_TAG))
            {
                return(base.ExecIdCall(f, cx, scope, thisObj, args));
            }
            int id = f.MethodId;

            if (id == Id_constructor)
            {
                bool b = ScriptConvert.ToBoolean(args, 0);
                if (thisObj == null)
                {
                    return(new BuiltinBoolean(b));
                }
                return(b);
            }

            // The rest of Boolean.prototype methods require thisObj to be Boolean

            if (!(thisObj is BuiltinBoolean))
            {
                throw IncompatibleCallError(f);
            }
            bool value = ((BuiltinBoolean)thisObj).booleanValue;

            switch (id)
            {
            case Id_toString:
                return(value ? "true" : "false");


            case Id_toSource:
                return(value ? "(new Boolean(true))" : "(new Boolean(false))");

            case Id_valueOf:
                return(value);
            }
            throw new ArgumentException(Convert.ToString(id));
        }