private object EvaluateValueReferenceExpression(ValueReferenceStatementNode theValueReferenceExpression)
 {
     if (theValueReferenceExpression.IsSingletonValue)
     {
         var singletonVariableName = theValueReferenceExpression.VariableName;
         var singletonValue        = this.snapshot.GetSingletonLabelByVariableName(singletonVariableName.Name);
         return(singletonValue.Value);
     }
     else if (theValueReferenceExpression.IsAggregateValue)
     {
         var aggregateVariableName   = theValueReferenceExpression.VariableName;
         var aggregateVariableOffset = theValueReferenceExpression.ValueOffset;
         int offsetValue;
         if (aggregateVariableOffset.IsLiteral)
         {
             offsetValue = aggregateVariableOffset.Literal.Value;
         }
         else
         {
             Debug.Assert(aggregateVariableOffset.IsCounterReference);
             var counterReference = aggregateVariableOffset.Counter;
             var counterContext   = this.context.GetCounterContextByName(counterReference.CounterName);
             offsetValue = counterContext.CurrentValue;
         }
         var aggregateValue = this.snapshot.GetAggregateLabelByVariableName(aggregateVariableName.Name);
         return(aggregateValue.GetValueAt(offsetValue - 1));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Beispiel #2
0
 private object EvaluateValueReferenceExpression(ValueReferenceStatementNode theValueReferenceExpression)
 {
     if (theValueReferenceExpression.IsSingletonValue)
     {
         var singletonVariableName = theValueReferenceExpression.VariableName;
         var singletonValue        = _snapshot.GetSingletonLabelByVariableName(singletonVariableName.Name);
         return(singletonValue.Value);
     }
     else if (theValueReferenceExpression.IsAggregateValue)
     {
         var aggregateVariableName   = theValueReferenceExpression.VariableName;
         var aggregateVariableOffset = theValueReferenceExpression.ValueOffset;
         Debug.Assert(aggregateVariableOffset.IsLiteral);
         var offsetValue    = aggregateVariableOffset.Literal.Value;
         var aggregateValue = _snapshot.GetAggregateLabelByVariableName(aggregateVariableName.Name);
         return(aggregateValue.GetValueAt(offsetValue - 1));
     }
     else
     {
         throw new NotImplementedException();
     }
 }