Exemplo n.º 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));
            }
        }