Commit 3df0b847 authored by Yuki Shiino's avatar Yuki Shiino Committed by Chromium LUCI CQ

bind-gen: Implement IDL union (3 of N)

Implements accessor functions of new IDL unions.  Also implements
constructors and 'Clear' member function.

Bug: 839389
Change-Id: I4d51261e96a23b63c33ac3c43553a779e978053e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2522861Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832354}
parent e1525192
...@@ -140,7 +140,7 @@ class NewUnion(WithIdentifier, WithCodeGeneratorInfo, WithComponent, ...@@ -140,7 +140,7 @@ class NewUnion(WithIdentifier, WithCodeGeneratorInfo, WithComponent,
idl_type.type_name_with_extended_attribute_key_values) idl_type.type_name_with_extended_attribute_key_values)
sort_key_identifier = lambda x: x.identifier sort_key_identifier = lambda x: x.identifier
self._union_types = tuple(ir.union_types) self._idl_types = tuple(ir.union_types)
self._flattened_member_types = tuple( self._flattened_member_types = tuple(
sorted(flattened_member_types, key=sort_key_typename)) sorted(flattened_member_types, key=sort_key_typename))
self._does_include_nullable_type = does_include_nullable_type self._does_include_nullable_type = does_include_nullable_type
...@@ -153,9 +153,14 @@ class NewUnion(WithIdentifier, WithCodeGeneratorInfo, WithComponent, ...@@ -153,9 +153,14 @@ class NewUnion(WithIdentifier, WithCodeGeneratorInfo, WithComponent,
sorted(ir.typedefs, key=sort_key_identifier)) sorted(ir.typedefs, key=sort_key_identifier))
ir.public_object = self ir.public_object = self
# TODO(yukishiino): Replace BackwardCompatibleUnion with NewUnion
# for union_type in self._union_types: for idl_type in self._idl_types:
# union_type.set_union_definition_object(self) idl_type.set_new_union_definition_object(self)
@property
def idl_types(self):
"""Returns a list of IdlTypes which this object represents."""
return self._idl_types
@property @property
def flattened_member_types(self): def flattened_member_types(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment