logo
class

compiler::TypeRef

sys::Obj
  compiler::Node
    compiler::TypeRef

Mixin: compiler::CType
  1  //
  2  // Copyright (c) 2006, Brian Frank and Andy Frank
  3  // Licensed under the Academic Free License version 3.0
  4  //
  5  // History:
  6  //   5 Jul 06  Brian Frank  Creation
  7  //
  8  
  9  **
 10  ** TypeRef models a type reference such as an extends clause or a
 11  ** method parameter.  Really it is just an AST node wrapper for a
 12  ** CType that let's us keep track of the source code Location.
 13  **
 14  class TypeRef : Node, CType
 15  {
 16  
 17  //////////////////////////////////////////////////////////////////////////
 18  // Construction
 19  //////////////////////////////////////////////////////////////////////////
 20  
 21    new make(Location location, CType t)
 22      : super(location)
 23    {
 24      this.t = t
 25    }
 26  
 27  //////////////////////////////////////////////////////////////////////////
 28  // CType
 29  //////////////////////////////////////////////////////////////////////////
 30  
 31    override Namespace ns()  { return t.ns }
 32    override CPod pod()      { return t.pod }
 33    override Str name()      { return t.name }
 34    override Str qname()     { return t.qname }
 35    override Str signature() { return t.signature }
 36    override CType deref()   { return t }
 37    override Int flags()     { return t.flags }
 38  
 39    override CType base() { return t.base }
 40    override CType[] mixins() { return t.mixins }
 41    override Bool fits(CType that) { return t.fits(that) }
 42  
 43    override Bool isGeneric() { return t.isGeneric }
 44    override Bool isParameterized() { return t.isParameterized }
 45    override Bool isGenericParameter() { return t.isGenericParameter }
 46    override ListType toListOf() { return t.toListOf }
 47  
 48    override Str:CSlot slots() { return t.slots }
 49  
 50    override Str toStr() { return signature }
 51  
 52  //////////////////////////////////////////////////////////////////////////
 53  // Debug
 54  //////////////////////////////////////////////////////////////////////////
 55  
 56    override Void print(AstWriter out)
 57    {
 58      out.w(t.toStr)
 59    }
 60  
 61  //////////////////////////////////////////////////////////////////////////
 62  // Fields
 63  //////////////////////////////////////////////////////////////////////////
 64  
 65    readonly CType t
 66  
 67  }