public StatementSyntax TranslateProperty(
            string ctrlType,
            string ctrlIdentifier,
            VisualBasic6Parser.Cp_SinglePropertyContext property
            )
        {
            var propertyName =
                vb6NodeTree
                .GetChildren(property)
                .Find(x => x is VisualBasic6Parser.ImplicitCallStmt_InStmtContext)
                .getText()
                .Trim();
            var propertyValueContext =
                vb6NodeTree
                .GetChildren(property)
                .Find(x => x is VisualBasic6Parser.Cp_PropertyValueContext);
            var literalContext =
                vb6NodeTree
                .GetChildren(propertyValueContext)
                .Find(x => x is VisualBasic6Parser.LiteralContext);

            var asg = (LiteralImpl)_compileResult.Program.getASGElementRegistry().getASGElement(literalContext);

            if (asg == null)
            {
                DebugClass.LogError("ASG missing for: " + ctrlIdentifier + " for property: " + propertyName);
                throw new System.NotImplementedException("Don't know how to handle ASG null.");
            }

            var valueNode = TranslatorForExpression.GetExpression(asg);

            var valueString = valueNode.NormalizeWhitespace().ToFullString();

            var translatedPropertyName = TranslatePropertyName(ctrlType, propertyName);

            return(SyntaxFactory.ParseStatement(ctrlIdentifier + "." + translatedPropertyName + " = " + valueString + ";"));
        }
Example #2
0
        public ExpressionSyntax GetExpression(ParseTree tree)
        {
            var tfe = new TranslatorForExpression(this);

            return(tfe.GetExpression(tree));
        }