コード例 #1
0
        private void WriteType(TypeMember type, IList <string> commonNamespaceParts)
        {
            var syntaxBuilder = new UnitSyntaxEmitter(_codeModel, type);
            var syntaxTree    = syntaxBuilder.EmitSyntax();

            var subFolderParts = GetSubFolder(type, commonNamespaceParts);

            _output.AddSourceFile(subFolderParts, $"{type.Name}.cs", syntaxTree.ToString());
        }
コード例 #2
0
        public void WriteModule(ModuleMember module, bool privateScope = false)
        {
            _code = new CodeTextBuilder(_output.TextOptions);

            WriteImports(module);

            if (privateScope)
            {
                _code.WriteLine("(function() {");
                _code.Indent(1);
            }

            WriteMembers(module);
            WriteGlobalBlock(module);

            if (privateScope)
            {
                _code.Indent(-1);
                _code.WriteLine("}());");
            }

            _output.AddSourceFile(module.FolderPath, $"{module.Name.ToString(CasingStyle.Kebab)}.js", _code.ToString());
        }
コード例 #3
0
 public static void AddSourceFile(this ICodeGeneratorOutput output, IEnumerable <string> folderPath, string fileName, string contents)
 {
     output.AddSourceFile(new FilePath(folderPath, fileName), contents);
 }
コード例 #4
0
 private void CopyFrameworkFiles()
 {
     _output.AddSourceFile(new[] { "src", "components" }, "form.js", GetFrameworkFileContents("Components", "form.js"));
 }