Пример #1
0
    public override void CodeGen(OutputContext output)
    {
        output.Print("import");
        output.Space();
        ImportedName?.Print(output);
        if (ImportedName != null && ImportedNames.Count > 0)
        {
            output.Print(",");
            output.Space();
        }

        if (ImportedNames.Count > 0)
        {
            if (ImportedNames.Count == 1 && ImportedNames[0].ForeignName.Name == "*")
            {
                ImportedNames[0].Print(output);
            }
            else
            {
                output.Print("{");
                for (var i = 0u; i < ImportedNames.Count; i++)
                {
                    if (i > 0)
                    {
                        output.Comma();
                    }
                    else
                    {
                        output.Space();
                    }
                    ImportedNames[i].Print(output);
                }

                output.Space();
                output.Print("}");
            }
        }

        if (ImportedName != null || ImportedNames.Count > 0)
        {
            output.Space();
            output.Print("from");
            output.Space();
        }

        ModuleName.Print(output);
        output.Semicolon();
    }