当前位置: 首页>>代码示例>>C#>>正文


C# ILine.IsReference方法代码示例

本文整理汇总了C#中ILine.IsReference方法的典型用法代码示例。如果您正苦于以下问题:C# ILine.IsReference方法的具体用法?C# ILine.IsReference怎么用?C# ILine.IsReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILine的用法示例。


在下文中一共展示了ILine.IsReference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetOutline

        private static void GetOutline(ILine line, List<ILine> OutputLines, ProcessedFile pf)
        {
            var statement = line as IOpenBraceStatement;
            if (statement == null)
            {
                if (line.IsReference())
                {
                    var refStatement = new ReferenceStatement(
                        Line: line,
                        ClientSideReference: line.GetReferencePath()
                    );
                    //var refStatement = line.ToReferenceStatement();
                    pf.References[refStatement.ClientSideReference] = refStatement;
                    OutputLines.Add(refStatement);
                }
                else
                {
                    OutputLines.Add(line);
                }
                return;
            }
            bool recurse = true;
            if (statement.IsInterface())
            {
                //var interfaceStatement = statement.ToInterface();
                var interfaceStatement = new Interface(
                    OpenBraceStatementBase: statement,
                    LiveStatementBase: statement.LiveStatementBase,
                    Line: statement.Line,
                    Name: statement.GetInterfaceName()
                );
                pf.Interfaces[interfaceStatement.Name] = interfaceStatement;
                interfaceStatement.Process();
                statement = interfaceStatement as IOpenBraceStatement;
                recurse = false;
            }
            else if (statement.IsFunction())
            {
                //var functionStatement = statement.ToFunction();
                var functionStatement = new StaticFunction(
                    OpenBraceStatementBase: statement,
                    LiveStatementBase:  statement.LiveStatementBase,
                    Line: statement.Line,
                    Name:  statement.GetFunctionName()
                );
                string functionName = functionStatement.GetFullName();
                pf.Functions[functionName] = functionStatement;
            }
            else if (statement.IsClass())
            {
                var classStatement = new Class(
                    OpenBraceStatementBase: statement,
                    LiveStatementBase: statement.LiveStatementBase,
                    Line: statement.Line,
                    Name: statement.GetClassName()
                );
                pf.Classes[classStatement.Name] = classStatement;
                statement = classStatement;
            }
            else if (statement.IsModule())
            {
                //var moduleStatement = statement.ToModule();
                var moduleStatement = new Module(
                    OpenBraceStatementBase: statement,
                    LiveStatementBase: statement.LiveStatementBase,
                    Line: statement.Line,
                    FullName: statement.FrontTrimmedLiveStatement.Trim('{').Trim()
                );
                pf.Modules[moduleStatement.FullName] = moduleStatement;
                statement = moduleStatement;
            }

            OutputLines.Add(statement);
            if (statement.Children != null && recurse)
            {
                var newc = new List<ILine>();
                foreach (var childLine in statement.Children)
                {
                    GetOutline(childLine, newc, pf);
                }
                statement.Children = newc;
            }
        }
开发者ID:bahrus,项目名称:teaspoon,代码行数:83,代码来源:TypeStrictInterpreter.cs


注:本文中的ILine.IsReference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。