本文整理汇总了C++中MethodList::length方法的典型用法代码示例。如果您正苦于以下问题:C++ MethodList::length方法的具体用法?C++ MethodList::length怎么用?C++ MethodList::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MethodList
的用法示例。
在下文中一共展示了MethodList::length方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get
Value RuntimeObjectImp::get(ExecState *exec, const Identifier &propertyName) const
{
Value result = Undefined();
instance->begin();
Class *aClass = instance->getClass();
if (aClass) {
// See if the instance have a field with the specified name.
Field *aField = aClass->fieldNamed(propertyName.ascii(), instance);
if (aField) {
result = instance->getValueOfField (exec, aField);
}
else {
// Now check if a method with specified name exists, if so return a function object for
// that method.
MethodList methodList = aClass->methodsNamed(propertyName.ascii(), instance);
if (methodList.length() > 0) {
result = Object (new RuntimeMethodImp(exec, propertyName, methodList));
}
}
if (result.type() == UndefinedType) {
// Try a fallback object.
result = aClass->fallbackObject (exec, instance, propertyName);
}
}
instance->end();
return result;
}
示例2: hasProperty
bool RuntimeObjectImp::hasProperty(ExecState *exec,
const Identifier &propertyName) const
{
bool result = false;
instance->begin();
Field *aField = instance->getClass()->fieldNamed(propertyName.ascii(), instance);
if (aField) {
instance->end();
return true;
}
MethodList methodList = instance->getClass()->methodsNamed(propertyName.ascii(), instance);
instance->end();
if (methodList.length() > 0)
return true;
return result;
}