Ejemplo n.º 1
0
 public void VisitAnonymousFunctionType(TsFunction func)
 {
     _Writer
     .WriteIf(func.IsStatic, "static ")
     .Write("(").VisitEachJoin(func.Parameters, ",").Write(")")
     .PrefixVisit("=>", func.Type);
 }
Ejemplo n.º 2
0
 public void VisitAnonymousFunctionType(TsFunction func)
 {
     _Writer
         .WriteIf(func.IsStatic, "static ")
         .Write("(").VisitEachJoin(func.Parameters, ",").Write(")")
         .PrefixVisit("=>", func.Type);
 }
Ejemplo n.º 3
0
 //public void Write(object obj)
 //{
 //    Writer.Write(obj);
 //}
 public void VisitFunction(TsFunction func)
 {
     if (func.IsCallSignature)
     {
         VisitAnonymousFunctionType(func);
         return;
     }
     _Writer
     .Write(func.Name)
     .VisitEachJoinIfNotNullOrEmpty(func.TypeParameters, "<", ",", ">")
     .Write("(").VisitEachJoin(func.Parameters, ",").Write(")")
     .PrefixVisitIf(func.Type != null && !func.IsConstructor, ":", func.Type)
     .WriteIfElse(func.Body != null, "{" + func.Body + "}", ";")
     .Write("\n");
 }
Ejemplo n.º 4
0
 //public void Write(object obj)
 //{
 //    Writer.Write(obj);
 //}
 public void VisitFunction(TsFunction func)
 {
     if (func.IsCallSignature)
     {
         VisitAnonymousFunctionType(func);
         return;
     }
     _Writer
         .Write(func.Name)
         .VisitEachJoinIfNotNullOrEmpty(func.TypeParameters, "<", ",", ">")
         .Write("(").VisitEachJoin(func.Parameters, ",").Write(")")
         .PrefixVisitIf(func.Type!=null && !func.IsConstructor, ":", func.Type)
         .WriteIfElse(func.Body!=null, "{"+func.Body+"}", ";")
         .Write("\n");
 }
Ejemplo n.º 5
0
        public TsFunction Visit(IMethod me)
        {
            if (me is FakeMethod)
                return null;
            TsFunction me2 = new TsFunction
            {
                Name = SkJs.GetEntityJsName(me),
                IsStatic = me.IsStatic,
                Parameters = me.Parameters.Select(Visit).ToList()
            };
            if (me.SymbolKind == SymbolKind.Constructor)
            {
                me2.Name = SkJs.GetEntityJsName(me);// "constructor";
                //if (me2.Name.StartsWith("."))
                //me2.IsConstructor = true;
            }
            else
            {
                me2.Type = Visit(me.ReturnType);
                me2.TypeParameters = me.TypeParameters.Select(Visit).ToList();
            }
            return me2;

        }