Esempio n. 1
0
        public BindingOperation Make(Tree <Cell> nameCell)
        {
            string name = nameCell.Value.Text.Trim();

            if (NoOperationIsImpliedBy(name))
            {
                return(new NoBinding());
            }

            var cellOperation = new CellOperationImpl(processor);

            if (CheckIsImpliedBy(name))
            {
                return(new CheckBinding(cellOperation, targetProvider, nameCell));
            }

            string memberName = processor.ParseTree <Cell, MemberName>(nameCell).ToString();

            RuntimeMember member = RuntimeType.FindInstance(targetProvider, new IdentifierName(memberName), 1);

            if (member == null && newIdentifier.IsStartOf(name))
            {
                string newMemberName = name.Substring(4);
                return(new CreateBinding(processor, adapter, newMemberName));
            }

            return(new InputBinding(processor, targetProvider, nameCell));
        }
Esempio n. 2
0
        public bool TryInvoke(Processor <T> processor, TypedValue instance, string memberName, Tree <T> parameters,
                              ref TypedValue result)
        {
            RuntimeMember member = RuntimeType.FindInstance(instance.Value, memberName, parameters.Branches.Count);

            result = member != null
                         ? member.Invoke(GetParameterList(processor, instance, parameters, member))
                         : TypedValue.MakeInvalid(new MemberMissingException(instance.Type, memberName,
                                                                             parameters.Branches.Count));

            return(true);
        }
Esempio n. 3
0
 [Test] public void MethodwithMatchedParameterNamesIsFound()
 {
     Assert.IsNotNull(RuntimeType.FindInstance(instance, new IdentifierName("methodwithparms"), new [] { "input" }));
 }