コード例 #1
0
ファイル: ErrorInstance.cs プロジェクト: thejonan/jurassic
        /// <summary>
        /// Creates the Error prototype object.
        /// </summary>
        /// <param name="engine"> The script environment. </param>
        /// <param name="constructor"> A reference to the constructor that owns the prototype. </param>
        /// <param name="type"> The type of error, e.g. Error, RangeError, etc. </param>
        internal static ObjectInstance CreatePrototype(ScriptEngine engine, ErrorConstructor constructor, ErrorType type)
        {
            var result     = CreateRawObject(GetPrototype(engine, type));
            var properties = GetDeclarativeProperties(engine);

            properties.Add(new PropertyNameAndValue("constructor", constructor, PropertyAttributes.NonEnumerable));
            properties.Add(new PropertyNameAndValue("name", type.ToString(), PropertyAttributes.NonEnumerable));
            properties.Add(new PropertyNameAndValue("message", string.Empty, PropertyAttributes.NonEnumerable));
            result.FastSetProperties(properties);
            return(result);
        }
コード例 #2
0
ファイル: ErrorInstance.cs プロジェクト: paulbartrum/jurassic
 /// <summary>
 /// Creates the Error prototype object.
 /// </summary>
 /// <param name="engine"> The script environment. </param>
 /// <param name="constructor"> A reference to the constructor that owns the prototype. </param>
 /// <param name="type"> The type of error, e.g. Error, RangeError, etc. </param>
 internal static ObjectInstance CreatePrototype(ScriptEngine engine, ErrorConstructor constructor, ErrorType type)
 {
     var result = CreateRawObject(GetPrototype(engine, type));
     var properties = GetDeclarativeProperties(engine);
     properties.Add(new PropertyNameAndValue("constructor", constructor, PropertyAttributes.NonEnumerable));
     properties.Add(new PropertyNameAndValue("name", type.ToString(), PropertyAttributes.NonEnumerable));
     properties.Add(new PropertyNameAndValue("message", string.Empty, PropertyAttributes.NonEnumerable));
     result.FastSetProperties(properties);
     return result;
 }