logo
class

compiler::Using

sys::Obj
  compiler::Node
    compiler::Using
  1  //
  2  // Copyright (c) 2006, Brian Frank and Andy Frank
  3  // Licensed under the Academic Free License version 3.0
  4  //
  5  // History:
  6  //   15 Sep 05  Brian Frank  Creation
  7  //    3 Jun 06  Brian Frank  Ported from Java to Fan - Megan's b-day!
  8  //   11 Oct 06  Brian Frank  Switch from import keyword to using
  9  //
 10  
 11  **
 12  ** Using models an using import statement.
 13  **
 14  class Using : Node
 15  {
 16  
 17  //////////////////////////////////////////////////////////////////////////
 18  // Construction
 19  //////////////////////////////////////////////////////////////////////////
 20  
 21    new make(Location location, Str podName)
 22      : super(location)
 23    {
 24      this.podName = podName
 25    }
 26  
 27  //////////////////////////////////////////////////////////////////////////
 28  // Debug
 29  //////////////////////////////////////////////////////////////////////////
 30  
 31    override Void print(AstWriter out)
 32    {
 33      out.w(toStr).nl
 34    }
 35  
 36    override Str toStr()
 37    {
 38      s := "using $podName"
 39      if (typeName != null) s += "::$typeName"
 40      if (asName != null) s += " as $asName"
 41      return s
 42    }
 43  
 44  //////////////////////////////////////////////////////////////////////////
 45  // Fields
 46  //////////////////////////////////////////////////////////////////////////
 47  
 48    Str podName          // pod name
 49    Str typeName         // type name or null
 50    Str asName           // rename if using as
 51    CPod resolvedPod     // ResolveImports
 52    CType resolvedType   // ResolveImports
 53  
 54  }