Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected 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

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

Protected Member Functions

 _all_subnodes (self)
 
- Protected Member Functions inherited from scripts.idlnode.IDLNode
 _extra_repr (self)
 
 _to_hashable (self, obj)
 
 _find_all (self, ast, label, max_results=sys.maxsize)
 
 _find_first (self, ast, label)
 
 _has (self, ast, label)
 
 _convert_label_to_field (self, label)
 
 _convert_all (self, ast, label, idlnode_ctor)
 
 _convert_first (self, ast, label, idlnode_ctor)
 
 _convert_ext_attrs (self, ast)
 
 _convert_annotations (self, ast)
 
 _convert_constants (self, ast, js_name)
 

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__()

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

Member Function Documentation

◆ _all_subnodes()

scripts.idlnode.IDLExtAttrs._all_subnodes (   self)
protected
Accessor used by all() to find subnodes.

Reimplemented from scripts.idlnode.IDLDictNode.

Definition at line 632 of file idlnode.py.

632 def _all_subnodes(self):
633 # Extended attributes may contain IDLNodes, e.g. IDLExtAttrFunctionValue
634 return self.values()
635
636
637# IDLExtAttrFunctionValue is used for constructors defined in the IDL.

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