Beispiel #1
0
 public MidFieldRef FieldRef(
     SourceRange range,
     MidPath obj,
     MidFieldDecl decl)
 {
     return((MidFieldRef)_fieldRefs.Get(obj).Get(decl).Cache(
                () => new MidFieldRef(range, obj, decl)));
 }
Beispiel #2
0
 public MidAttributeFetch AttributeFetch(
     SourceRange range,
     MidPath obj,
     MidAttributeDecl attribute)
 {
     return((MidAttributeFetch)_attrFetches.Get(obj).Get(attribute).Cache(
                () => new MidAttributeFetch(range, obj, attribute, _lazyFactory)));
 }
Beispiel #3
0
 public MidFieldRef(
     SourceRange range,
     MidPath obj,
     MidFieldDecl decl)
     : base(range, decl.Type)
 {
     _obj  = obj;
     _decl = decl;
 }
Beispiel #4
0
 public MidAttributeFetch(
     SourceRange range,
     MidPath obj,
     MidType type,
     ILazy <MidAttributeDecl> attribute)
     : base(range, new MidDummyType())
 {
     _obj       = obj;
     _type      = Lazy.Value(type);
     _attribute = attribute;
 }
Beispiel #5
0
 public MidAttributeFetch(
     SourceRange range,
     MidPath obj,
     MidAttributeDecl attribute,
     ILazyFactory lazyFactory)
     : base(range, new MidDummyType())
 {
     _obj       = obj;
     _type      = lazyFactory.New(() => _attribute.Value.Type);
     _attribute = Lazy.Value(attribute);
 }
Beispiel #6
0
 private MidExp TryFoldPath(
     MidVar var,
     MidExp exp,
     MidPath path)
 {
     if (exp is MidFieldRef)
     {
         var midFieldRef = (MidFieldRef)exp;
         if (midFieldRef.Obj is MidVarRef)
         {
             var midVarRef = (MidVarRef)midFieldRef.Obj;
             if (midVarRef.Var == var)
             {
                 midFieldRef.Obj = path;
                 return(midFieldRef);
             }
         }
     }
     return(exp);
 }