From 8bd4de42a7948ca50d2cda97b746579493734d62 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Sun, 30 Jul 2017 18:52:44 +0200 Subject: [PATCH] Documented FunctionBody class. --- src/Generator.Bind/Structures/Function.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/Generator.Bind/Structures/Function.cs b/src/Generator.Bind/Structures/Function.cs index 81ecdfd..939c4d9 100644 --- a/src/Generator.Bind/Structures/Function.cs +++ b/src/Generator.Bind/Structures/Function.cs @@ -92,12 +92,23 @@ namespace Bind.Structures } } + /// + /// The class acts as a wrapper around a block of source code that makes up the body + /// of a function. + /// public class FunctionBody : List { + /// + /// Initializes an empty . + /// public FunctionBody() { } + /// + /// Initializes a from an existing FunctionBody. + /// + /// The body to copy from. public FunctionBody(FunctionBody fb) { foreach (string s in fb) @@ -108,11 +119,17 @@ namespace Bind.Structures private string indent = ""; + /// + /// Indents this another level. + /// public void Indent() { indent += " "; } + /// + /// Removes a level of indentation from this . + /// public void Unindent() { if (indent.Length > 4) @@ -125,11 +142,19 @@ namespace Bind.Structures } } + /// + /// Adds a line of source code to the body at the current indentation level. + /// + /// The line to add. new public void Add(string s) { base.Add(indent + s.TrimEnd('\r', '\n')); } + /// + /// Adds a range of source code lines to the body at the current indentation level. + /// + /// new public void AddRange(IEnumerable collection) { foreach (string t in collection) @@ -138,6 +163,10 @@ namespace Bind.Structures } } + /// + /// Builds the contents of the function body into a string and encloses it with braces. + /// + /// The body, enclosed in braces. public override string ToString() { if (Count == 0) -- 2.7.4