Ejemplo n.º 1
0
        private void AnalyzeProcess(Process process)
        {
            Action     func   = process.InitialAction;
            MethodInfo method = func.Method;
            List <ISignalOrPortDescriptor> sens = new List <ISignalOrPortDescriptor>();

            if (process.Sensitivity != null)
            {
                foreach (EventSource e in process.Sensitivity)
                {
                    DesignObject owner = e.Owner;
                    if (!(owner is SignalBase))
                    {
                        _context.Report(EIssueClass.Error,
                                        "Process " + method.Name + " is sensitive to an event which is not owned by " +
                                        "a signal. This is currently not supported by the behavioral model.");
                    }
                    else
                    {
                        var signal = (SignalBase)owner;
                        var spdesc = signal.Descriptor;
                        if (spdesc == null)
                        {
                            throw new InvalidOperationException();
                        }
                        var sref = spdesc.AsSignalRef(SignalRef.EReferencedProperty.Instance)
                                   .RelateToComponent(process.Owner.Descriptor);
                        if (sref == null)
                        {
                            ReportError("Did not find a matching port for signal " + signal.Descriptor.Name);
                        }
                        else
                        {
                            sens.Add(sref.Desc);
                        }
                    }
                }
            }
            ProcessDescriptor pd = new ProcessDescriptor(method, process)
            {
                Sensitivity = sens.ToArray(),
                Owner       = process.Owner.Descriptor
            };

            //DecompileAndEnqueueCallees(pd, process.Owner, new object[] { process.Owner });
            DecompileAndEnqueueCallees(pd, func.Target, new object[] { process.Owner });
            process.Owner.Descriptor.AddChild(pd, method.Name);
        }