Пример #1
0
    override public string writeAsTypescript()
    {
        string output = this.Indent();

        output += this.visibility + " " + this.name + "(";
        for (int i = 0; i < this.parameters.Count; i++)
        {
            output += this.parameters[i].name + " : " + CSParsingTool.TypescriptTypeFromCSharpType(this.parameters[i].type);
            if (i < this.parameters.Count - 1)
            {
                output += ", ";
            }
        }
        output += ") : " + this.returnType;
        output += " {";
        if (this.children.Count == 0)
        {
            output += "}\n";
        }
        else
        {
            output += "\n";
            this.children.ForEach(
                (c) => {
                output += c.writeAsTypescript();
            }
                );
            output += this.Indent() + "}\n";
        }
        return(output);
    }
Пример #2
0
    override public string writeAsTypescript()
    {
        string output = this.Indent();

        output += this.visibility + " " + this.name + " : " + CSParsingTool.TypescriptTypeFromCSharpType(this.type);
        if (this.initializer != null)
        {
            output += " = " + CSParsingTool.CleanOperation(this.initializer);
        }
        output += ";\n";
        return(output);
    }
Пример #3
0
    override public string writeAsTypescript()
    {
        string output = this.Indent();

        output += "class " + this.name;
        if (this.baseName != null)
        {
            output += " extends " + CSParsingTool.TypescriptTypeFromCSharpType(this.baseName);
        }
        output += " {\n";
        this.children.ForEach(
            (c) => {
            output += c.writeAsTypescript();
        }
            );
        output += this.Indent() + "}\n";
        return(output);
    }