code: def add_type_spec(self, name, spec, lineno):
          
          assert type is not None
  
          if name in self.type_specs:
              raise ThriftCompilerError(
                  'Cannot define type "%s" at line %d. '
                  'Another type with that name already exists.'
                  % (name, lineno)
              )
  
          self.type_specs[name] = spec
docs: Adds the given type to the scope.
  
          :param str name:
              Name of the new type
          :param spec:
              ``TypeSpec`` object containing information on the type, or a
              ``TypeReference`` if this is meant to be resolved during the
              ``link`` stage.
          :param lineno:
              Line number on which this type is defined.