mojo/public/tools/mojom/mojom/generate/module.py
def AddSharedProperty(cls, name):
    """Adds a property |name| to |cls|, which accesses the corresponding item in
       |shared_definition|.

       The reason of adding such indirection is to enable sharing definition
       between a reference kind and its nullable variation. For example:
         a = Struct('test_struct_1')
         b = a.MakeNullableKind()
         a.name = 'test_struct_2'
         print(b.name)  # Outputs 'test_struct_2'.
    """

    def Get(self):
      try:
        return self.shared_definition[name]
      except KeyError:  # Must raise AttributeError if property doesn't exist.
        raise AttributeError

    def Set(self, value):
      self.shared_definition[name] = value

    setattr(cls, name, property(Get, Set))
Adds a property |name| to |cls|, which accesses the corresponding item in
       |shared_definition|.

       The reason of adding such indirection is to enable sharing definition
       between a reference kind and its nullable variation. For example:
         a = Struct('test_struct_1')
         b = a.MakeNullableKind()
         a.name = 'test_struct_2'
         print(b.name)  # Outputs 'test_struct_2'.
    


The reason of adding such indirection is to enable sharing definition
between a reference kind and its nullable variation.
The reason of adding such indirection is to enable sharing definition between a reference kind and its nullable variation .
def AddSharedProperty(cls, name):
    def Get(self):
      try:
        return self.shared_definition[name]
      except KeyError:  
        raise AttributeError
    def Set(self, value):
      self.shared_definition[name] = value
    setattr(cls, name, property(Get, Set))
def AddSharedProperty ( cls , name ) : def Get ( self ) : try : return self . shared_definition [ name ] except KeyError : raise AttributeError def Set ( self , value ) : self . shared_definition [ name ] = value setattr ( cls , name , property ( Get , Set ) )
Adds a property |name| to |cls|, which accesses the corresponding item in
|shared_definition|.
Adds a property |name| to |cls| which accesses the corresponding item in |shared_definition| .
"""Adds a property |name| to |cls|, which accesses the corresponding item in
       |shared_definition|.

       The reason of adding such indirection is to enable sharing definition
       between a reference kind and its nullable variation. For example:
         a = Struct('test_struct_1')
         b = a.MakeNullableKind()
         a.name = 'test_struct_2'
         print(b.name)  # Outputs 'test_struct_2'.
    """ # Must raise AttributeError if property doesn't exist.
cls
name