Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
scripts.idlnode.IDLOperation Class Reference
Inheritance diagram for scripts.idlnode.IDLOperation:
scripts.idlnode.IDLMember scripts.idlnode.IDLNode

Public Member Functions

 __init__ (self, ast, doc_js_interface_name, id=None)
 
 __repr__ (self)
 
 SameSignatureAs (self, operation)
 
- Public Member Functions inherited from scripts.idlnode.IDLNode
 __eq__ (self, other)
 
 __hash__ (self)
 
 reset_id (self, newId)
 
 all (self, type_filter=None)
 
 to_dict (self)
 
 to_hash (self)
 

Public Attributes

 ext_attrs
 
 annotations
 
 is_fc_suppressed
 
 specials
 
 is_static
 
 arguments
 
 type
 
 id
 
- Public Attributes inherited from scripts.idlnode.IDLMember
 type
 
 doc_js_interface_name
 
 is_fc_suppressed
 
 is_static
 
- Public Attributes inherited from scripts.idlnode.IDLNode
 id
 
 ext_attrs
 
 annotations
 
 members
 

Protected Member Functions

 _extra_repr (self)
 
- Protected Member Functions inherited from scripts.idlnode.IDLNode
 _all_subnodes (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)
 

Detailed Description

IDLNode specialization for 'type name(args)' declarations.

Definition at line 1028 of file idlnode.py.

Constructor & Destructor Documentation

◆ __init__()

scripts.idlnode.IDLOperation.__init__ (   self,
  ast,
  id,
  member_id = None 
)
Initializes an IDLNode from a PegParser AST output.

Reimplemented from scripts.idlnode.IDLMember.

Definition at line 1031 of file idlnode.py.

1031 def __init__(self, ast, doc_js_interface_name, id=None):
1032 IDLMember.__init__(self, ast, doc_js_interface_name, id)
1033
1034 if not ast:
1035 # Synthesize an IDLOperation with no ast used for setlike.
1036 self.ext_attrs = IDLExtAttrs()
1037 self.annotations = IDLAnnotations()
1038 self.is_fc_suppressed = False
1039 self.specials = []
1040 self.is_static = False
1041 self.arguments = []
1042 return
1043
1044 self.type = self._convert_first(ast, 'ReturnType', IDLType)
1045 self.type = resolveTypedef(self.type)
1046
1047 self.arguments = self._convert_all(ast, 'Argument', IDLArgument)
1048 self.specials = self._find_all(ast, 'Special')
1049 # Special case: there are getters of the form
1050 # getter <ReturnType>(args). For now force the name to be __getter__,
1051 # but it should be operator[] later.
1052 if self.id is None:
1053 if self.specials == ['getter']:
1054 if self.ext_attrs.get('Custom') == 'PropertyQuery':
1055 # Handling __propertyQuery__ the extended attribute is:
1056 # [Custom=PropertyQuery] getter boolean (DOMString name);
1057 self.id = '__propertyQuery__'
1058 elif self.ext_attrs.get('ImplementedAs'):
1059 self.id = self.ext_attrs.get('ImplementedAs')
1060 else:
1061 self.id = '__getter__'
1062 elif self.specials == ['setter']:
1063 self.id = '__setter__'
1064 # Special case: if it's a setter, ignore 'declared' return type
1065 self.type = IDLType([('VoidType', None)])
1066 elif self.specials == ['deleter']:
1067 self.id = '__delete__'
1068 else:
1069 raise Exception('Cannot handle %s: operation has no id' % ast)
1070
1071 if len(self.arguments) >= 1 and (
1072 self.id in _operation_suffix_map
1073 ) and not self.ext_attrs.get('ImplementedAs'):
1074 arg = self.arguments[0]
1075 operation_category = 'Named' if arg.type.id == 'DOMString' else 'Indexed'
1076 self.ext_attrs.setdefault(
1077 'ImplementedAs', 'anonymous%s%s' %
1078 (operation_category, _operation_suffix_map[self.id]))
1079

Member Function Documentation

◆ __repr__()

scripts.idlnode.IDLOperation.__repr__ (   self)
Generates string of the form <class id extra extra ... 0x12345678>.

Reimplemented from scripts.idlnode.IDLNode.

Definition at line 1080 of file idlnode.py.

1080 def __repr__(self):
1081 return '<IDLOperation(id = %s)>' % (self.id)
1082

◆ _extra_repr()

scripts.idlnode.IDLOperation._extra_repr (   self)
protected
Returns string of extra info for __repr__().

Reimplemented from scripts.idlnode.IDLNode.

Definition at line 1083 of file idlnode.py.

1083 def _extra_repr(self):
1084 return [self.arguments]
1085

◆ SameSignatureAs()

scripts.idlnode.IDLOperation.SameSignatureAs (   self,
  operation 
)

Definition at line 1086 of file idlnode.py.

1086 def SameSignatureAs(self, operation):
1087 if self.type != operation.type:
1088 return False
1089 return [a.type for a in self.arguments] == [
1090 a.type for a in operation.arguments
1091 ]
1092

Member Data Documentation

◆ annotations

scripts.idlnode.IDLOperation.annotations

Definition at line 1037 of file idlnode.py.

◆ arguments

scripts.idlnode.IDLOperation.arguments

Definition at line 1041 of file idlnode.py.

◆ ext_attrs

scripts.idlnode.IDLOperation.ext_attrs

Definition at line 1036 of file idlnode.py.

◆ id

scripts.idlnode.IDLOperation.id

Definition at line 1057 of file idlnode.py.

◆ is_fc_suppressed

scripts.idlnode.IDLOperation.is_fc_suppressed

Definition at line 1038 of file idlnode.py.

◆ is_static

scripts.idlnode.IDLOperation.is_static

Definition at line 1040 of file idlnode.py.

◆ specials

scripts.idlnode.IDLOperation.specials

Definition at line 1039 of file idlnode.py.

◆ type

scripts.idlnode.IDLOperation.type

Definition at line 1044 of file idlnode.py.


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