Beispiel #1
0
        protected static void EmitChildWithConvert(ExpressionElement child, Type resultType, FleeILGenerator ilg, IServiceProvider services)
        {
            child.Emit(ilg, services);
            bool converted = ImplicitConverter.EmitImplicitConvert(child.ResultType, resultType, ilg);

            Debug.Assert(converted, "convert failed");
        }
Beispiel #2
0
        /// <summary>
        /// Set the left and right operands, get the operation, and get the result type
        /// </summary>
        /// <param name="leftChild"></param>
        /// <param name="rightChild"></param>
        /// <param name="op"></param>
        private void Configure(ExpressionElement leftChild, ExpressionElement rightChild, object op)
        {
            MyLeftChild  = leftChild;
            MyRightChild = rightChild;
            this.GetOperation(op);

            this.ValidateInternal(op);
        }
Beispiel #3
0
        public void SetChild(ExpressionElement child)
        {
            MyChild       = child;
            _myResultType = this.GetResultType(child.ResultType);

            if (_myResultType == null)
            {
                base.ThrowCompileException(CompileErrorResourceKeys.OperationNotDefinedForType, CompileExceptionReason.TypeMismatch, MyChild.ResultType.Name);
            }
        }
Beispiel #4
0
 private string GetFieldName(ExpressionElement child)
 {
     if (child is IdentifierElement)
     {
         var memberName = ((IdentifierElement)child).MemberName;
         if (memberName.StartsWith("_"))
         {
             memberName = memberName.Substring(1);
         }
         return(memberName);
     }
     if (child is InvocationListElement)
     {
         return(GetFieldName(((InvocationListElement)child).Tail));
     }
     return(null);
 }
Beispiel #5
0
 protected static bool IsChildOfType(ExpressionElement child, Type t)
 {
     return(object.ReferenceEquals(child.ResultType, t));
 }