public OverloadableOperation(Operator op, params Operand[] operands)
		{
			this.op = op;
			this.operands = operands;

			List<ApplicableFunction> candidates = null;

			foreach (Operand operand in operands)
			{
				if ((object)operand != null && !operand.Type.IsPrimitive)
				{
					// try overloads
					candidates = op.FindUserCandidates(operands);
					break;
				}
			}

			if (candidates == null)
				candidates = OverloadResolver.FindApplicable(op.GetStandardCandidates(operands), operands);

			if (candidates == null)
				throw new InvalidOperationException(string.Format(null, Properties.Messages.ErrInvalidOperation, op.methodName,
					string.Join(", ", Array.ConvertAll<Operand, string>(operands, Operand.GetTypeName))));

			af = OverloadResolver.FindBest(candidates);

			if (af == null)
				throw new AmbiguousMatchException(Properties.Messages.ErrAmbiguousBinding);
		}
コード例 #2
0
        void PrepareAf(ITypeMapper typeMapper)
        {
            if (_af != null)
            {
                return;
            }
            List <ApplicableFunction> candidates = null;

            foreach (Operand operand in _operands)
            {
                if ((object)operand != null && !operand.GetReturnType(typeMapper).IsPrimitive)
                {
                    // try overloads
                    candidates = _op.FindUserCandidates(typeMapper, _operands);
                    break;
                }
            }

            if (candidates == null)
            {
                candidates = OverloadResolver.FindApplicable(_op.GetStandardCandidates(typeMapper, _operands), typeMapper, _operands);
            }

            if (candidates == null)
            {
                throw new InvalidOperationException(string.Format(null, Messages.ErrInvalidOperation, _op.MethodName,
                                                                  string.Join(", ", Array.ConvertAll <Operand, string>(_operands, op => op.GetReturnType(typeMapper).FullName))));
            }

            _af = OverloadResolver.FindBest(candidates, typeMapper);

            if (_af == null)
            {
                throw new AmbiguousMatchException(Messages.ErrAmbiguousBinding);
            }
        }
コード例 #3
0
ファイル: Property.cs プロジェクト: jimmmeh/runsharp
 public Property(ApplicableFunction property, Operand target, Operand[] indexes)
 {
     this.property = property;
     this.target = target;
     this.indexes = indexes;
 }
コード例 #4
0
ファイル: NewObject.cs プロジェクト: jimmmeh/runsharp
 public NewObject(ApplicableFunction ctor, Operand[] args)
 {
     this.ctor = ctor;
     this.args = args;
 }
コード例 #5
0
 public Property(ApplicableFunction property, Operand target, Operand[] indexes)
 {
     this.property = property;
     this.target   = target;
     this.indexes  = indexes;
 }
コード例 #6
0
ファイル: NewObject.cs プロジェクト: smartcaveman/runsharp
 public NewObject(ApplicableFunction ctor, Operand[] args)
 {
     _ctor = ctor;
     _args = args;
 }
コード例 #7
0
ファイル: Invocation.cs プロジェクト: diakopter/csmeta
 public Invocation(ApplicableFunction method, Operand target, Operand[] args)
 {
     this.method = method;
     this.target = target;
     this.args   = args;
 }
コード例 #8
0
ファイル: Invocation.cs プロジェクト: AqlaSolutions/runsharp
        public Invocation(ApplicableFunction method, Operand target, Operand[] args)
		{
			_method = method;
			_target = target;
			_args = args;
		}
コード例 #9
0
 public Invocation(ApplicableFunction method, Operand target, Operand[] args)
 {
     _method = method;
     _target = target;
     _args   = args;
 }
コード例 #10
0
ファイル: Property.cs プロジェクト: AqlaSolutions/runsharp
        public Property(ApplicableFunction property, Operand target, Operand[] indexes)
		{
			_property = property;
			_target = target;
			_indexes = indexes;
		}
コード例 #11
0
 public Property(ApplicableFunction property, Operand target, Operand[] indexes)
 {
     _property = property;
     _target   = target;
     _indexes  = indexes;
 }
コード例 #12
0
		public Invocation(ApplicableFunction method, Operand target, Operand[] args)
		{
			this.method = method;
			this.target = target;
			this.args = args;
		}
コード例 #13
0
ファイル: NewObject.cs プロジェクト: jmptrader/Creek
 public NewObject(ApplicableFunction ctor, Operand[] args)
 {
     this.ctor = ctor;
     this.args = args;
 }
コード例 #14
0
ファイル: NewObject.cs プロジェクト: AqlaSolutions/runsharp
        public NewObject(ApplicableFunction ctor, Operand[] args)
		{
			_ctor = ctor;
			_args = args;
		}