Exemple #1
0
 public static ScriptObject ToObject(Environment env, string s)
 {
     return env.NewString(s);
 }
Exemple #2
0
        public static ScriptObject ToObject(Environment env, BoxedValue v)
        {
            switch (v.Tag)
            {
                case TypeTags.Object:
                case TypeTags.Function:
                    return v.Object;

                case TypeTags.SuffixString:
                    return env.NewString(v.Clr.ToString());

                case TypeTags.String:
                    return env.NewString(v.String);

                case TypeTags.Bool:
                    return env.NewBoolean(v.Bool);

                case TypeTags.Clr:
                case TypeTags.Undefined:
                    return env.RaiseTypeError<ScriptObject>("Can't convert Undefined, Null or CLR to Object");

                default:
                    return env.NewNumber(v.Number);
            }
        }
Exemple #3
0
 public static CommonObject ToObject(Environment env, string s)
 {
     return env.NewString(s);
 }