Ejemplo n.º 1
0
        public override void VisitInvocationExpression(InvocationExpression invocationExpression)
        {
            base.VisitInvocationExpression(invocationExpression);

            var resolve = this.m_Resolver.Resolve(invocationExpression.Target);

            if (resolve is MethodGroupResolveResult)
            {
                var methodResolve = resolve as MethodGroupResolveResult;
                if (!methodResolve.Methods.Any(x => x.Name == methodResolve.MethodName))
                {
                    // FIXME: Extension methods!
                }
                else
                {
                    var method = methodResolve.Methods.First(x => x.Name == methodResolve.MethodName);
                    this.m_Writer.Write(JavaInvoke.DetermineInvocationMethod(method));
                    this.m_Writer.Write(' ');
                    this.m_Writer.WriteLine(JavaSignature.CreateMethodSignature(method));
                }
            }
            else
            {
                throw new NotSupportedException();
            }
        }
Ejemplo n.º 2
0
 public void FunctionInvoke(IMethod method)
 {
     this.m_Writer.Write(JavaInvoke.DetermineInvocationMethod(method));
     this.m_Writer.Write(' ');
     this.m_Writer.WriteLine(JavaSignature.CreateMethodSignature(method));
     if (JavaInvoke.DetermineInvocationMethod(method) != "getstatic")
     {
         this.Pop();
     }
     for (var i = 0; i < method.Parameters.Count; i++)
     {
         this.Pop();
     }
 }
Ejemplo n.º 3
0
        public override void VisitMethodDeclaration(MethodDeclaration methodDeclaration)
        {
            var typeDeclaration = methodDeclaration.GetParent <TypeDeclaration>();
            var writer          = this.m_TypeWriters[typeDeclaration];

            var modifiers     = this.GetJavaModifiersAsList(methodDeclaration.Modifiers);
            var javaModifiers = this.ConvertModifierListToJavaModifiers(modifiers);

            writer.WriteLine(".method " + javaModifiers + " " +
                             JavaSignature.CreateMethodSignature(methodDeclaration, this.m_Resolver.TypeResolveContext, false));

            methodDeclaration.AcceptVisitor(new JavaMethodVisitor(this.m_Resolver, writer));

            writer.WriteLine(".end method");
        }