Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
scripts.idlnode.IDLExtAttrs Class Reference
Inheritance diagram for scripts.idlnode.IDLExtAttrs:
scripts.idlnode.IDLDictNode scripts.idlnode.IDLNode

Public Member Functions

def __init__ (self, ast=None)
 
- Public Member Functions inherited from scripts.idlnode.IDLDictNode
def __init__ (self, ast)
 
def __len__ (self)
 
def __getitem__ (self, key)
 
def __setitem__ (self, key, value)
 
def __delitem__ (self, key)
 
def __contains__ (self, key)
 
def __iter__ (self)
 
def get (self, key, default=None)
 
def setdefault (self, key, value=None)
 
def items (self)
 
def keys (self)
 
def values (self)
 
def clear (self)
 
def to_dict (self)
 
- Public Member Functions inherited from scripts.idlnode.IDLNode
def __init__ (self, ast, id=None)
 
def __repr__ (self)
 
def __eq__ (self, other)
 
def __hash__ (self)
 
def reset_id (self, newId)
 
def all (self, type_filter=None)
 
def to_dict (self)
 
def to_hash (self)
 

Additional Inherited Members

- Public Attributes inherited from scripts.idlnode.IDLNode
 id
 
 ext_attrs
 
 annotations
 
 members
 

Detailed Description

IDLExtAttrs is an IDLDictNode that stores IDL Extended Attributes.
Modules, interfaces, members and arguments can all own IDLExtAttrs.

Definition at line 566 of file idlnode.py.

Constructor & Destructor Documentation

◆ __init__()

def scripts.idlnode.IDLExtAttrs.__init__ (   self,
  ast = None 
)
Initializes an IDLNode from a PegParser AST output.

Reimplemented from scripts.idlnode.IDLDictNode.

Definition at line 570 of file idlnode.py.

570 def __init__(self, ast=None):
571 IDLDictNode.__init__(self, None)
572 if not ast:
573 return
574 if not (isinstance(ast, list)) and ast.__module__ == "idl_definitions":
575 # Pull out extended attributes from Blink AST.
576 for name, value in ast.extended_attributes.items():
577 # TODO(terry): Handle constructors...
578 if name == 'NamedConstructor' or name == 'Constructor':
579 for constructor in ast.constructors:
580 if constructor.name == 'NamedConstructor':
581 constructor_name = ast.extended_attributes[
582 'NamedConstructor']
583 else:
584 constructor_name = None
585 func_value = IDLExtAttrFunctionValue(
586 constructor_name, constructor.arguments, True)
587 if name == 'Constructor':
588 self.setdefault('Constructor',
589 []).append(func_value)
590 else:
591 self[name] = func_value
592 elif name == 'SetWrapperReferenceTo':
593 # NOTE: No need to process handling for GC wrapper. But if its a reference
594 # to another type via an IdlArgument we'd need to convert to IDLArgument
595 # otherwise the type might be a reference to another type and the circularity
596 # will break deep_copy which is done later to the interfaces in the
597 # database. If we every need SetWrapperReferenceTo then we'd need to
598 # convert IdlArgument to IDLArgument.
599 continue
600 else:
601 self[name] = value
602 else:
603 ext_attrs_ast = self._find_first(ast, 'ExtAttrs')
604 if not ext_attrs_ast:
605 return
606 for ext_attr in self._find_all(ext_attrs_ast, 'ExtAttr'):
607 name = self._find_first(ext_attr, 'Id')
608 value = self._find_first(ext_attr, 'ExtAttrValue')
609
610 if name == 'Constructor':
611 # There might be multiple constructor attributes, collect them
612 # as a list. Represent plain Constructor attribute
613 # (without any signature) as None.
614 assert value is None
615 func_value = None
616 ctor_args = self._find_first(ext_attr, 'ExtAttrArgList')
617 if ctor_args:
618 func_value = IDLExtAttrFunctionValue(None, ctor_args)
619 self.setdefault('Constructor', []).append(func_value)
620 continue
621
622 func_value = self._find_first(value, 'ExtAttrFunctionValue')
623 if func_value:
624 # E.g. NamedConstructor=Audio(optional DOMString src)
625 self[name] = IDLExtAttrFunctionValue(
626 func_value,
627 self._find_first(func_value, 'ExtAttrArgList'))
628 continue
629
630 self[name] = value
631
static void append(char **dst, size_t *count, const char *src, size_t n)
Definition: editor.cpp:211

The documentation for this class was generated from the following file: