• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# node.AMethodDecl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



AMethodDecl类属于Galaxy_Editor_2.Compiler.Generated.node命名空间,在下文中一共展示了AMethodDecl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CaseAMethodDecl

 public override void CaseAMethodDecl(AMethodDecl node)
 {
     currentMethod = node;
     dependancies[node] = new List<AMethodDecl>();
     base.CaseAMethodDecl(node);
     currentMethod = null;
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:7,代码来源:PointerNullFixes.cs


示例2: Create

 public static ControlFlowGraph Create(AMethodDecl method)
 {
     ControlFlowGraph graph = new ControlFlowGraph(method);
     CFGGenerator generator = new CFGGenerator();
     method.GetBlock().Apply(generator);
     graph.Nodes = new List<Node>(generator.Nodes.Count);
     graph.Nodes.AddRange(generator.Nodes);
     return graph;
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:9,代码来源:ControlFlowGraph.cs


示例3: CaseAMethodDecl

 public override void CaseAMethodDecl(AMethodDecl node)
 {
     if (parsedMethods.Contains(node) || methodChain.Contains(node))
         return;
     methodChain.Add(node);
     NeededRefs.Add(node, new List<AALocalDecl>());
     base.CaseAMethodDecl(node);
     methodChain.Remove(node);
     parsedMethods.Add(node);
     foreach (AALocalDecl formal in node.GetFormals())
     {
         if (formal.GetRef() != null && !NeededRefs[node].Contains(formal) && !Util.IsBulkCopy(formal.GetType()))
             formal.SetRef(null);
     }
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:15,代码来源:RemoveUnnededRef.cs


示例4: MethodDescription

        public MethodDescription(AConstructorDecl method, string type)
        {
            Parser parser = new Parser(method);

            Start = parser.Start;
            End = parser.End;
            ReturnType = type;
            Name = parser.Name;
            Formals = parser.Formals;
            Locals = parser.Locals;
            if (method.Parent() != null)
                method.Parent().RemoveChild(method);
            Decl = new AMethodDecl(new APublicVisibilityModifier(), null, null, null, null, null, new ANamedType(new TIdentifier(type), null),
                                   new TIdentifier(""), new ArrayList(), method.GetBlock());
            while (method.GetFormals().Count > 0)
                Decl.GetFormals().Add(method.GetFormals()[0]);
            Visibility = method.GetVisibilityModifier();
            Position = TextPoint.FromCompilerCoords(method.GetName());
        }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:19,代码来源:MethodDescription.cs


示例5: CaseAMethodDecl

        public override void CaseAMethodDecl(AMethodDecl node)
        {
            if (data.AllowPrintouts)
                Form1.Form.SetStatusText(prefix + " [" + ++methodNr + "/" + methodCount + " " + node.GetName().Text + "]");
            if (node.GetName().Text.Contains("t2"))
                node = node;
            //Move locals to the start
            node.Apply(new MoveLocalsToStart(finalTrans.data));
            bool changes = true;
            while (changes)
            {
                changes = false;

                //Remove foo = foo
                RemoveSelfAssignments.Parse(node, data);

                //Create cfg
                ControlFlowGraph cfg = ControlFlowGraph.Create(node);
                RemoveDeadCode.Parse(cfg);
                LivenessAnalysis.CalculateLiveVariables(cfg, data);
                bool redoLivenessAnalysis;
                changes |= RemoveUnusedAssignments.Parse(cfg, data, out redoLivenessAnalysis);
                if (redoLivenessAnalysis)
                    LivenessAnalysis.CalculateLiveVariables(cfg, data);
                changes |= VariableJoiner.Parse(cfg, data);
                //This phase doesn't use liveness analysis
                changes |= RemoveUnusedLocals.Parse(cfg, data);

                while (true)
                {
                    bool changed = RemoveSingleUsedAssignments.Parse(cfg, data);
                    if (changed)
                    {
                        changes = true;
                        LivenessAnalysis.CalculateLiveVariables(cfg, data);
                        continue;
                    }
                    break;
                }

                changes |= StatementRemover.Parse(node);
            }
        }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:43,代码来源:OptimizePhase.cs


示例6: CaseAMethodDecl

 public override void CaseAMethodDecl(AMethodDecl node)
 {
     if (node.GetName().Text == "InitMap" && node.GetFormals().Count == 0)
     {
         if (finalTrans.multipleMainEntries)
         {
             multipleEntryCandidates.Add(new ErrorCollection.Error(node.GetName(), Util.GetAncestor<AASourceFile>(node.GetName()), LocRM.GetString("ErrorText63")));
         }
         else if (finalTrans.mainEntry != null)
         {
             multipleEntryCandidates.Add(new ErrorCollection.Error(finalTrans.mainEntry.GetName(), Util.GetAncestor<AASourceFile>(finalTrans.mainEntry.GetName()), LocRM.GetString("ErrorText63")));
             multipleEntryCandidates.Add(new ErrorCollection.Error(node.GetName(), Util.GetAncestor<AASourceFile>(node.GetName()), LocRM.GetString("ErrorText63")));
             //finalTrans.errors.Add(new ErrorCollection.Error(node.GetName(), Util.GetAncestor<AASourceFile>(node), "Found multiple candidates for a main entry", true));
             finalTrans.multipleMainEntries = true;
             finalTrans.mainEntry = null;
         }
         else
             finalTrans.mainEntry = node;
     }
     base.CaseAMethodDecl(node);
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:21,代码来源:MainEntryFinder.cs


示例7: CaseAMethodDecl

        public override void CaseAMethodDecl(AMethodDecl node)
        {
            if (node.GetInline() == null)
                return;

            //Variables marked as out can be made into ref
            foreach (AALocalDecl formal in node.GetFormals())
            {
                if (formal.GetOut() != null)
                {
                    formal.SetRef(new TRef("ref"));
                    formal.SetOut(null);
                }
            }
            assignedToLocals.Clear();
            base.CaseAMethodDecl(node);

            foreach (AALocalDecl formal in node.GetFormals())
            {
                if (!assignedToLocals.Contains(formal))
                    formal.SetRef(new TRef("ref"));
            }
        }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:23,代码来源:AddUnneededRef.cs


示例8: CaseAMethodDecl

        public override void CaseAMethodDecl(AMethodDecl node)
        {
            if (node.GetNative() == null && node.GetBlock() == null)
                return;
            if (node.GetStatic() != null)
                return;

            string inputStr = "native " + TypeToString(node.GetReturnType()) + " " + node.GetName().Text +
                                 "(";
            bool first = true;
            foreach (AALocalDecl formal in node.GetFormals())
            {
                if (!first)
                    inputStr += ", ";
                inputStr += TypeToString(formal.GetType()) + " " + formal.GetName().Text;
                first = false;
            }
            inputStr += ");";

            writer.WriteLine(inputStr);

            AStructDecl str = Util.GetAncestor<AStructDecl>(node);
            List<AMethodDecl> methodList;
            if (str != null)
                methodList = StructMethods[str];
            else
                methodList = Methods;
            string sig = Util.GetMethodSignature(node);
            if (methodList.Any(otherMethod => Util.GetMethodSignature(otherMethod) == sig))
            {
                return;
            }

            methodList.Add(node);
            node.SetBlock(null);
            node.Parent().RemoveChild(node);
        }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:37,代码来源:LibraryData.cs


示例9: LocalDecl

 public LocalDecl(AALocalDecl decl, AMethodDecl parentMethod)
 {
     Decl = decl;
     ParentMethod = parentMethod;
     if (Name.StartsWith("_"))
         Name = "u" + Name;
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:7,代码来源:MakeUniqueNamesV2.cs


示例10: MethodDecl

 public MethodDecl(AMethodDecl decl)
 {
     Decl = decl;
     if (Name.StartsWith("_"))
         Name = "u" + Name;
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:6,代码来源:MakeUniqueNamesV2.cs


示例11: Formals_Cast

 internal Formals_Cast(AMethodDecl obj)
 {
     this.obj = obj;
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:4,代码来源:prods.cs


示例12: OutAMethodDecl

 public override void OutAMethodDecl(AMethodDecl node)
 {
     node.GetName().Text = node.GetName().Text.Replace("+", "Plus");
     node.GetName().Text = node.GetName().Text.Replace("+", "Plus");
     node.GetName().Text = node.GetName().Text.Replace("-", "Minus");
     node.GetName().Text = node.GetName().Text.Replace("*", "Mul");
     node.GetName().Text = node.GetName().Text.Replace("/", "Div");
     node.GetName().Text = node.GetName().Text.Replace("%", "Mod");
     node.GetName().Text = node.GetName().Text.Replace("==", "Equals");
     node.GetName().Text = node.GetName().Text.Replace("!=", "NotEquals");
     node.GetName().Text = node.GetName().Text.Replace("<", "LessThan");
     node.GetName().Text = node.GetName().Text.Replace("<=", "LessThanOrEqual");
     node.GetName().Text = node.GetName().Text.Replace(">", "GreaterThan");
     node.GetName().Text = node.GetName().Text.Replace(">=", "GreaterThanOrEqual");
     node.GetName().Text = node.GetName().Text.Replace("&", "And");
     node.GetName().Text = node.GetName().Text.Replace("|", "Or");
     node.GetName().Text = node.GetName().Text.Replace("^", "Xor");
     node.GetName().Text = node.GetName().Text.Replace("<<", "ShiftLeft");
     node.GetName().Text = node.GetName().Text.Replace(">>", "ShiftRight");
     decls.AddLast(new MethodDecl(node));
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:21,代码来源:MakeUniqueNamesV2.cs


示例13: CaseAMethodDecl

            public override void CaseAMethodDecl(AMethodDecl node)
            {
                End = Start = TextPoint.FromCompilerCoords(node.GetName().Line, node.GetName().Pos);
                ReturnType = Util.TypeToString(node.GetReturnType());
                Name = node.GetName().Text;

                base.CaseAMethodDecl(node);
            }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:8,代码来源:MethodDescription.cs


示例14: OutAMethodDecl

 //Rename trigger refferences
 public override void OutAMethodDecl(AMethodDecl node)
 {
     if (finalTrans.data.TriggerDeclarations.ContainsKey(node))
     {
         foreach (TStringLiteral stringLiteral in finalTrans.data.TriggerDeclarations[node])
         {
             stringLiteral.Text = "\"" + node.GetName().Text + "\"";
         }
     }
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:11,代码来源:RenameRefferences.cs


示例15: OutAMethodDecl

 public override void OutAMethodDecl(AMethodDecl node)
 {
     currentMethod = null;
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:4,代码来源:LocalChecker.cs


示例16: OutAAProgram

        public override void OutAAProgram(AAProgram node)
        {
            if (strings.Count == 0)
                return;

            //Obfuscate all strings
            List<string> obfuscated = new List<string>();
            foreach (AStringConstExp stringConstExp in strings)
            {
                TStringLiteral token = stringConstExp.GetStringLiteral();
                string s = token.Text.Substring(1, token.Text.Length - 2);
                obfuscated.Add(Obfuscate(s));
            }

            //Set invokes instead of string constants, and move varaiabes down
            List<AFieldDecl> ignoredFields = new List<AFieldDecl>();
            List<AFieldDecl> moveFieldsIn = new List<AFieldDecl>();
            Dictionary<AFieldDecl, AMethodDecl> fieldMethods = new Dictionary<AFieldDecl, AMethodDecl>();
            for (int i = 0; i < strings.Count; i++)
            {
                AStringConstExp stringExp = strings[i];
                Token token = stringExp.GetStringLiteral();
                bool inDeobfuscator = Util.GetAncestor<AMethodDecl>(stringExp) == finalTrans.data.DeobfuscateMethod;

                if (inDeobfuscator)
                {
                    AFieldDecl field = finalTrans.data.UnobfuscatedStrings[stringExp];

                    AStringConstExp newStringConst = new AStringConstExp(stringExp.GetStringLiteral());

                    field.SetInit(newStringConst);

                    AFieldLvalue fieldRef = new AFieldLvalue(new TIdentifier(field.GetName().Text, token.Line, token.Pos));
                    finalTrans.data.FieldLinks[fieldRef] = field;

                    stringExp.ReplaceBy(new ALvalueExp(fieldRef));
                }
                else
                {
                    AFieldDecl field;
                    if (!finalTrans.data.ObfuscatedStrings.ContainsKey(stringExp))
                    {
                        int line = -finalTrans.data.ObfuscatedStrings.Count - 1;
                        field = new AFieldDecl(new APublicVisibilityModifier(), null, new TConst("const", line, 0),
                                                new ANamedType(new TIdentifier("string", line, 1), null),
                                                new TIdentifier("Galaxy_pp_stringO" +
                                                                finalTrans.data.ObfuscatedStrings.Count), null);
                        //If the strings are the same - point them to same field
                        bool newField = true;
                        foreach (AStringConstExp oldStringConstExp in finalTrans.data.ObfuscatedStrings.Keys)
                        {
                            if (stringExp.GetStringLiteral().Text == oldStringConstExp.GetStringLiteral().Text)
                            {
                                field = finalTrans.data.ObfuscatedStrings[oldStringConstExp];
                                newField = false;
                                break;
                            }
                        }
                        if (newField)
                        {
                            AASourceFile file = (AASourceFile)finalTrans.data.DeobfuscateMethod.Parent();
                            file.GetDecl().Insert(file.GetDecl().IndexOf(finalTrans.data.DeobfuscateMethod) + 1, field);

                            finalTrans.data.Fields.Add(new SharedData.DeclItem<AFieldDecl>(file, field));
                        }
                        finalTrans.data.ObfuscatedStrings.Add(stringExp, field);

                    }
                    field = finalTrans.data.ObfuscatedStrings[stringExp];
                    string obfuscatedString = obfuscated[i];

                    ASimpleInvokeExp invoke = new ASimpleInvokeExp();
                    invoke.SetName(new TIdentifier(finalTrans.data.DeobfuscateMethod.GetName().Text,
                                                   stringExp.GetStringLiteral().Line,
                                                   stringExp.GetStringLiteral().Pos));

                    AStringConstExp newStringConst =
                        new AStringConstExp(new TStringLiteral("\"" + obfuscatedString + "\""));
                    invoke.GetArgs().Add(newStringConst);
                    finalTrans.data.SimpleMethodLinks[invoke] = finalTrans.data.DeobfuscateMethod;

                    if (Util.GetAncestor<PStm>(stringExp) == null && false)
                    {
                        ignoredFields.Add(field);
                        /*if (Util.GetAncestor<ASimpleInvokeExp>(stringExp) == null)
                            stringExp.ReplaceBy(invoke);*/
                        //Add obfuscate call to this location);
                        continue;
                        /*ASimpleInvokeExp invoke = new ASimpleInvokeExp();
                        invoke.SetName(new TIdentifier(finalTrans.data.DeobfuscateMethod.GetName().Text,
                                                       stringExp.GetStringLiteral().Line,
                                                       stringExp.GetStringLiteral().Pos));

                        AStringConstExp newStringConst =
                            new AStringConstExp(new TStringLiteral("\"" + obfuscatedString + "\""));
                        invoke.GetArgs().Add(newStringConst);
                        stringExp.ReplaceBy(invoke);

                        finalTrans.data.SimpleMethodLinks[invoke] = finalTrans.data.DeobfuscateMethod;
                        continue;*/
//.........这里部分代码省略.........
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:101,代码来源:ObfuscateStrings.cs


示例17: InAMethodDecl

 public virtual void InAMethodDecl(AMethodDecl node)
 {
     DefaultIn(node);
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:4,代码来源:analysis.cs


示例18: MethodAnalyzer

 public MethodAnalyzer(AMethodDecl method, Dictionary<AMethodDecl, SafeVariablesData> methods, SharedData data)
 {
     this.method = method;
     this.data = data;
     this.methods = methods;
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:6,代码来源:PointerNullFixes.cs


示例19: ControlFlowGraph

 private ControlFlowGraph(AMethodDecl method)
 {
     Method = method;
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:4,代码来源:ControlFlowGraph.cs


示例20: OutAMethodDecl

 public virtual void OutAMethodDecl(AMethodDecl node)
 {
     DefaultOut(node);
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:4,代码来源:analysis.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# node.Node类代码示例发布时间:2022-05-26
下一篇:
C# node.ALvalueExp类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap