private static RegExpObject ToRegExpObject(object regExp, VsaEngine engine) { if ((regExp == null) || (regExp is Missing)) { return (RegExpObject) engine.GetOriginalRegExpConstructor().Construct("", false, false, false); } RegExpObject obj2 = regExp as RegExpObject; if (obj2 != null) { return obj2; } Regex regex = regExp as Regex; if (regex != null) { return new RegExpObject(regex); } return (RegExpObject) engine.GetOriginalRegExpConstructor().Construct(Microsoft.JScript.Convert.ToString(regExp), false, false, false); }
private static RegExpObject ToRegExpObject(Object regExp, VsaEngine engine){ if (regExp == null || regExp is Missing) return (RegExpObject)engine.GetOriginalRegExpConstructor().Construct("", false, false, false); RegExpObject result = regExp as RegExpObject; if (result != null) return result; Regex regex = regExp as Regex; if (regex != null) return new RegExpObject(regex); return (RegExpObject)engine.GetOriginalRegExpConstructor().Construct(Convert.ToString(regExp), false, false, false); }