コード例 #1
0
        public static JavaField TranslateProp(SemanticModel semanticModel, PropertyDeclarationSyntax node, CSharpSyntaxVisitor <IStmt> statementVisitor)
        {
            var symbol = semanticModel.GetDeclaredSymbol(node);

            return(new JavaField
            {
                FieldName = node.Identifier.ToString(),
                IsStatic = symbol.IsStatic,
                Initialization = node.Initializer != null?statementVisitor.Visit(node.Initializer) : null,
                                     TypeSymbol = SymbolHelper.GetVariableSymbol(symbol),
                                     DeclaredAccessibility = symbol.DeclaredAccessibility
            });
        }
コード例 #2
0
        public override IStmt VisitVariableDeclarator(VariableDeclaratorSyntax node)
        {
            var symbol           = semanticModel.GetDeclaredSymbol(node);
            var customRuleResult = extensionPoints.Translate(node, semanticModel, this);

            if (customRuleResult != null)
            {
                return(customRuleResult);
            }
            return(new LocalDeclStmt
            {
                DeclName = node.Identifier.ToString(),
                Initialization = Visit(node.Initializer),
                TypeSymbol = SymbolHelper.GetVariableSymbol(symbol)
            });
        }
コード例 #3
0
        public override IStmt VisitForEachStatement(ForEachStatementSyntax node)
        {
            var container            = Visit(node.Expression);
            var iteratorVariableName = node.Identifier.Value.ToString();
            var symbol           = semanticModel.GetDeclaredSymbol(node);
            var iteratorVariable = new LocalDeclStmt
            {
                DeclName   = iteratorVariableName,
                TypeSymbol = SymbolHelper.GetVariableSymbol(symbol)
            };

            return(new ForEachStmt
            {
                SourceContainer = container,
                Iterator = iteratorVariable,
                Body = WrapToBlock(Visit(node.Statement))
            });
        }