本文整理汇总了C#中IScriptable.Has方法的典型用法代码示例。如果您正苦于以下问题:C# IScriptable.Has方法的具体用法?C# IScriptable.Has怎么用?C# IScriptable.Has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScriptable
的用法示例。
在下文中一共展示了IScriptable.Has方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBase
private static IScriptable GetBase (IScriptable obj, string name)
{
do {
if (obj.Has (name, obj))
break;
obj = obj.GetPrototype ();
}
while (obj != null);
return obj;
}
示例2: ExecIdCall
public override object ExecIdCall(IdFunctionObject f, Context cx, IScriptable scope, IScriptable thisObj, object [] args)
{
if (!f.HasTag (OBJECT_TAG)) {
return base.ExecIdCall (f, cx, scope, thisObj, args);
}
int id = f.MethodId;
switch (id) {
case Id_constructor: {
if (thisObj != null) {
// BaseFunction.construct will set up parent, proto
return f.Construct (cx, scope, args);
}
if (args.Length == 0 || args [0] == null || args [0] == Undefined.Value) {
return new BuiltinObject ();
}
return ScriptConvert.ToObject (cx, scope, args [0]);
}
case Id_toLocaleString:
// For now just alias toString
case Id_toString: {
if (cx.HasFeature (Context.Features.ToStringAsSource)) {
string s = ScriptRuntime.defaultObjectToSource (cx, scope, thisObj, args);
int L = s.Length;
if (L != 0 && s [0] == '(' && s [L - 1] == ')') {
// Strip () that surrounds toSource
s = s.Substring (1, (L - 1) - (1));
}
return s;
}
return ScriptRuntime.DefaultObjectToString (thisObj);
}
case Id_valueOf:
return thisObj;
case Id_hasOwnProperty: {
bool result;
if (args.Length == 0) {
result = false;
}
else {
string s = ScriptRuntime.ToStringIdOrIndex (cx, args [0]);
if (s == null) {
int index = ScriptRuntime.lastIndexResult (cx);
result = thisObj.Has (index, thisObj);
}
else {
result = thisObj.Has (s, thisObj);
}
}
return result;
}
case Id_propertyIsEnumerable: {
bool result;
if (args.Length == 0) {
result = false;
}
else {
string s = ScriptRuntime.ToStringIdOrIndex (cx, args [0]);
if (s == null) {
int index = ScriptRuntime.lastIndexResult (cx);
result = thisObj.Has (index, thisObj);
if (result && thisObj is ScriptableObject) {
ScriptableObject so = (ScriptableObject)thisObj;
int attrs = so.GetAttributes (index);
result = ((attrs & ScriptableObject.DONTENUM) == 0);
}
}
else {
result = thisObj.Has (s, thisObj);
if (result && thisObj is ScriptableObject) {
ScriptableObject so = (ScriptableObject)thisObj;
int attrs = so.GetAttributes (s);
result = ((attrs & ScriptableObject.DONTENUM) == 0);
}
}
}
return result;
}
case Id_isPrototypeOf: {
bool result = false;
if (args.Length != 0 && args [0] is IScriptable) {
IScriptable v = (IScriptable)args [0];
do {
v = v.GetPrototype ();
if (v == thisObj) {
result = true;
break;
}
}
while (v != null);
}
return result;
}
case Id_toSource:
//.........这里部分代码省略.........