Exemplo n.º 1
0
 private HLLocation ProcessTargetExpression(ITargetExpression pExpression)
 {
     if (pExpression.Definition is ILocalDefinition)
     {
         return(HLLocalLocation.Create(HLDomain.GetLocal(pExpression.Definition as ILocalDefinition)));
     }
     else if (pExpression.Definition is IParameterDefinition)
     {
         HLParameter parameter = HLDomain.GetParameter(pExpression.Definition as IParameterDefinition);
         parameter.RequiresAddressing = true;
         return(HLParameterLocation.Create(parameter));
     }
     else if (pExpression.Definition is IFieldDefinition || pExpression.Definition is IFieldReference)
     {
         IFieldDefinition definition         = pExpression.Definition is IFieldDefinition ? (IFieldDefinition)pExpression.Definition : ((IFieldReference)pExpression.Definition).ResolvedField;
         HLType           typeFieldContainer = HLDomain.GetOrCreateType(definition.Container);
         HLField          field = HLDomain.GetField(definition);
         if (field.IsStatic)
         {
             return(HLStaticFieldLocation.Create(field));
         }
         HLLocation instance = ProcessExpression(pExpression.Instance);
         return(HLFieldLocation.Create(instance, field));
     }
     else if (pExpression.Definition is IAddressDereference)
     {
         IAddressDereference definition      = pExpression.Definition as IAddressDereference;
         HLLocation          locationAddress = ProcessExpression(definition.Address);
         return(HLIndirectAddressLocation.Create(locationAddress, HLDomain.GetOrCreateType(pExpression.Type)));
     }
     throw new NotSupportedException();
 }
Exemplo n.º 2
0
        private HLLocation ProcessAddressDereferenceExpression(IAddressDereference pExpression)
        {
            HLLocation locationAddress = ProcessExpression(pExpression.Address);

            return(HLIndirectAddressLocation.Create(locationAddress, HLDomain.GetOrCreateType(pExpression.Type)));
        }