本文整理汇总了Python中v8_utilities.scoped_name函数的典型用法代码示例。如果您正苦于以下问题:Python scoped_name函数的具体用法?Python scoped_name怎么用?Python scoped_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scoped_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setter_expression
def setter_expression(interface, attribute, contents):
extended_attributes = attribute.extended_attributes
arguments = v8_utilities.call_with_arguments(attribute, extended_attributes.get('SetterCallWith'))
this_setter_base_name = setter_base_name(attribute, arguments)
setter_name = v8_utilities.scoped_name(interface, attribute, this_setter_base_name)
if ('ImplementedBy' in extended_attributes and
not attribute.is_static):
arguments.append('imp')
idl_type = attribute.idl_type
if idl_type == 'EventHandler':
getter_name = v8_utilities.scoped_name(interface, attribute, cpp_name(attribute))
contents['event_handler_getter_expression'] = '%s(%s)' % (
getter_name, ', '.join(arguments))
if (interface.name in ['Window', 'WorkerGlobalScope'] and
attribute.name == 'onerror'):
includes.add('bindings/v8/V8ErrorHandler.h')
arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHandler>(jsValue, true, info.GetIsolate())')
else:
arguments.append('V8EventListenerList::getEventListener(jsValue, true, ListenerFindOrCreate)')
elif v8_types.is_interface_type(idl_type) and not v8_types.array_type(idl_type):
# FIXME: should be able to eliminate WTF::getPtr in most or all cases
arguments.append('WTF::getPtr(cppValue)')
else:
arguments.append('cppValue')
if contents['is_setter_raises_exception']:
arguments.append('exceptionState')
return '%s(%s)' % (setter_name, ', '.join(arguments))
示例2: setter_expression
def setter_expression(interface, attribute, contents):
extended_attributes = attribute.extended_attributes
arguments = v8_utilities.call_with_arguments(attribute, extended_attributes.get('SetterCallWith'))
this_setter_base_name = setter_base_name(interface, attribute, arguments)
setter_name = scoped_name(interface, attribute, this_setter_base_name)
# Members of IDL partial interface definitions are implemented in C++ as
# static member functions, which for instance members (non-static members)
# take *impl as their first argument
if ('PartialInterfaceImplementedAs' in extended_attributes and
not attribute.is_static):
arguments.append('*impl')
idl_type = attribute.idl_type
if idl_type.base_type == 'EventHandler':
getter_name = scoped_name(interface, attribute, cpp_name(attribute))
contents['event_handler_getter_expression'] = '%s(%s)' % (
getter_name, ', '.join(arguments))
if (interface.name in ['Window', 'WorkerGlobalScope'] and
attribute.name == 'onerror'):
includes.add('bindings/v8/V8ErrorHandler.h')
arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHandler>(v8Value, true, info.GetIsolate())')
else:
arguments.append('V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate)')
elif idl_type.is_interface_type and not idl_type.array_type:
# FIXME: should be able to eliminate WTF::getPtr in most or all cases
arguments.append('WTF::getPtr(cppValue)')
else:
arguments.append('cppValue')
if contents['is_setter_raises_exception']:
arguments.append('exceptionState')
return '%s(%s)' % (setter_name, ', '.join(arguments))
示例3: cpp_value
def cpp_value(interface, method, number_of_arguments):
def cpp_argument(argument):
idl_type = argument.idl_type
if (v8_types.is_callback_interface(idl_type) or
idl_type in ['NodeFilter', 'XPathNSResolver']):
# FIXME: remove this special case
return '%s.release()' % argument.name
return argument.name
# Truncate omitted optional arguments
arguments = method.arguments[:number_of_arguments]
cpp_arguments = v8_utilities.call_with_arguments(method)
if ('ImplementedBy' in method.extended_attributes and
not method.is_static):
cpp_arguments.append('imp')
cpp_arguments.extend(cpp_argument(argument) for argument in arguments)
this_union_arguments = union_arguments(method.idl_type)
if this_union_arguments:
cpp_arguments.extend(this_union_arguments)
if 'RaisesException' in method.extended_attributes:
cpp_arguments.append('exceptionState')
cpp_method_name = v8_utilities.scoped_name(interface, method, v8_utilities.cpp_name(method))
return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments))
示例4: getter_expression
def getter_expression(interface, attribute, context):
arguments = []
this_getter_base_name = getter_base_name(interface, attribute, arguments)
getter_name = scoped_name(interface, attribute, this_getter_base_name)
if "ImplementedInPrivateScript" in attribute.extended_attributes:
arguments.append("toLocalFrame(toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext()))")
arguments.append("impl")
arguments.append("&result")
arguments.extend(v8_utilities.call_with_arguments(attribute.extended_attributes.get("CallWith")))
# Members of IDL partial interface definitions are implemented in C++ as
# static member functions, which for instance members (non-static members)
# take *impl as their first argument
if (
"PartialInterfaceImplementedAs" in attribute.extended_attributes
and not "ImplementedInPrivateScript" in attribute.extended_attributes
and not attribute.is_static
):
arguments.append("*impl")
if attribute.idl_type.is_explicit_nullable:
arguments.append("isNull")
if context["is_getter_raises_exception"]:
arguments.append("exceptionState")
if attribute.idl_type.use_output_parameter_for_result:
arguments.append("result")
return "%s(%s)" % (getter_name, ", ".join(arguments))
示例5: cpp_value
def cpp_value(interface, method, number_of_arguments):
def cpp_argument(argument):
idl_type = argument.idl_type
if idl_type.name == "EventListener":
return argument.name
if idl_type.is_dictionary:
return "*%s" % argument.name
if idl_type.name in ["NodeFilter", "NodeFilterOrNull", "XPathNSResolver", "XPathNSResolverOrNull"]:
# FIXME: remove this special case
return "%s.release()" % argument.name
return argument.name
# Truncate omitted optional arguments
arguments = method.arguments[:number_of_arguments]
cpp_arguments = []
if "ImplementedInPrivateScript" in method.extended_attributes:
cpp_arguments.append("toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext())")
cpp_arguments.append("impl")
if method.is_constructor:
call_with_values = interface.extended_attributes.get("ConstructorCallWith")
else:
call_with_values = method.extended_attributes.get("CallWith")
cpp_arguments.extend(v8_utilities.call_with_arguments(call_with_values))
# Members of IDL partial interface definitions are implemented in C++ as
# static member functions, which for instance members (non-static members)
# take *impl as their first argument
if (
"PartialInterfaceImplementedAs" in method.extended_attributes
and not "ImplementedInPrivateScript" in method.extended_attributes
and not method.is_static
):
cpp_arguments.append("*impl")
cpp_arguments.extend(cpp_argument(argument) for argument in arguments)
this_union_arguments = method.idl_type and method.idl_type.union_arguments
if this_union_arguments:
cpp_arguments.extend([member_argument["cpp_value"] for member_argument in this_union_arguments])
if "ImplementedInPrivateScript" in method.extended_attributes:
if method.idl_type.name != "void":
cpp_arguments.append("&result")
elif "RaisesException" in method.extended_attributes or (
method.is_constructor and has_extended_attribute_value(interface, "RaisesException", "Constructor")
):
cpp_arguments.append("exceptionState")
if method.name == "Constructor":
base_name = "create"
elif method.name == "NamedConstructor":
base_name = "createForJSConstructor"
elif "ImplementedInPrivateScript" in method.extended_attributes:
base_name = "%sMethod" % method.name
else:
base_name = v8_utilities.cpp_name(method)
cpp_method_name = v8_utilities.scoped_name(interface, method, base_name)
return "%s(%s)" % (cpp_method_name, ", ".join(cpp_arguments))
示例6: cpp_value
def cpp_value(interface, method, number_of_arguments):
def cpp_argument(argument):
idl_type = argument.idl_type
if idl_type.name == 'EventListener':
return argument.name
if (idl_type.name in ['NodeFilter', 'NodeFilterOrNull',
'XPathNSResolver', 'XPathNSResolverOrNull']):
# FIXME: remove this special case
return '%s.release()' % argument.name
return argument.name
# Truncate omitted optional arguments
arguments = method.arguments[:number_of_arguments]
cpp_arguments = []
if 'ImplementedInPrivateScript' in method.extended_attributes:
cpp_arguments.append('toLocalFrame(toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext()))')
cpp_arguments.append('impl')
if method.is_constructor:
call_with_values = interface.extended_attributes.get('ConstructorCallWith')
else:
call_with_values = method.extended_attributes.get('CallWith')
cpp_arguments.extend(v8_utilities.call_with_arguments(call_with_values))
# Members of IDL partial interface definitions are implemented in C++ as
# static member functions, which for instance members (non-static members)
# take *impl as their first argument
if ('PartialInterfaceImplementedAs' in method.extended_attributes and
not 'ImplementedInPrivateScript' in method.extended_attributes and
not method.is_static):
cpp_arguments.append('*impl')
cpp_arguments.extend(cpp_argument(argument) for argument in arguments)
if 'ImplementedInPrivateScript' in method.extended_attributes:
if method.idl_type.name != 'void':
cpp_arguments.append('&result')
elif ('RaisesException' in method.extended_attributes or
(method.is_constructor and
has_extended_attribute_value(interface, 'RaisesException', 'Constructor'))):
cpp_arguments.append('exceptionState')
# If a method returns an IDL dictionary or union type, the return value is
# passed as an argument to impl classes.
idl_type = method.idl_type
if idl_type and idl_type.use_output_parameter_for_result:
cpp_arguments.append('result')
if method.name == 'Constructor':
base_name = 'create'
elif method.name == 'NamedConstructor':
base_name = 'createForJSConstructor'
elif 'ImplementedInPrivateScript' in method.extended_attributes:
base_name = '%sMethod' % method.name
else:
base_name = v8_utilities.cpp_name(method)
cpp_method_name = v8_utilities.scoped_name(interface, method, base_name)
return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments))
示例7: setter_expression
def setter_expression(interface, attribute, context):
extended_attributes = attribute.extended_attributes
arguments = v8_utilities.call_with_arguments(
extended_attributes.get("SetterCallWith") or extended_attributes.get("CallWith")
)
this_setter_base_name = setter_base_name(interface, attribute, arguments)
setter_name = scoped_name(interface, attribute, this_setter_base_name)
# Members of IDL partial interface definitions are implemented in C++ as
# static member functions, which for instance members (non-static members)
# take *impl as their first argument
if (
"PartialInterfaceImplementedAs" in extended_attributes
and not "ImplementedInPrivateScript" in extended_attributes
and not attribute.is_static
):
arguments.append("*impl")
idl_type = attribute.idl_type
if "ImplementedInPrivateScript" in extended_attributes:
arguments.append("toLocalFrame(toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext()))")
arguments.append("impl")
arguments.append("cppValue")
elif idl_type.base_type == "EventHandler":
getter_name = scoped_name(interface, attribute, cpp_name(attribute))
context["event_handler_getter_expression"] = "%s(%s)" % (getter_name, ", ".join(arguments))
if interface.name in ["Window", "WorkerGlobalScope"] and attribute.name == "onerror":
includes.add("bindings/core/v8/V8ErrorHandler.h")
arguments.append(
"V8EventListenerList::findOrCreateWrapper<V8ErrorHandler>(v8Value, true, ScriptState::current(info.GetIsolate()))"
)
else:
arguments.append(
"V8EventListenerList::getEventListener(ScriptState::current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate)"
)
elif idl_type.is_interface_type:
# FIXME: should be able to eliminate WTF::getPtr in most or all cases
arguments.append("WTF::getPtr(cppValue)")
else:
arguments.append("cppValue")
if context["is_setter_raises_exception"]:
arguments.append("exceptionState")
return "%s(%s)" % (setter_name, ", ".join(arguments))
示例8: setter_expression
def setter_expression(interface, attribute, context):
extended_attributes = attribute.extended_attributes
arguments = v8_utilities.call_with_arguments(
extended_attributes.get('SetterCallWith') or
extended_attributes.get('CallWith'))
this_setter_base_name = setter_base_name(interface, attribute, arguments)
setter_name = scoped_name(interface, attribute, this_setter_base_name)
# Members of IDL partial interface definitions are implemented in C++ as
# static member functions, which for instance members (non-static members)
# take *impl as their first argument
if ('PartialInterfaceImplementedAs' in extended_attributes and
not attribute.is_static):
arguments.append('*impl')
idl_type = attribute.idl_type
if idl_type.base_type == 'EventHandler':
getter_name = scoped_name(interface, attribute, cpp_name(attribute))
context['event_handler_getter_expression'] = '%s(%s)' % (
getter_name, ', '.join(arguments))
if (interface.name in ['Window', 'WorkerGlobalScope'] and
attribute.name == 'onerror'):
includes.add('bindings/core/v8/V8ErrorHandler.h')
arguments.append(
'V8EventListenerHelper::EnsureErrorHandler(' +
'ScriptState::ForRelevantRealm(info), v8Value)')
else:
arguments.append(
'V8EventListenerHelper::GetEventListener(' +
'ScriptState::ForRelevantRealm(info), v8Value, true, ' +
'kListenerFindOrCreate)')
else:
arguments.append('cppValue')
if idl_type.is_explicit_nullable:
arguments.append('isNull')
if context['is_setter_raises_exception']:
arguments.append('exceptionState')
return '%s(%s)' % (setter_name, ', '.join(arguments))
示例9: cpp_value
def cpp_value(interface, method, number_of_arguments):
# Truncate omitted optional arguments
arguments = method.arguments[:number_of_arguments]
cpp_arguments = []
if "ImplementedInPrivateScript" in method.extended_attributes:
cpp_arguments.append("toLocalFrame(toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext()))")
cpp_arguments.append("impl")
if method.is_constructor:
call_with_values = interface.extended_attributes.get("ConstructorCallWith")
else:
call_with_values = method.extended_attributes.get("CallWith")
cpp_arguments.extend(v8_utilities.call_with_arguments(call_with_values))
# Members of IDL partial interface definitions are implemented in C++ as
# static member functions, which for instance members (non-static members)
# take *impl as their first argument
if (
"PartialInterfaceImplementedAs" in method.extended_attributes
and "ImplementedInPrivateScript" not in method.extended_attributes
and not method.is_static
):
cpp_arguments.append("*impl")
cpp_arguments.extend(argument.name for argument in arguments)
if "ImplementedInPrivateScript" in method.extended_attributes:
if method.idl_type.name != "void":
cpp_arguments.append("&result")
elif "RaisesException" in method.extended_attributes or (
method.is_constructor and has_extended_attribute_value(interface, "RaisesException", "Constructor")
):
cpp_arguments.append("exceptionState")
# If a method returns an IDL dictionary or union type, the return value is
# passed as an argument to impl classes.
idl_type = method.idl_type
if idl_type and idl_type.use_output_parameter_for_result:
cpp_arguments.append("result")
if method.name == "Constructor":
base_name = "create"
elif method.name == "NamedConstructor":
base_name = "createForJSConstructor"
elif "ImplementedInPrivateScript" in method.extended_attributes:
base_name = "%sMethod" % method.name
else:
base_name = v8_utilities.cpp_name(method)
cpp_method_name = v8_utilities.scoped_name(interface, method, base_name)
return "%s(%s)" % (cpp_method_name, ", ".join(cpp_arguments))
示例10: getter_expression
def getter_expression(interface, attribute, contents):
arguments = []
this_getter_base_name = getter_base_name(attribute, arguments)
getter_name = v8_utilities.scoped_name(interface, attribute, this_getter_base_name)
arguments.extend(v8_utilities.call_with_arguments(attribute))
if ('ImplementedBy' in attribute.extended_attributes and
not attribute.is_static):
arguments.append('imp')
if attribute.is_nullable:
arguments.append('isNull')
if contents['is_getter_raises_exception']:
arguments.append('exceptionState')
return '%s(%s)' % (getter_name, ', '.join(arguments))
示例11: cpp_value
def cpp_value(interface, method, number_of_arguments):
def cpp_argument(argument):
idl_type = argument.idl_type
if idl_type.name == 'EventListener':
if (interface.name == 'EventTarget' and
method.name == 'removeEventListener'):
# FIXME: remove this special case by moving get() into
# EventTarget::removeEventListener
return '%s.get()' % argument.name
return argument.name
if (idl_type.is_callback_interface or
idl_type.name in ['NodeFilter', 'XPathNSResolver']):
# FIXME: remove this special case
return '%s.release()' % argument.name
return argument.name
# Truncate omitted optional arguments
arguments = method.arguments[:number_of_arguments]
cpp_arguments = []
if method.is_constructor:
call_with_values = interface.extended_attributes.get('ConstructorCallWith')
else:
call_with_values = method.extended_attributes.get('CallWith')
cpp_arguments.extend(v8_utilities.call_with_arguments(call_with_values))
# Members of IDL partial interface definitions are implemented in C++ as
# static member functions, which for instance members (non-static members)
# take *impl as their first argument
if ('PartialInterfaceImplementedAs' in method.extended_attributes and
not method.is_static):
cpp_arguments.append('*impl')
cpp_arguments.extend(cpp_argument(argument) for argument in arguments)
this_union_arguments = method.idl_type and method.idl_type.union_arguments
if this_union_arguments:
cpp_arguments.extend(this_union_arguments)
if ('RaisesException' in method.extended_attributes or
(method.is_constructor and
has_extended_attribute_value(interface, 'RaisesException', 'Constructor'))):
cpp_arguments.append('exceptionState')
if method.name == 'Constructor':
base_name = 'create'
elif method.name == 'NamedConstructor':
base_name = 'createForJSConstructor'
else:
base_name = v8_utilities.cpp_name(method)
cpp_method_name = v8_utilities.scoped_name(interface, method, base_name)
return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments))
示例12: getter_expression
def getter_expression(interface, attribute, context):
arguments = []
this_getter_base_name = getter_base_name(interface, attribute, arguments)
getter_name = scoped_name(interface, attribute, this_getter_base_name)
arguments.extend(v8_utilities.call_with_arguments(attribute.extended_attributes.get("CallWith")))
# Members of IDL partial interface definitions are implemented in C++ as
# static member functions, which for instance members (non-static members)
# take *impl as their first argument
if "PartialInterfaceImplementedAs" in attribute.extended_attributes and not attribute.is_static:
arguments.append("*impl")
if attribute.idl_type.is_explicit_nullable:
arguments.append("isNull")
if context["is_getter_raises_exception"]:
arguments.append("exceptionState")
return "%s(%s)" % (getter_name, ", ".join(arguments))
示例13: cpp_value
def cpp_value(interface, method, number_of_arguments):
def cpp_argument(argument):
if argument.idl_type in ['NodeFilter', 'XPathNSResolver']:
# FIXME: remove this special case
return '%s.release()' % argument.name
return argument.name
# Truncate omitted optional arguments
arguments = method.arguments[:number_of_arguments]
cpp_arguments = v8_utilities.call_with_arguments(method)
cpp_arguments.extend(cpp_argument(argument) for argument in arguments)
if 'RaisesException' in method.extended_attributes:
cpp_arguments.append('exceptionState')
cpp_method_name = v8_utilities.scoped_name(interface, method, v8_utilities.cpp_name(method))
return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments))
示例14: getter_expression
def getter_expression(interface, attribute, contents):
arguments = []
this_getter_base_name = getter_base_name(interface, attribute, arguments)
getter_name = scoped_name(interface, attribute, this_getter_base_name)
arguments.extend(v8_utilities.call_with_arguments(attribute))
# Members of IDL partial interface definitions are implemented in C++ as
# static member functions, which for instance members (non-static members)
# take *impl as their first argument
if ('PartialInterfaceImplementedAs' in attribute.extended_attributes and
not attribute.is_static):
arguments.append('*impl')
if attribute.idl_type.is_nullable and not contents['has_strict_type_checking']:
arguments.append('isNull')
if contents['is_getter_raises_exception']:
arguments.append('exceptionState')
return '%s(%s)' % (getter_name, ', '.join(arguments))
示例15: cpp_value
def cpp_value(interface, method, number_of_arguments):
def cpp_argument(argument):
idl_type = argument.idl_type
if idl_type.is_callback_interface or idl_type.name in ["NodeFilter", "NodeFilterOrNull"]:
# FIXME: remove this special case
return "%s.release()" % argument.name
return argument.name
# Truncate omitted optional arguments
arguments = method.arguments[:number_of_arguments]
cpp_arguments = []
if method.is_constructor:
call_with_values = interface.extended_attributes.get("ConstructorCallWith")
else:
call_with_values = method.extended_attributes.get("CallWith")
cpp_arguments.extend(v8_utilities.call_with_arguments(call_with_values))
# Members of IDL partial interface definitions are implemented in C++ as
# static member functions, which for instance members (non-static members)
# take *impl as their first argument
if "PartialInterfaceImplementedAs" in method.extended_attributes and not method.is_static:
cpp_arguments.append("*impl")
cpp_arguments.extend(cpp_argument(argument) for argument in arguments)
this_union_arguments = method.idl_type and method.idl_type.union_arguments
if this_union_arguments:
cpp_arguments.extend([member_argument["cpp_value"] for member_argument in this_union_arguments])
if "RaisesException" in method.extended_attributes or (
method.is_constructor and has_extended_attribute_value(interface, "RaisesException", "Constructor")
):
cpp_arguments.append("exceptionState")
if method.name == "Constructor":
base_name = "create"
elif method.name == "NamedConstructor":
base_name = "createForJSConstructor"
else:
base_name = v8_utilities.cpp_name(method)
cpp_method_name = v8_utilities.scoped_name(interface, method, base_name)
return "%s(%s)" % (cpp_method_name, ", ".join(cpp_arguments))