private System.String versionString; // The HAPI version /// <summary>This constructor will create a new ConformanceSegmentBuilder</summary> /// <param name="packageName">the name of the package /// </param> /// <param name="versionString">the version of HL7 which these classes are conforming to /// </param> /// <param name="depManager">the instance of DeploymentManager /// </param> public ConformanceSegmentBuilder(System.String packageName, System.String versionString, DeploymentManager depManager):base() { this.packageName = packageName; this.versionString = versionString; this.docBuilder = DocumentationBuilder.getDocumentationBuilder(); this.depManager = depManager; }
private System.String version; // The HAPI version /// <summary>This constructor will create a new ConformanceSegmentBuilder</summary> /// <param name="packageName">the name of the package /// </param> /// <param name="versionString">the version of HL7 which these classes are conforming to /// </param> /// <param name="depManager">the instance of DeploymentManager /// </param> public ConformanceSegGroupBuilder(System.String packageName, System.String version, DeploymentManager depManager, System.String structID):base() { this.packageName = packageName; this.version = version; this.docBuilder = DocumentationBuilder.getDocumentationBuilder(); this.depManager = depManager; this.structID = structID; }
public async Task BuildDocumentationAsync() { string docuHTML = DocumentationBuilder.BuildDocumentation(commandService, DocumentationOutputTypes.HTML); string fileHTML = Path.Combine(AppContext.BaseDirectory, "documentation.html"); await MonkeyHelpers.WriteTextAsync(fileHTML, docuHTML).ConfigureAwait(false); string docuMD = DocumentationBuilder.BuildDocumentation(commandService, DocumentationOutputTypes.MarkDown); string fileMD = Path.Combine(AppContext.BaseDirectory, "documentation.md"); await MonkeyHelpers.WriteTextAsync(fileMD, docuMD).ConfigureAwait(false); }
public void BuildDocumentationTest() { var path = @"..\..\..\LucidDocumentation\bin\Debug\netstandard2.0\LucidDocumentation.dll"; path = @"C:\Projects\LucidUnits\LucidUnits\bin\Release\netstandard2.0\LucidUnits.dll"; path = @"C:\Projects\SE.Web.ContextualFeatureApi\SE.Web.ContextualFeatureApi\bin\Debug\SE.Web.ContextualFeatureApi.dll"; var docBuilder = new DocumentationBuilder(@"C:\Projects\SE.Web.ContextualFeatureApi\packages\"); var documentation = docBuilder.BuildDocumentation(Path.GetFullPath(path)); Assert.AreEqual("", documentation); }
/// <summary>Adds a XML documentation header to a diagnosted member declaration.</summary> /// <param name="document">The document that includes the diagnostic.</param> /// <param name="diagnostic">The detected disgnostic, that should be fixed.</param> /// <param name="cancellationToken">A cancellation token to cancel the action.</param> /// <returns>A solution including the fixed code.</returns> private static async Task <Solution> AddDocumentationHeaderAsync(Document document, Diagnostic diagnostic, CancellationToken cancellationToken) { SyntaxNode root = await document.GetSyntaxRootAsync(cancellationToken); SyntaxNode syntaxNode = root.FindNode(diagnostic.Location.SourceSpan); MemberDeclarationSyntax targetNode = syntaxNode.AncestorsAndSelf().OfType <MemberDeclarationSyntax>().First(); SyntaxNode newSyntaxNode = DocumentationBuilder.AddCompleteDocumentationHeader(targetNode); Document newDocument = document.WithSyntaxRoot(root.ReplaceNode(targetNode, newSyntaxNode)); // Make sure the document is well formatted newDocument = await Formatter.FormatAsync(newDocument, newDocument.Project.Solution.Options, cancellationToken); return(newDocument.Project.Solution); }
/// <summary>This method will return a String representation of the class contained within the generated /// Java source file /// </summary> /// <returns> a String representation of the class /// </returns> public override System.String ToString() { System.String theClass = new System.Text.StringBuilder().ToString(); theClass += DocumentationBuilder.getDocumentationBuilder().GeneratedClassHeader; theClass += System.String.Concat(vectorToString(0, license, ""), "\n\n"); // License block theClass += ("package " + classPackage + ";\n\n"); // Package statement theClass += System.String.Concat(vectorToString(0, classImports, ""), "\n\n"); // Package and import statements theClass += ("/**\n" + System.String.Concat(vectorToString(0, classComments, " * "), " */\n")); // Class comments theClass += ("public class " + name + properties + "{\n\n"); // Class statement theClass += System.String.Concat(vectorToString(1, memberVariables, ""), "\n\n"); // member variables theClass += (constructor.ToString() + "\n\n"); // Constructor theClass += System.String.Concat(vectorToString(0, methods, ""), "\n"); // methods (no indentation because methods indent themselves) theClass += "}\n"; return(theClass); }
public CompletionAnalysis( IModuleAnalysis analysis, PythonAst tree, SourceLocation position, GetMemberOptions opts, ServerSettings.PythonCompletionOptions completionSettings, DocumentationBuilder textBuilder, ILogger log, Func <TextReader> openDocument ) { Analysis = analysis ?? throw new ArgumentNullException(nameof(analysis)); Tree = tree ?? throw new ArgumentNullException(nameof(tree)); Position = position; Index = Tree.LocationToIndex(Position); Options = opts; _pathResolver = analysis.ProjectState.CurrentPathResolver; _textBuilder = textBuilder; _log = log; _openDocument = openDocument; _addBrackets = completionSettings.addBrackets; var finder = new ExpressionFinder(Tree, new GetExpressionOptions { Names = true, Members = true, NamedArgumentNames = true, ImportNames = true, ImportAsNames = true, Literals = true, Errors = true }); finder.Get(Index, Index, out var node, out _statement, out _scope); var index = Index; var col = Position.Column; while (CanBackUp(Tree, node, _statement, _scope, col)) { col -= 1; index -= 1; finder.Get(index, index, out node, out _statement, out _scope); } Node = node ?? (_statement as ExpressionStatement)?.Expression; }
private async Task DoInitializeAsync(InitializeParams @params, CancellationToken token) { _disposableBag.ThrowIfDisposed(); Analyzer = await AnalysisQueue.ExecuteInQueueAsync(ct => CreateAnalyzer(@params.initializationOptions.interpreter, token), AnalysisPriority.High); _disposableBag.ThrowIfDisposed(); _clientCaps = @params.capabilities; _traceLogging = @params.initializationOptions.traceLogging; _analysisUpdates = @params.initializationOptions.analysisUpdates; Analyzer.EnableDiagnostics = _clientCaps?.python?.liveLinting ?? false; _reloadModulesQueueItem = new ReloadModulesQueueItem(Analyzer); if (@params.initializationOptions.displayOptions != null) { DisplayOptions = @params.initializationOptions.displayOptions; } _displayTextBuilder = DocumentationBuilder.Create(DisplayOptions); if (string.IsNullOrEmpty(Analyzer.InterpreterFactory?.Configuration?.InterpreterPath)) { LogMessage(MessageType._General, "Initializing for generic interpreter"); } else { LogMessage(MessageType._General, $"Initializing for {Analyzer.InterpreterFactory.Configuration.InterpreterPath}"); } if (@params.rootUri != null) { _rootDir = @params.rootUri.ToAbsolutePath(); } else if (!string.IsNullOrEmpty(@params.rootPath)) { _rootDir = PathUtils.NormalizePath(@params.rootPath); } SetSearchPaths(@params.initializationOptions.searchPaths); SetTypeStubSearchPaths(@params.initializationOptions.typeStubSearchPaths); Analyzer.Interpreter.ModuleNamesChanged += Interpreter_ModuleNamesChanged; }
private async Task DoInitializeAsync(InitializeParams @params, CancellationToken token) { _disposableBag.ThrowIfDisposed(); Analyzer = await AnalysisQueue.ExecuteInQueueAsync(ct => CreateAnalyzer(@params.initializationOptions.interpreter, token), AnalysisPriority.High); _disposableBag.ThrowIfDisposed(); _clientCaps = @params.capabilities; _traceLogging = @params.initializationOptions.traceLogging; _analysisUpdates = @params.initializationOptions.analysisUpdates; Analyzer.EnableDiagnostics = _clientCaps?.python?.liveLinting ?? true; _reloadModulesQueueItem = new ReloadModulesQueueItem(this); if (@params.initializationOptions.displayOptions != null) { DisplayOptions = @params.initializationOptions.displayOptions; } _displayTextBuilder = DocumentationBuilder.Create(DisplayOptions); DisplayStartupInfo(); if (@params.rootUri != null) { _rootDir = @params.rootUri.ToAbsolutePath(); } else if (!string.IsNullOrEmpty(@params.rootPath)) { _rootDir = PathUtils.NormalizePath(@params.rootPath); } Analyzer.SetRoot(_rootDir); Analyzer.SetSearchPaths(@params.initializationOptions.searchPaths.MaybeEnumerate()); Analyzer.SetTypeStubPaths(@params.initializationOptions.typeStubSearchPaths.MaybeEnumerate()); Analyzer.Interpreter.ModuleNamesChanged += Interpreter_ModuleNamesChanged; }
/// <summary>Adds min and max reps to the genrated classes</summary> /// <param name="minReps">the Minimum Repetitions /// </param> /// <param name="maxReps">Maximum Repetitions /// </param> public virtual void setMinMaxReps(short minReps, short maxReps) { GeneratedMethod maxRepsMethod = new GeneratedMethod(); GeneratedMethod minRepsMethod = new GeneratedMethod(); this.addMemberVariable("private final short MAX_REPS = " + maxReps + ";"); this.addMemberVariable("private final short MIN_REPS = " + minReps + ";"); // Creates the methos to return the maximum number of repitions for the generated Class DocumentationBuilder.getDocumentationBuilder().decorateMaxReps(maxRepsMethod); maxRepsMethod.Visibility = "public"; maxRepsMethod.ReturnType = "short"; maxRepsMethod.Name = "getMaxReps"; maxRepsMethod.addToBody("return this.MAX_REPS;"); this.addMethod(maxRepsMethod); // Creates the method to return the maximum number of repitions for the generated Class DocumentationBuilder.getDocumentationBuilder().decorateMaxReps(minRepsMethod); minRepsMethod.Visibility = "public"; minRepsMethod.ReturnType = "short"; minRepsMethod.Name = "getMinReps"; minRepsMethod.addToBody("return this.MIN_REPS;"); this.addMethod(minRepsMethod); }
public DocumentationReference ConvertXmlDoc(DocumentationBuilder doc) { DocumentationReference result = new DocumentationReference(); if (doc.ParsedName != null) { if (doc.ParsedName.Name == "<this>") { result.EntityType = EntityType.Indexer; } else { result.MemberName = doc.ParsedName.Name; } if (doc.ParsedName.Left != null) { result.DeclaringType = ConvertToType(doc.ParsedName.Left); } else if (doc.ParsedBuiltinType != null) { result.DeclaringType = ConvertToType(doc.ParsedBuiltinType); } if (doc.ParsedName.TypeParameters != null) { for (int i = 0; i < doc.ParsedName.TypeParameters.Count; i++) { result.TypeArguments.Add(ConvertToType(doc.ParsedName.TypeParameters[i])); } } } else if (doc.ParsedBuiltinType != null) { result.EntityType = EntityType.TypeDefinition; result.DeclaringType = ConvertToType(doc.ParsedBuiltinType); } if (doc.ParsedParameters != null) { result.HasParameterList = true; result.Parameters.AddRange(doc.ParsedParameters.Select(ConvertXmlDocParameter)); } if (doc.ParsedOperator != null) { result.EntityType = EntityType.Operator; result.OperatorType = (OperatorType)doc.ParsedOperator; if (result.OperatorType == OperatorType.Implicit || result.OperatorType == OperatorType.Explicit) { var returnTypeParam = result.Parameters.LastOrNullObject(); returnTypeParam.Remove(); // detach from parameter list var returnType = returnTypeParam.Type; returnType.Remove(); result.ConversionOperatorReturnType = returnType; } if (result.Parameters.Count == 0) { // reset HasParameterList if necessary result.HasParameterList = false; } } return result; }
public bool Compile(out AssemblyBuilder assembly, AppDomain domain, bool generateInMemory) { // Get the current settings CompilerSettings settings = context.Settings; // Set the result for quick exit assembly = null; // Check if any source files were supplied if (settings.FirstSourceFile == null && (((MCSTarget)settings.Target == MCSTarget.Exe || (MCSTarget)settings.Target == MCSTarget.WinExe || (MCSTarget)settings.Target == MCSTarget.Module) || settings.Resources == null)) { Report.Error(2008, "No source files specified"); return(false); } // Check for any invalid settings if (settings.Platform == Platform.AnyCPU32Preferred && ((MCSTarget)settings.Target == MCSTarget.Library || (MCSTarget)settings.Target == MCSTarget.Module)) { Report.Error(4023, "The preferred platform '{0}' is only valid on executable outputs", Platform.AnyCPU32Preferred.ToString()); return(false); } // Create the time reporter TimeReporter time = new TimeReporter(settings.Timestamps); context.TimeReporter = time; time.StartTotal(); // Create the module ModuleContainer module = new ModuleContainer(context); RootContext.ToplevelTypes = module; // Start timing the parse stage time.Start(TimeReporter.TimerType.ParseTotal); { // Begin parse Parse(module); } time.Stop(TimeReporter.TimerType.ParseTotal); // Check for any errors if (Report.Errors > 0) { return(false); } // Check for partial compilation if (settings.TokenizeOnly == true || settings.ParseOnly == true) { time.StopTotal(); time.ShowStats(); return(true); } // Get the output file string output = settings.OutputFile; string outputName = Path.GetFileName(output); // Create an assembly defenition AssemblyDefinitionDynamic defenition = new AssemblyDefinitionDynamic(module, outputName, output); module.SetDeclaringAssembly(defenition); ReflectionImporter importer = new ReflectionImporter(module, context.BuiltinTypes); defenition.Importer = importer; DynamicLoader loader = new DynamicLoader(importer, context); loader.LoadReferences(module); // Validate built in types if (context.BuiltinTypes.CheckDefinitions(module) == false) { return(false); } // Create the assmbly in domain if (defenition.Create(domain, AssemblyBuilderAccess.RunAndSave) == false) { return(false); } module.CreateContainer(); loader.LoadModules(defenition, module.GlobalRootNamespace); module.InitializePredefinedTypes(); // Check for any resource strings if (settings.GetResourceStrings != null) { module.LoadGetResourceStrings(settings.GetResourceStrings); } // Time the module defenition time.Start(TimeReporter.TimerType.ModuleDefinitionTotal); { try { // Begin defining module.Define(); } catch { // Failed to define module return(false); } } time.Stop(TimeReporter.TimerType.ModuleDefinitionTotal); // Check for any errors if (Report.Errors > 0) { return(false); } // Check for documentation if (settings.DocumentationFile != null) { // Build the xml docs file DocumentationBuilder docs = new DocumentationBuilder(module); docs.OutputDocComment(output, settings.DocumentationFile); } defenition.Resolve(); // Check for documentation errors if (Report.Errors > 0) { return(false); } // Finally emit the defenition into something useful time.Start(TimeReporter.TimerType.EmitTotal); { // Emit assembly defenition.Emit(); } time.Stop(TimeReporter.TimerType.EmitTotal); // Check for any emit errors if (Report.Errors > 0) { return(false); } // Module cleanup time.Start(TimeReporter.TimerType.CloseTypes); { module.CloseContainer(); } time.Stop(TimeReporter.TimerType.CloseTypes); // Check for embedded resources time.Start(TimeReporter.TimerType.Resouces); { if (settings.WriteMetadataOnly == false) { defenition.EmbedResources(); } } time.Stop(TimeReporter.TimerType.Resouces); // Embedd errors if (Report.Errors > 0) { return(false); } // Check for generate in memory if (generateInMemory == false) { defenition.Save(); } // Store the result assembly = defenition.Builder; time.StopTotal(); time.ShowStats(); // Check for errors return(Report.Errors == 0); }
// // Main compilation method // public bool Compile(out AssemblyBuilder outAssembly, AppDomain domain, bool generateInMemory) { var settings = ctx.Settings; outAssembly = null; // // If we are an exe, require a source file for the entry point or // if there is nothing to put in the assembly, and we are not a library // if (settings.FirstSourceFile == null && ((settings.Target == Target.Exe || settings.Target == Target.WinExe || settings.Target == Target.Module) || settings.Resources == null)) { Report.Error(2008, "No files to compile were specified"); return(false); } if (settings.Platform == Platform.AnyCPU32Preferred && (settings.Target == Target.Library || settings.Target == Target.Module)) { Report.Error(4023, "Platform option `anycpu32bitpreferred' is valid only for executables"); return(false); } TimeReporter tr = new TimeReporter(settings.Timestamps); ctx.TimeReporter = tr; tr.StartTotal(); var module = new ModuleContainer(ctx); RootContext.ToplevelTypes = module; tr.Start(TimeReporter.TimerType.ParseTotal); Parse(module); tr.Stop(TimeReporter.TimerType.ParseTotal); if (Report.Errors > 0) { return(false); } if (settings.TokenizeOnly || settings.ParseOnly) { tr.StopTotal(); tr.ShowStats(); return(true); } var output_file = settings.OutputFile; string output_file_name; /* if (output_file == null) * { * var source_file = settings.FirstSourceFile; * * if (source_file == null) * { * Report.Error(1562, "If no source files are specified you must specify the output file with -out:"); * return false; * } * * output_file_name = source_file.Name; * int pos = output_file_name.LastIndexOf('.'); * * if (pos > 0) * output_file_name = output_file_name.Substring(0, pos); * * output_file_name += settings.TargetExt; * output_file = output_file_name; * } * else * {*/ output_file_name = Path.GetFileName(output_file); /* if (string.IsNullOrEmpty(Path.GetFileNameWithoutExtension(output_file_name)) || * output_file_name.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0) * { * Report.Error(2021, "Output file name is not valid"); * return false; * } * }*/ var assembly = new AssemblyDefinitionDynamic(module, output_file_name, output_file); module.SetDeclaringAssembly(assembly); var importer = new ReflectionImporter(module, ctx.BuiltinTypes); assembly.Importer = importer; var loader = new DynamicLoader(importer, ctx); loader.LoadReferences(module); if (!ctx.BuiltinTypes.CheckDefinitions(module)) { return(false); } if (!assembly.Create(domain, AssemblyBuilderAccess.RunAndSave)) { return(false); } module.CreateContainer(); loader.LoadModules(assembly, module.GlobalRootNamespace); module.InitializePredefinedTypes(); if (settings.GetResourceStrings != null) { module.LoadGetResourceStrings(settings.GetResourceStrings); } tr.Start(TimeReporter.TimerType.ModuleDefinitionTotal); module.Define(); tr.Stop(TimeReporter.TimerType.ModuleDefinitionTotal); if (Report.Errors > 0) { return(false); } if (settings.DocumentationFile != null) { var doc = new DocumentationBuilder(module); doc.OutputDocComment(output_file, settings.DocumentationFile); } assembly.Resolve(); if (Report.Errors > 0) { return(false); } tr.Start(TimeReporter.TimerType.EmitTotal); assembly.Emit(); tr.Stop(TimeReporter.TimerType.EmitTotal); if (Report.Errors > 0) { return(false); } tr.Start(TimeReporter.TimerType.CloseTypes); module.CloseContainer(); tr.Stop(TimeReporter.TimerType.CloseTypes); tr.Start(TimeReporter.TimerType.Resouces); if (!settings.WriteMetadataOnly) { assembly.EmbedResources(); } tr.Stop(TimeReporter.TimerType.Resouces); if (Report.Errors > 0) { return(false); } if (!generateInMemory) { assembly.Save(); } outAssembly = assembly.Builder; tr.StopTotal(); tr.ShowStats(); return(Report.Errors == 0); }
internal override void GenerateDocComment (DocumentationBuilder builder) { if (IsPartialPart) return; base.GenerateDocComment (builder); foreach (var member in members) member.GenerateDocComment (builder); }
internal override void GenerateDocComment (DocumentationBuilder builder) { if (containers != null) { foreach (var tc in containers) tc.GenerateDocComment (builder); } }
public CompilerResults compileFromCompilationUnits(CompilerParameters parameters, CompilationUnitNode[] compilationUnits) { var results = new CompilerResults(); this.context = new CompilerContext(parameters, results); this.statementValidator = new StatementValidator(this.context); this.expressionValidator = new ExpressionValidator(this.context); this.statementValidator.ExpressionValidator = this.expressionValidator; this.expressionValidator.StatementValidator = this.statementValidator; this.reachabilityChecker = new ReachabilityChecker(context); this.assignmentChecker = new AssignmentChecker(context); this.bytecodeGenerator = new BytecodeGenerator(context); foreach (var cu in compilationUnits) { context.CompilationUnits.add(cu); } doCompile(); this.context = null; this.statementValidator = null; this.expressionValidator = null; this.reachabilityChecker = null; this.assignmentChecker = null; this.queryTranslator = null; this.documentationBuilder = null; if (parameters.ProgressTracker != null) { parameters.ProgressTracker.compilationFinished(); } return results; }
public CompilerResults compileFromFiles(CompilerParameters parameters, File[] files) { var results = new CompilerResults(); this.context = new CompilerContext(parameters, results); this.statementValidator = new StatementValidator(this.context); this.expressionValidator = new ExpressionValidator(this.context); this.statementValidator.ExpressionValidator = this.expressionValidator; this.expressionValidator.StatementValidator = this.statementValidator; this.reachabilityChecker = new ReachabilityChecker(context); this.assignmentChecker = new AssignmentChecker(context); this.bytecodeGenerator = new BytecodeGenerator(context); bool tragicError = false; var buffer = new char[4096]; var sb = new StringBuilder(); var parser = new Parser(); foreach (var file in files) { sb.setLength(0); InputStreamReader reader = null; try { reader = new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")); int read; while ((read = reader.read(buffer)) != -1) { sb.append(buffer, 0, read); } var text = new char[sb.length()]; sb.getChars(0, sizeof(text), text, 0); if (sizeof(text) > 0) { if (text[sizeof(text) - 1] == '\u001a') { text[sizeof(text) - 1] = ' '; } } var preprocessor = new Preprocessor(results.codeErrorManager, text); preprocessor.Filename = file.getAbsolutePath(); preprocessor.Symbols.addAll(parameters.Symbols); var scanner = new PreprocessedTextScanner(results.codeErrorManager, preprocessor.preprocess()); scanner.Filename = file.getAbsolutePath(); var compilationUnit = parser.parseCompilationUnit(scanner); if (compilationUnit != null) { compilationUnit.Symbols = preprocessor.Symbols; context.CompilationUnits.add(compilationUnit); } } catch (CodeErrorException) { } catch (Exception e) { e.printStackTrace(); tragicError = true; break; } finally { if (reader != null) { try { reader.close(); } catch (IOException) { } } } } if (!tragicError) { if (!context.HasErrors) { if (parameters.ProgressTracker != null) { parameters.ProgressTracker.compilationStageFinished(CompilationStage.Parsing); } doCompile(); } } this.context = null; this.statementValidator = null; this.expressionValidator = null; this.reachabilityChecker = null; this.assignmentChecker = null; this.queryTranslator = null; this.documentationBuilder = null; if (parameters.ProgressTracker != null) { parameters.ProgressTracker.compilationFinished(); } return results; }
// // Main compilation method // public bool Compile () { var settings = ctx.Settings; // // If we are an exe, require a source file for the entry point or // if there is nothing to put in the assembly, and we are not a library // if (settings.FirstSourceFile == null && ((settings.Target == Target.Exe || settings.Target == Target.WinExe || settings.Target == Target.Module) || settings.Resources == null)) { Report.Error (2008, "No files to compile were specified"); return false; } if (settings.Platform == Platform.AnyCPU32Preferred && (settings.Target == Target.Library || settings.Target == Target.Module)) { Report.Error (4023, "Platform option `anycpu32bitpreferred' is valid only for executables"); return false; } TimeReporter tr = new TimeReporter (settings.Timestamps); ctx.TimeReporter = tr; tr.StartTotal (); var module = new ModuleContainer (ctx); RootContext.ToplevelTypes = module; tr.Start (TimeReporter.TimerType.ParseTotal); Parse (module); tr.Stop (TimeReporter.TimerType.ParseTotal); if (Report.Errors > 0) return false; if (settings.TokenizeOnly || settings.ParseOnly) { tr.StopTotal (); tr.ShowStats (); return true; } var output_file = settings.OutputFile; string output_file_name; if (output_file == null) { var source_file = settings.FirstSourceFile; if (source_file == null) { Report.Error (1562, "If no source files are specified you must specify the output file with -out:"); return false; } output_file_name = source_file.Name; int pos = output_file_name.LastIndexOf ('.'); if (pos > 0) output_file_name = output_file_name.Substring (0, pos); output_file_name += settings.TargetExt; output_file = output_file_name; } else { output_file_name = Path.GetFileName (output_file); if (string.IsNullOrEmpty (Path.GetFileNameWithoutExtension (output_file_name)) || output_file_name.IndexOfAny (Path.GetInvalidFileNameChars ()) >= 0) { Report.Error (2021, "Output file name is not valid"); return false; } } #if STATIC var importer = new StaticImporter (module); var references_loader = new StaticLoader (importer, ctx); tr.Start (TimeReporter.TimerType.AssemblyBuilderSetup); var assembly = new AssemblyDefinitionStatic (module, references_loader, output_file_name, output_file); assembly.Create (references_loader.Domain); tr.Stop (TimeReporter.TimerType.AssemblyBuilderSetup); // Create compiler types first even before any referenced // assembly is loaded to allow forward referenced types from // loaded assembly into compiled builder to be resolved // correctly tr.Start (TimeReporter.TimerType.CreateTypeTotal); module.CreateContainer (); importer.AddCompiledAssembly (assembly); tr.Stop (TimeReporter.TimerType.CreateTypeTotal); references_loader.LoadReferences (module); tr.Start (TimeReporter.TimerType.PredefinedTypesInit); if (!ctx.BuiltinTypes.CheckDefinitions (module)) return false; tr.Stop (TimeReporter.TimerType.PredefinedTypesInit); references_loader.LoadModules (assembly, module.GlobalRootNamespace); #else var assembly = new AssemblyDefinitionDynamic (module, output_file_name, output_file); module.SetDeclaringAssembly (assembly); var importer = new ReflectionImporter (module, ctx.BuiltinTypes); assembly.Importer = importer; var loader = new DynamicLoader (importer, ctx); loader.LoadReferences (module); if (!ctx.BuiltinTypes.CheckDefinitions (module)) return false; if (!assembly.Create (AppDomain.CurrentDomain, AssemblyBuilderAccess.Save)) return false; module.CreateContainer (); loader.LoadModules (assembly, module.GlobalRootNamespace); #endif module.InitializePredefinedTypes (); tr.Start (TimeReporter.TimerType.ModuleDefinitionTotal); module.Define (); tr.Stop (TimeReporter.TimerType.ModuleDefinitionTotal); if (Report.Errors > 0) return false; if (settings.DocumentationFile != null) { var doc = new DocumentationBuilder (module); doc.OutputDocComment (output_file, settings.DocumentationFile); } assembly.Resolve (); if (Report.Errors > 0) return false; tr.Start (TimeReporter.TimerType.EmitTotal); assembly.Emit (); tr.Stop (TimeReporter.TimerType.EmitTotal); if (Report.Errors > 0){ return false; } tr.Start (TimeReporter.TimerType.CloseTypes); module.CloseContainer (); tr.Stop (TimeReporter.TimerType.CloseTypes); tr.Start (TimeReporter.TimerType.Resouces); if (!settings.WriteMetadataOnly) assembly.EmbedResources (); tr.Stop (TimeReporter.TimerType.Resouces); if (Report.Errors > 0) return false; assembly.Save (); #if STATIC references_loader.Dispose (); #endif tr.StopTotal (); tr.ShowStats (); return Report.Errors == 0; }
private System.String packageName; // Represents the Package that this Segment will go in /// <summary>This constructor will create a new ConformancePrimitiveBuilder</summary> public ConformancePrimitiveBuilder(System.String packageName, DeploymentManager depManager):base() { this.packageName = packageName; this.docBuilder = DocumentationBuilder.getDocumentationBuilder(); this.depManager = depManager; }
// // Generates xml doc comments (if any), and if required, // handle warning report. // internal virtual void GenerateDocComment (DocumentationBuilder builder) { if (DocComment == null) { if (IsExposedFromAssembly ()) { Constructor c = this as Constructor; if (c == null || !c.IsDefault ()) Report.Warning (1591, 4, Location, "Missing XML comment for publicly visible type or member `{0}'", GetSignatureForError ()); } return; } try { builder.GenerateDocumentationForMember (this); } catch (Exception e) { throw new InternalErrorException (this, e); } }