示例#1
0
 private static void findAndCallConstructor(
     string name,
     parse_tree.parameter_list parameters,
     ClassTabPage ctp, int count, NClass.Core.ClassType theClass)
 {
     foreach (NClass.Core.Operation op in theClass.Operations)
     {
         if (op is NClass.Core.Constructor)
         {
             if ((op as NClass.Core.Constructor).numberArguments == count)
             {
                 Procedure_Chart sc = (op as NClass.Core.Constructor).raptorTab
                                      as Procedure_Chart;
                 if (sc != null)
                 {
                     Runtime.Set_Running(sc);
                     Invoke_Tab_Procedure_Enter(
                         parameters, sc, Runtime.getContext());
                     CallStack.setContext(Runtime.getContext());
                     return;
                 }
             }
         }
     }
     throw new System.Exception("could not find constructor for " + name +
                                " with " + count + " parameter(s).");
 }
示例#2
0
        public static void Invoke_Method(string name, parse_tree.parameter_list parameters)
        {
            if (Component.Current_Mode != Mode.Expert)
            {
                throw new Exception("there is no function named " + name);
            }
            Procedure_Chart sc = Runtime.Find_Method_Set_Running(name, parse_tree_pkg.count_parameters(parameters));

            if (state == State_Enum.Entering)
            {
                Runtime.Variable this_value = Runtime.getContext();
                Runtime.setContext(null);
                // we stored the "this" parameter in the context
                // but need to set it to null before entering the
                // method
                Invoke_Tab_Procedure_Enter(parameters, sc, this_value);
                // this used to be a call to getContext, but I'm not
                // at all sure why.
                CallStack.setContext(this_value);
            }
            else
            {
                Invoke_Tab_Procedure_Exit(parameters, sc);
            }
        }
示例#3
0
        public static bool Invoke_Constructor(string name, parse_tree.parameter_list parameters)
        {
            int count = parse_tree_pkg.count_parameters(parameters);

            NClass.Core.ClassType theClass = Runtime.parent.projectCore.findClass(name);
            while (theClass != null)
            {
                foreach (NClass.Core.Operation op in theClass.Operations)
                {
                    if (op is NClass.Core.Constructor)
                    {
                        if ((op as NClass.Core.Constructor).numberArguments == count)
                        {
                            Procedure_Chart sc = (op as NClass.Core.Constructor).raptorTab
                                                 as Procedure_Chart;
                            if (sc != null)
                            {
                                Runtime.Set_Running(sc);
                                Runtime.Variable this_value = Runtime.getContext();
                                Runtime.setContext(null);
                                // we stored the "this" parameter in the context
                                // but need to set it to null before entering the
                                // method
                                Invoke_Tab_Procedure_Enter(parameters, sc, this_value);
                                CallStack.setContext(Runtime.getContext());
                                return(true);
                            }
                        }
                    }
                }
                theClass = theClass.BaseClass;
            }
            if (count == 0)
            {
                return(false);
            }
            else
            {
                throw new System.Exception("could not find constructor for " + name +
                                           " with " + count + " parameter(s).");
            }
        }