本文整理汇总了C#中Jurassic.Library.ObjectInstance类的典型用法代码示例。如果您正苦于以下问题:C# ObjectInstance类的具体用法?C# ObjectInstance怎么用?C# ObjectInstance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectInstance类属于Jurassic.Library命名空间,在下文中一共展示了ObjectInstance类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ThrowTypeErrorFunction
/// <summary>
/// Creates a new ThrowTypeErrorFunction instance.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
/// <param name="message"> The TypeError message. </param>
internal ThrowTypeErrorFunction(ObjectInstance prototype, string message)
: base(prototype)
{
this.FastSetProperty("length", 0);
this.IsExtensible = false;
this.message = message;
}
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:12,代码来源:ThrowTypeErrorFunction.cs
示例2: DataViewInstance
// INITIALIZATION
//_________________________________________________________________________________________
/// <summary>
/// Creates a new DataView instance.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
/// <param name="buffer"> An existing ArrayBuffer to use as the storage for the new
/// DataView object. </param>
/// <param name="byteOffset"> The offset, in bytes, to the first byte in the specified
/// buffer for the new view to reference. If not specified, the view of the buffer will
/// start with the first byte. </param>
/// <param name="byteLength"> The number of elements in the byte array. If unspecified,
/// length of the view will match the buffer's length. </param>
internal DataViewInstance(ObjectInstance prototype, ArrayBufferInstance buffer, int byteOffset, int byteLength)
: base(prototype)
{
this.buffer = buffer;
this.byteOffset = byteOffset;
this.byteLength = byteLength;
}
开发者ID:paulbartrum,项目名称:jurassic,代码行数:20,代码来源:DataViewInstance.cs
示例3: JSONObject
// INITIALIZATION
//_________________________________________________________________________________________
/// <summary>
/// Creates a new JSON object.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
internal JSONObject(ObjectInstance prototype)
: base(prototype)
{
var properties = GetDeclarativeProperties(Engine);
properties.Add(new PropertyNameAndValue(Engine.Symbol.ToStringTag, "JSON", PropertyAttributes.Configurable));
FastSetProperties(properties);
}
开发者ID:paulbartrum,项目名称:jurassic,代码行数:13,代码来源:JSONObject.cs
示例4: ClrStubFunction
// INITIALIZATION
//_________________________________________________________________________________________
/// <summary>
/// Creates a function which calls a .NET method, with no name or length.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
/// <param name="call"> The delegate to call when calling the JS method. </param>
internal ClrStubFunction(ObjectInstance prototype, Func<ScriptEngine, object, object[], object> call)
: base(prototype)
{
// Let's not even bother with setting the name and length!
// Use sparingly.
this.callBinder = call;
}
开发者ID:paulbartrum,项目名称:jurassic,代码行数:14,代码来源:ClrStubFunction.cs
示例5: LoaderInstance
/// <summary>
/// Initializes a new instance of the <see cref="LoaderInstance"/> class.
/// </summary>
/// <param name="prototype">The prototype.</param>
/// <param name="scriptRunner">The script runner.</param>
public LoaderInstance(ObjectInstance prototype, ScriptRunner scriptRunner)
: base(prototype)
{
this.scriptRunner = scriptRunner;
this.webClient = new WebClient();
this.PopulateFunctions();
}
开发者ID:Alxandr,项目名称:RunJS,代码行数:12,代码来源:Loader.cs
示例6: AddObject
public void AddObject(string name, ObjectInstance obj)
{
if(name != null && obj != null)
{
engine.SetGlobalValue(name, obj);
}
}
开发者ID:generatives,项目名称:Magic-Game,代码行数:7,代码来源:Scriptable.cs
示例7: ClrFunction
// INITIALIZATION
//_________________________________________________________________________________________
/// <summary>
/// Creates a new instance of a built-in constructor function.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
/// <param name="name"> The name of the function. </param>
/// <param name="instancePrototype"> </param>
protected ClrFunction(ObjectInstance prototype, string name, ObjectInstance instancePrototype)
: base(prototype)
{
if (name == null)
throw new ArgumentNullException("name");
if (instancePrototype == null)
throw new ArgumentNullException("instancePrototype");
// This is a constructor so ignore the "this" parameter when the function is called.
thisBinding = this;
// Search through every method in this type looking for [JSCallFunction] and [JSConstructorFunction] attributes.
var callBinderMethods = new List<JSBinderMethod>(1);
var constructBinderMethods = new List<JSBinderMethod>(1);
var methods = this.GetType().GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly);
foreach (var method in methods)
{
// Search for the [JSCallFunction] and [JSConstructorFunction] attributes.
var callAttribute = (JSCallFunctionAttribute) Attribute.GetCustomAttribute(method, typeof(JSCallFunctionAttribute));
var constructorAttribute = (JSConstructorFunctionAttribute)Attribute.GetCustomAttribute(method, typeof(JSConstructorFunctionAttribute));
// Can't declare both attributes.
if (callAttribute != null && constructorAttribute != null)
throw new InvalidOperationException("Methods cannot be marked with both [JSCallFunction] and [JSConstructorFunction].");
if (callAttribute != null)
{
// Method is marked with [JSCallFunction]
callBinderMethods.Add(new JSBinderMethod(method, callAttribute.Flags));
}
else if (constructorAttribute != null)
{
var binderMethod = new JSBinderMethod(method, constructorAttribute.Flags);
constructBinderMethods.Add(binderMethod);
// Constructors must return ObjectInstance or a derived type.
if (typeof(ObjectInstance).IsAssignableFrom(binderMethod.ReturnType) == false)
throw new InvalidOperationException(string.Format("Constructors must return {0} (or a derived type).", typeof(ObjectInstance).Name));
}
}
// Initialize the Call function.
if (callBinderMethods.Count > 0)
this.callBinder = new JSBinder(callBinderMethods);
else
this.callBinder = new JSBinder(new JSBinderMethod(new Func<object>(() => Undefined.Value).Method));
// Initialize the Construct function.
if (constructBinderMethods.Count > 0)
this.constructBinder = new JSBinder(constructBinderMethods);
else
this.constructBinder = new JSBinder(new JSBinderMethod(new Func<ObjectInstance>(() => this.Engine.Object.Construct()).Method));
// Add function properties.
this.FastSetProperty("name", name);
this.FastSetProperty("length", this.callBinder.FunctionLength);
this.FastSetProperty("prototype", instancePrototype);
instancePrototype.FastSetProperty("constructor", this, PropertyAttributes.NonEnumerable);
}
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:68,代码来源:ClrFunction.cs
示例8: BooleanConstructor
// INITIALIZATION
//_________________________________________________________________________________________
/// <summary>
/// Creates a new Boolean object.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
internal BooleanConstructor(ObjectInstance prototype)
: base(prototype, __STUB__Construct, __STUB__Call)
{
// Initialize the constructor properties.
var properties = new List<PropertyNameAndValue>(3);
InitializeConstructorProperties(properties, "Boolean", 1, BooleanInstance.CreatePrototype(Engine, this));
FastSetProperties(properties);
}
开发者ID:paulbartrum,项目名称:jurassic,代码行数:14,代码来源:BooleanConstructor.cs
示例9: WeakMapConstructor
// INITIALIZATION
//_________________________________________________________________________________________
/// <summary>
/// Creates a new map constructor.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
internal WeakMapConstructor(ObjectInstance prototype)
: base(prototype, __STUB__Construct, __STUB__Call)
{
// Initialize the constructor properties.
var properties = new List<PropertyNameAndValue>();
InitializeConstructorProperties(properties, "WeakMap", 0, WeakMapInstance.CreatePrototype(Engine, this));
FastSetProperties(properties);
}
开发者ID:paulbartrum,项目名称:jurassic,代码行数:14,代码来源:WeakMapConstructor.cs
示例10: JsEventObject
/// <summary>
/// Initializes a new instance of the <see cref="JsEventObject"/> class.
/// </summary>
/// <param name="prototype">The prototype.</param>
/// <param name="runner">The runner.</param>
public JsEventObject(ObjectInstance prototype, ScriptRunner runner)
: base(prototype)
{
this.runner = runner;
this.events = new Dictionary<string, List<FunctionInstance>>();
PopulateFunctions(typeof(JsEventObject));
}
开发者ID:Alxandr,项目名称:RunJS,代码行数:13,代码来源:JsEventObject.cs
示例11: ThrowTypeErrorFunction
/// <summary>
/// Creates a new ThrowTypeErrorFunction instance.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
/// <param name="message"> The TypeError message. </param>
internal ThrowTypeErrorFunction(ObjectInstance prototype, string message)
: base(prototype)
{
this.FastSetProperty("name", "ThrowTypeError", PropertyAttributes.Configurable);
this.FastSetProperty("length", 0, PropertyAttributes.Configurable);
this.IsExtensible = false;
this.message = message;
}
开发者ID:paulbartrum,项目名称:jurassic,代码行数:13,代码来源:ThrowTypeErrorFunction.cs
示例12: ObjectConstructor
// INITIALIZATION
//_________________________________________________________________________________________
/// <summary>
/// Creates a new Object object.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
/// <param name="instancePrototype"> The prototype for instances created by this function. </param>
internal ObjectConstructor(ObjectInstance prototype, ObjectInstance instancePrototype)
: base(prototype, __STUB__Construct, __STUB__Call)
{
// Initialize the constructor properties.
var properties = GetDeclarativeProperties(Engine);
InitializeConstructorProperties(properties, "Object", 1, instancePrototype);
FastSetProperties(properties);
}
开发者ID:paulbartrum,项目名称:jurassic,代码行数:15,代码来源:ObjectConstructor.cs
示例13: SetIterator
// INITIALIZATION
//_________________________________________________________________________________________
/// <summary>
/// Creates a new set iterator.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
/// <param name="set"> The set to iterate over. </param>
/// <param name="list"> The linked list to iterate over. </param>
/// <param name="kind"> The type of values to return. </param>
internal SetIterator(ObjectInstance prototype, SetInstance set, LinkedList<object> list, Kind kind)
: base(prototype)
{
this.set = set;
this.set.BeforeDelete += Set_BeforeDelete;
this.list = list;
this.kind = kind;
}
开发者ID:paulbartrum,项目名称:jurassic,代码行数:17,代码来源:SetIterator.cs
示例14: XMLDocInstance
public XMLDocInstance(ObjectInstance prototype, string path)
: this(prototype)
{
_doc = new XmlDocument();
_path = path;
_doc.AppendChild(_doc.CreateXmlDeclaration("1.0", null, null));
_doc.AppendChild(_doc.CreateComment("Generated by Sphere SFML XML Content Serializer v1.0"));
}
开发者ID:Radnen,项目名称:sphere-sfml,代码行数:8,代码来源:XMLDocConstructor.cs
示例15: ErrorConstructor
// INITIALIZATION
//_________________________________________________________________________________________
/// <summary>
/// Creates a new derived error function.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
/// <param name="type"> The type of error, e.g. Error, RangeError, etc. </param>
internal ErrorConstructor(ObjectInstance prototype, ErrorType type)
: base(prototype, __STUB__Construct, __STUB__Call)
{
// Initialize the constructor properties.
var properties = new List<PropertyNameAndValue>(3);
InitializeConstructorProperties(properties, type.ToString(), 1, ErrorInstance.CreatePrototype(Engine, this, type));
FastSetProperties(properties);
}
开发者ID:paulbartrum,项目名称:jurassic,代码行数:15,代码来源:ErrorConstructor.cs
示例16: StringInstance
/// <summary>
/// Creates a new string instance.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
/// <param name="value"> The value to initialize the instance. </param>
public StringInstance(ObjectInstance prototype, string value)
: base(prototype)
{
if (value == null)
throw new ArgumentNullException("value");
this.value = value;
this.FastSetProperty("length", value.Length);
}
开发者ID:vipwan,项目名称:CommunityServer,代码行数:13,代码来源:StringInstance.cs
示例17: InitializePrototypeProperties
/// <summary>
/// Initializes the prototype properties.
/// </summary>
/// <param name="obj"> The object to set the properties on. </param>
/// <param name="constructor"> A reference to the constructor that owns the prototype. </param>
internal static void InitializePrototypeProperties(ObjectInstance obj, SymbolConstructor constructor)
{
var engine = obj.Engine;
var properties = GetDeclarativeProperties(engine);
properties.Add(new PropertyNameAndValue("constructor", constructor, PropertyAttributes.NonEnumerable));
properties.Add(new PropertyNameAndValue(engine.Symbol.ToStringTag, "Symbol", PropertyAttributes.Configurable));
obj.FastSetProperties(properties);
}
开发者ID:paulbartrum,项目名称:jurassic,代码行数:13,代码来源:SymbolInstance.cs
示例18: ObjectInstance
/// <summary>
/// Called by derived classes to create a new object instance.
/// </summary>
/// <param name="engine"> The script engine associated with this object. </param>
/// <param name="prototype"> The next object in the prototype chain. Can be <c>null</c>. </param>
protected ObjectInstance(ScriptEngine engine, ObjectInstance prototype)
{
if (engine == null)
throw new ArgumentNullException("engine");
this.engine = engine;
this.prototype = prototype;
this.schema = engine.EmptySchema;
}
开发者ID:dusk0r,项目名称:Jurassic,代码行数:13,代码来源:ObjectInstance.cs
示例19: StringConstructor
// INITIALIZATION
//_________________________________________________________________________________________
/// <summary>
/// Creates a new String object.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
internal StringConstructor(ObjectInstance prototype)
: base(prototype, __STUB__Construct, __STUB__Call)
{
// Initialize the constructor properties.
var properties = GetDeclarativeProperties(Engine);
InitializeConstructorProperties(properties, "String", 1, StringInstance.CreatePrototype(Engine, this));
FastSetProperties(properties);
}
开发者ID:paulbartrum,项目名称:jurassic,代码行数:14,代码来源:StringConstructor.cs
示例20: MapIterator
// INITIALIZATION
//_________________________________________________________________________________________
/// <summary>
/// Creates a new map iterator.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
/// <param name="map"> The map to iterate over. </param>
/// <param name="list"> The linked list to iterate over. </param>
/// <param name="kind"> The type of values to return. </param>
internal MapIterator(ObjectInstance prototype, MapInstance map, LinkedList<KeyValuePair<object, object>> list, Kind kind)
: base(prototype)
{
this.map = map;
this.map.BeforeDelete += Map_BeforeDelete;
this.list = list;
this.kind = kind;
}
开发者ID:paulbartrum,项目名称:jurassic,代码行数:17,代码来源:MapIterator.cs
注:本文中的Jurassic.Library.ObjectInstance类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论