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


C# Node.GetType方法代码示例

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


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

示例1: DefaultIn

 public override void DefaultIn(Node node)
 {
     if (node == Parent)
         return;
     if (node.Parent() != Parent)
         return;
     if (childFound)
         return;
     if (Child.GetType() == node.GetType())
     {
         if (index == Index)
         {
             Child = node;
             childFound = true;
         }
         else
             index++;
     }
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:19,代码来源:CloneMethod.cs

示例2: DefaultIn

        public override void DefaultIn(Node node)
        {
            if (!canMerge)
                return;
            if (node is AMethodDecl)
            {
                //First node - no need to fetch
                if (((AMethodDecl)node).GetFormals().Count != ((AMethodDecl)otherNode).GetFormals().Count)
                {
                    canMerge = false;
                }
                return;
            }
            //Fetch corrosponding other node
            int index = 0;
            GetChildTypeIndex getChildTypeIndex = new GetChildTypeIndex() { Parent = node.Parent(), Child = node };
            node.Parent().Apply(getChildTypeIndex);
            index = getChildTypeIndex.Index;
            GetChildTypeByIndex getChildTypeByIndex = new GetChildTypeByIndex() { Child = node, Index = index, Parent = otherNode };
            otherNode.Apply(getChildTypeByIndex);
            otherNode = getChildTypeByIndex.Child;

            if (otherNode.GetType() != node.GetType())
            {
                canMerge = false;
                return;
            }

            if (node is AALocalDecl)
            {
                locals.Add((AALocalDecl) node);
                otherLocals.Add((AALocalDecl) otherNode);
                return;
            }

            if (node is ANamedType)
            {
                ANamedType aNode = (ANamedType) node;
                ANamedType aOther = (ANamedType) otherNode;
                if (data.StructTypeLinks.ContainsKey(aNode) != data.StructTypeLinks.ContainsKey(aOther))
                {
                    canMerge = false;
                    return;
                }
                if (data.StructTypeLinks.ContainsKey(aNode) && data.StructTypeLinks[aNode] != data.StructTypeLinks[aOther])
                {
                    canMerge = false;
                }
                if (!data.StructTypeLinks.ContainsKey(aNode) && aNode.IsSame(aOther, true))//aNode.GetName().Text != aOther.GetName().Text)
                    canMerge = false;
                if (aNode.IsPrimitive() && !aOther.IsPrimitive(aNode.AsIdentifierString()))
                    canMerge = false;
                return;
            }

            if (node is AABlock)
            {
                AABlock aNode = (AABlock)node;
                AABlock aOther = (AABlock)otherNode;
                if (aNode.GetStatements().Count != aOther.GetStatements().Count)
                    canMerge = false;
                return;
            }

            if (node is AIntConstExp)
            {
                AIntConstExp aNode = (AIntConstExp)node;
                AIntConstExp aOther = (AIntConstExp)otherNode;
                if (aNode.GetIntegerLiteral().Text != aOther.GetIntegerLiteral().Text)
                    canMerge = false;
                return;
            }

            if (node is AFixedConstExp)
            {
                AFixedConstExp aNode = (AFixedConstExp)node;
                AFixedConstExp aOther = (AFixedConstExp)otherNode;
                if (aNode.GetFixedLiteral().Text != aOther.GetFixedLiteral().Text)
                    canMerge = false;
                return;
            }

            if (node is AStringConstExp)
            {
                AStringConstExp aNode = (AStringConstExp)node;
                AStringConstExp aOther = (AStringConstExp)otherNode;
                if (aNode.GetStringLiteral().Text != aOther.GetStringLiteral().Text)
                    canMerge = false;
                return;
            }

            if (node is ACharConstExp)
            {
                ACharConstExp aNode = (ACharConstExp)node;
                ACharConstExp aOther = (ACharConstExp)otherNode;
                if (aNode.GetCharLiteral().Text != aOther.GetCharLiteral().Text)
                    canMerge = false;
                return;
            }

//.........这里部分代码省略.........
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:101,代码来源:MergeSameMethods.cs


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