Example #1
0
        protected void SetFullParamsList(AC_FunctionDeclTree.AC_FunctionDecl func)
        {
            var declaretedVarNames = func.Node_VarDecls.Select(nvd => nvd.Name);
            var funcParamNames     = func.Cur_Node_FunctionDecl.Params;
            var notDeclVarNames    = func.UsedVarNames
                                     .Except(declaretedVarNames)
                                     .Except(funcParamNames);

            if (notDeclVarNames.Count() > 0)
            {
                foreach (var notDeclVarName in notDeclVarNames)
                {
                    func.Cur_Node_FunctionDecl.Params.AddLast(notDeclVarName);

                    foreach (var caller in func.Callers)
                    {
                        caller.UsedVarNames.Add(notDeclVarName);
                    }

                    foreach (var call in func.Calls)
                    {
                        call.Param_Nodes.AddLast(new Node_Expr_ID()
                        {
                            Name = notDeclVarName
                        });
                    }
                }
            }
        }
Example #2
0
 protected void RemoveClosures(AC_FunctionDeclTree.AC_FunctionDecl functionDecl)
 {
     foreach (var childFunctionDecl in functionDecl.Child_FuncDecls)
     {
         RemoveClosures(childFunctionDecl);
     }
     SetFullParamsList(functionDecl);
 }