Beispiel #1
0

# [Custom], [Custom=Getter]
def has_custom_getter(attribute):
    extended_attributes = attribute.extended_attributes
    return ('Custom' in extended_attributes
            and extended_attributes['Custom'] in [None, 'Getter'])


# [Custom], [Custom=Setter]
def has_custom_setter(attribute):
    extended_attributes = attribute.extended_attributes
    return (not attribute.is_read_only and 'Custom' in extended_attributes
            and extended_attributes['Custom'] in [None, 'Setter'])


################################################################################
# Constructors
################################################################################

idl_types.IdlType.constructor_type_name = property(
    lambda self: strip_suffix(self.base_type, 'Constructor'))


def is_constructor_attribute(attribute):
    return attribute.idl_type.name.endswith('Constructor')


def is_named_constructor_attribute(attribute):
    return attribute.idl_type.name.endswith('ConstructorConstructor')
Beispiel #2
0
    return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name, attribute.name)


# [Custom], [Custom=Getter]
def has_custom_getter(attribute):
    extended_attributes = attribute.extended_attributes
    return ('Custom' in extended_attributes and
            extended_attributes['Custom'] in [None, 'Getter'])


# [Custom], [Custom=Setter]
def has_custom_setter(attribute):
    extended_attributes = attribute.extended_attributes
    return (not attribute.is_read_only and
            'Custom' in extended_attributes and
            extended_attributes['Custom'] in [None, 'Setter'])


################################################################################
# Constructors
################################################################################

idl_types.IdlType.constructor_type_name = property(
    # FIXME: replace this with a [ConstructorAttribute] extended attribute
    lambda self: strip_suffix(self.base_type, 'Constructor'))


def is_constructor_attribute(attribute):
    # FIXME: replace this with [ConstructorAttribute] extended attribute
    return attribute.idl_type.name.endswith('Constructor')
Beispiel #3
0
def constructor_type(idl_type):
    return strip_suffix(idl_type, 'Constructor')
def has_custom_setter(attribute):
    extended_attributes = attribute.extended_attributes
    return (
        not attribute.is_read_only
        and "Custom" in extended_attributes
        and extended_attributes["Custom"] in [None, "Setter"]
    )


################################################################################
# Constructors
################################################################################

idl_types.IdlType.constructor_type_name = property(
    # FIXME: replace this with a [ConstructorAttribute] extended attribute
    lambda self: strip_suffix(self.base_type, "Constructor")
)


def is_constructor_attribute(attribute):
    # FIXME: replace this with [ConstructorAttribute] extended attribute
    return attribute.idl_type.name.endswith("Constructor")


def update_constructor_attribute_context(interface, attribute, context):
    context["needs_constructor_getter_callback"] = (
        context["measure_as"] or context["deprecate_as"] or context["api_experiment_name"]
    )
    # When the attribute name is the same as the interface name, do not generate
    # callback functions for each attribute and use
    # {{cpp_class}}ConstructorAttributeSetterCallback.  Otherwise, generate
Beispiel #5
0
def constructor_type(idl_type):
    return strip_suffix(idl_type, 'Constructor')