public AffeException(string message, Exception inner, int location)
     : base(message, inner)
 {
     this.mRelatedNode = null;
     this.mSourceLocation = location;
 }
        public AffeException(string message, Exception inner, Node node)
            : base(message, inner)
        {
            if (node == null)
                throw new ArgumentNullException("node");

            this.mRelatedNode = node;
            this.mSourceLocation = node.SourceLocation;
        }
예제 #3
0
        public static void EmitLiteral(ILGenerator il, FieldInfo field,
		                               Node @this)
        {
            object literal = field.GetValue(null);

            if (AffeCompilerState.IsI4(field.FieldType)) {
                int i4;

                if (field.FieldType == typeof(uint))
                    // Handle overflow.
                    i4 = unchecked((int) (uint) literal);
                else
                    i4 = Convert.ToInt32(literal);

                il.Emit(OpCodes.Ldc_I4, i4);
            } else if (field.FieldType == typeof(float)) {
                il.Emit(OpCodes.Ldc_R4, (float) literal);
            } else if (field.FieldType == typeof(double)) {
                il.Emit(OpCodes.Ldc_R8, (double) literal);
            } else {
                throw new AffeException("Cannot process literal of type " +
                                        field.FieldType.FullName, @this);
            }

            return;
        }