Example #1
0
        protected static Hash <string, Signature> getSignatures(Block block, Parameters parameters)
        {
            var signatures = new Hash <string, Signature>();

            foreach (var verb in block.AsAdded)
            {
                switch (verb)
                {
                case CreateFunction createFunction:
                    signatures[createFunction.FunctionName] = createFunction.Signature;
                    break;

                case SpecialAssignment sa when sa.Signature.If(out var signature):
                    signatures[signature.Name] = signature;

                    break;

                case AssignToNewField assign:
                    var fieldName = assign.FieldName;
                    signatures[fieldName] = new Signature(fieldName, 0, false);
                    if (assign.ReadOnly)
                    {
                        signatures[SetterName(fieldName)] = new Signature(fieldName, 1, false);
                    }

                    break;
                }
            }

            foreach (var parameter in parameters.GetParameters())
            {
                var name       = parameter.Name;
                var visibility = parameter.Visibility;
                if (visibility == Temporary)
                {
                    continue;
                }

                signatures[name] = new Signature(name, 0, false);
                if (!parameter.ReadOnly)
                {
                    signatures[SetterName(name)] = new Signature(name, 1, false);
                }
            }

            return(signatures);
        }