code: def _populate_struct_type_attributes(self, env, data_type):
          
          parent_type = None
          extends = data_type._ast_node.extends
          if extends:
              # A parent type must be fully defined and not just a forward
              # reference.
              parent_type = self._resolve_type(env, extends, True)
              if isinstance(parent_type, Alias):
                  # Restrict extending aliases because it's difficult to generate
                  # code for it in Python. We put all type references at the end
                  # to avoid out-of-order declaration issues, but using "extends"
                  # in Python forces the reference to happen earlier.
                  raise InvalidSpec(
                      'A struct cannot extend an alias. '
                      'Use the canonical name instead.',
                      data_type._ast_node.lineno, data_type._ast_node.path)
              if isinstance(parent_type, Nullable):
                  raise InvalidSpec(
                      'A struct cannot extend a nullable type.',
                      data_type._ast_node.lineno, data_type._ast_node.path)
              if not isinstance(parent_type, Struct):
                  raise InvalidSpec(
                      'A struct can only extend another struct: '
                      '%s is not a struct.' % quote(parent_type.name),
                      data_type._ast_node.lineno, data_type._ast_node.path)
          api_type_fields = []
          for stone_field in data_type._ast_node.fields:
              api_type_field = self._create_struct_field(env, stone_field)
              api_type_fields.append(api_type_field)
          data_type.set_attributes(
              data_type._ast_node.doc, api_type_fields, parent_type)
docs: Converts a forward reference of a struct into a complete definition.