Exemplo n.º 1
0
        private Boolean IsMethod(Declaration.MemberDeclaration declaration)
        {
            var member     = declaration.Item;
            var memberKind = member.Kind;

            return(memberKind.IsMethod);
        }
Exemplo n.º 2
0
        private Boolean IsField(Declaration.MemberDeclaration declaration)
        {
            var member     = declaration.Item;
            var memberKind = member.Kind;

            return(memberKind.IsGetter);
        }
Exemplo n.º 3
0
        private TypeSyntax GetFieldType(Declaration.MemberDeclaration declaration, out Boolean isVoid)
        {
            isVoid = false;
            var member = declaration.Item;

            if (member.Body.IsValue)
            {
                var memberBody = (Expr.Value)member.Body;
                return(Typ2Type(memberBody.Type, out isVoid));
            }
            else if (member.Body.IsApply)
            {
                var memberBody = (Expr.Apply)member.Body;
                return(Typ2Type(memberBody.typ, out isVoid));
            }
            else if (member.Body.IsWrapped)
            {
                var memberBody = (Expr.Wrapped)member.Body;
                return(Typ2Type(memberBody.Item2, out isVoid));
            }
            else if (member.Body.IsSequential)
            {
                var memberBody = (Expr.Sequential)member.Body;
                return(IdentifierName("dynamic"));
            }
            throw new NotImplementedException(declaration.ToString());
        }
Exemplo n.º 4
0
        private SyntaxToken GetMethodName(Declaration.MemberDeclaration declaration)
        {
            var member           = declaration.Item;
            var memberKind       = member.Kind;
            var memberKindMethod = (MemberKind.Method)member.Kind;

            return(Identifier(memberKindMethod.name));
        }
Exemplo n.º 5
0
        private SyntaxToken GetFieldName(Declaration.MemberDeclaration declaration)
        {
            var member           = declaration.Item;
            var memberKind       = member.Kind;
            var memberKindGetter = (MemberKind.Getter)member.Kind;

            return(Identifier(memberKindGetter.name));
        }
Exemplo n.º 6
0
        private SyntaxNodeOrToken[] GetMethodParameters(Declaration.MemberDeclaration declaration)
        {
            var member = declaration.Item;
            var result = new List <SyntaxNodeOrToken>();

            foreach (var ident in member.Arguments)
            {
                Boolean isVoid;
                var     parameter = Parameter(Identifier(ident.name)).WithType(Typ2Type(ident.typ, out isVoid));
                result.Add(parameter);
                result.Add(Token(SyntaxKind.CommaToken));
            }
            return(result.Take(result.Count - 1).ToArray());
        }
Exemplo n.º 7
0
        private Fable.AST.Fable.Expr GetMethodBody(Declaration.MemberDeclaration declaration)
        {
            var member = declaration.Item;

            return(member.Body);
        }
Exemplo n.º 8
0
        private ExpressionSyntax GetFieldValue(Declaration.MemberDeclaration declaration)
        {
            var member = declaration.Item;

            return((ExpressionSyntax)TransformExpression(member.Body));
        }