Example #1
0
        private void ProcessModuleProperty(TypeScriptContext tsc, ModuleDeclaration md, HtmlNode h, string sn)
        {
            var div = h.ParentNode;

            var typeText = div.SelectSingleNode("*[@class='type-signature']")?.InnerText.Trim();

            var vd = new VariableDeclaration()
            {
                IsConstant   = div.SelectSingleNode("div/span[@class='label label-constant']") != null,
                Name         = sn,
                VariableType = string.IsNullOrEmpty(typeText) ? BuiltinType.Any : ResolveType(tsc, typeText).Type
            };
            var dsc = div.SelectNodes("p[not(@class)]").SanitizeDocumentation();

            if (dsc != null)
            {
                vd.Documentation = new Documentation()
                {
                    Summary = dsc
                };
            }
            md.Statements.Add(vd);

            StatementParsed?.Invoke(this, new StatementEventArgs(vd));
        }
Example #2
0
        private void ProcessModuleMethod(TypeScriptContext tsc, ModuleDeclaration md, HtmlNode h, string sn)
        {
            var div = h.ParentNode;
            var fd  = new FunctionDeclaration();

            ProcessFunctionCore(tsc, sn, div, fd);
            md.Statements.Add(fd);

            StatementParsed?.Invoke(this, new StatementEventArgs(fd));
        }