コード例 #1
0
        /// <summary>
        /// Handles the AST node visit.
        /// </summary>
        /// <param name="astNode">AST node.</param>
        public override void Visit(EqualsOpInitElemAstNode astNode)
        {
            var numericFunction = MasterExporter.ToBasicNumericFunctionTerm(astNode.Term1);
            var numberAstNode   = astNode.Term2 as NumberTermAstNode;

            if (numericFunction != null && numberAstNode != null)
            {
                InitElementData = new EqualsNumericFunctionInitElement(numericFunction, numberAstNode.Number);
                return;
            }

            var objectFunction         = MasterExporter.ToBasicObjectFunctionTerm(astNode.Term1);
            var term2IdentifierAstNode = astNode.Term2 as IdentifierTermAstNode;

            if (objectFunction != null && term2IdentifierAstNode != null)
            {
                InitElementData = new EqualsObjectFunctionInitElement(objectFunction, MasterExporter.ToConstantTerm(term2IdentifierAstNode));
                return;
            }

            var term1IdentifierAstNode = astNode.Term1 as IdentifierTermAstNode;

            if (term1IdentifierAstNode != null && term2IdentifierAstNode != null)
            {
                InitElementData = new EqualsInitElement(MasterExporter.ToConstantTerm(astNode.Term1), MasterExporter.ToConstantTerm(astNode.Term2));
            }
        }
コード例 #2
0
 /// <summary>
 /// Handles the AST node visit.
 /// </summary>
 /// <param name="astNode">AST node.</param>
 public override void Visit(FunctionTermAstNode astNode)
 {
     if (astNode.Name.Equals("total-time"))
     {
         ExpressionData = new MetricTotalTime();
     }
     else
     {
         MetricNumericFunction function = new MetricNumericFunction(astNode.Name);
         astNode.Terms.ForEach(term => function.Terms.Add(MasterExporter.ToConstantTerm(term)));
         ExpressionData = function;
     }
 }