⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cfold.cs

📁 C#编译器源代码。Micorsoft开放源代码
💻 CS
📖 第 1 页 / 共 3 页
字号:
							((StringConstant) right).Value, left.Location);										return null;				}				//				// handle "E operator + (E x, U y)"				// handle "E operator + (Y y, E x)"				//				// note that E operator + (E x, E y) is invalid				//				if (left is EnumConstant){					if (right is EnumConstant){						return null;					}					right = right.ToType (((EnumConstant) left).Child.Type, loc);					if (right == null)						return null;					wrap_as = left.Type;				} else if (right is EnumConstant){					left = left.ToType (((EnumConstant) right).Child.Type, loc);					if (left == null)						return null;					wrap_as = right.Type;				}				result = null;				DoConstantNumericPromotions (ec, oper, ref left, ref right, loc);				if (left == null || right == null)					return null;				try {					if (left is DoubleConstant){						double res;												if (ec.ConstantCheckState)							res = checked (((DoubleConstant) left).Value +								       ((DoubleConstant) right).Value);						else							res = unchecked (((DoubleConstant) left).Value +									 ((DoubleConstant) right).Value);												result = new DoubleConstant (res, left.Location);					} else if (left is FloatConstant){						float res;												if (ec.ConstantCheckState)							res = checked (((FloatConstant) left).Value +								       ((FloatConstant) right).Value);						else							res = unchecked (((FloatConstant) left).Value +									 ((FloatConstant) right).Value);												result = new FloatConstant (res, left.Location);					} else if (left is ULongConstant){						ulong res;												if (ec.ConstantCheckState)							res = checked (((ULongConstant) left).Value +								       ((ULongConstant) right).Value);						else							res = unchecked (((ULongConstant) left).Value +									 ((ULongConstant) right).Value);						result = new ULongConstant (res, left.Location);					} else if (left is LongConstant){						long res;												if (ec.ConstantCheckState)							res = checked (((LongConstant) left).Value +								       ((LongConstant) right).Value);						else							res = unchecked (((LongConstant) left).Value +									 ((LongConstant) right).Value);												result = new LongConstant (res, left.Location);					} else if (left is UIntConstant){						uint res;												if (ec.ConstantCheckState)							res = checked (((UIntConstant) left).Value +								       ((UIntConstant) right).Value);						else							res = unchecked (((UIntConstant) left).Value +									 ((UIntConstant) right).Value);												result = new UIntConstant (res, left.Location);					} else if (left is IntConstant){						int res;						if (ec.ConstantCheckState)							res = checked (((IntConstant) left).Value +								       ((IntConstant) right).Value);						else							res = unchecked (((IntConstant) left).Value +									 ((IntConstant) right).Value);						result = new IntConstant (res, left.Location);					} else if (left is DecimalConstant) {						decimal res;						if (ec.ConstantCheckState)							res = checked (((DecimalConstant) left).Value +								((DecimalConstant) right).Value);						else							res = unchecked (((DecimalConstant) left).Value +								((DecimalConstant) right).Value);						result = new DecimalConstant (res, left.Location);					} else {						throw new Exception ( "Unexepected addition input: " + left);					}				} catch (OverflowException){					Error_CompileTimeOverflow (loc);				}				if (wrap_as != null)					return result.TryReduce (ec, wrap_as, loc);				else					return result;			case Binary.Operator.Subtraction:				//				// handle "E operator - (E x, U y)"				// handle "E operator - (Y y, E x)"				// handle "U operator - (E x, E y)"				//				wrap_as = null;				if (left is EnumConstant){					if (right is EnumConstant){						if (left.Type != right.Type) {							Binary.Error_OperatorCannotBeApplied (loc, "-", left.Type, right.Type);							return null;						}						wrap_as = TypeManager.EnumToUnderlying (left.Type);						right = ((EnumConstant) right).Child.ToType (wrap_as, loc);						if (right == null)							return null;						left = ((EnumConstant) left).Child.ToType (wrap_as, loc);						if (left == null)							return null;					}					else {						right = right.ToType (((EnumConstant) left).Child.Type, loc);						if (right == null)							return null;						wrap_as = left.Type;					}				} else if (right is EnumConstant){					left = left.ToType (((EnumConstant) right).Child.Type, loc);					if (left == null)						return null;					wrap_as = right.Type;				}				DoConstantNumericPromotions (ec, oper, ref left, ref right, loc);				if (left == null || right == null)					return null;				try {					if (left is DoubleConstant){						double res;												if (ec.ConstantCheckState)							res = checked (((DoubleConstant) left).Value -								       ((DoubleConstant) right).Value);						else							res = unchecked (((DoubleConstant) left).Value -									 ((DoubleConstant) right).Value);												result = new DoubleConstant (res, left.Location);					} else if (left is FloatConstant){						float res;												if (ec.ConstantCheckState)							res = checked (((FloatConstant) left).Value -								       ((FloatConstant) right).Value);						else							res = unchecked (((FloatConstant) left).Value -									 ((FloatConstant) right).Value);												result = new FloatConstant (res, left.Location);					} else if (left is ULongConstant){						ulong res;												if (ec.ConstantCheckState)							res = checked (((ULongConstant) left).Value -								       ((ULongConstant) right).Value);						else							res = unchecked (((ULongConstant) left).Value -									 ((ULongConstant) right).Value);												result = new ULongConstant (res, left.Location);					} else if (left is LongConstant){						long res;												if (ec.ConstantCheckState)							res = checked (((LongConstant) left).Value -								       ((LongConstant) right).Value);						else							res = unchecked (((LongConstant) left).Value -									 ((LongConstant) right).Value);												result = new LongConstant (res, left.Location);					} else if (left is UIntConstant){						uint res;												if (ec.ConstantCheckState)							res = checked (((UIntConstant) left).Value -								       ((UIntConstant) right).Value);						else							res = unchecked (((UIntConstant) left).Value -									 ((UIntConstant) right).Value);												result = new UIntConstant (res, left.Location);					} else if (left is IntConstant){						int res;						if (ec.ConstantCheckState)							res = checked (((IntConstant) left).Value -								       ((IntConstant) right).Value);						else							res = unchecked (((IntConstant) left).Value -									 ((IntConstant) right).Value);						result = new IntConstant (res, left.Location);					} else if (left is DecimalConstant) {						decimal res;						if (ec.ConstantCheckState)							res = checked (((DecimalConstant) left).Value -								((DecimalConstant) right).Value);						else							res = unchecked (((DecimalConstant) left).Value -								((DecimalConstant) right).Value);						return new DecimalConstant (res, left.Location);					} else {						throw new Exception ( "Unexepected subtraction input: " + left);					}				} catch (OverflowException){					Error_CompileTimeOverflow (loc);				}				if (wrap_as != null)					return result.TryReduce (ec, wrap_as, loc);				return result;							case Binary.Operator.Multiply:				DoConstantNumericPromotions (ec, oper, ref left, ref right, loc);				if (left == null || right == null)					return null;				try {					if (left is DoubleConstant){						double res;												if (ec.ConstantCheckState)							res = checked (((DoubleConstant) left).Value *								((DoubleConstant) right).Value);						else							res = unchecked (((DoubleConstant) left).Value *								((DoubleConstant) right).Value);												return new DoubleConstant (res, left.Location);					} else if (left is FloatConstant){						float res;												if (ec.ConstantCheckState)							res = checked (((FloatConstant) left).Value *								((FloatConstant) right).Value);						else							res = unchecked (((FloatConstant) left).Value *								((FloatConstant) right).Value);												return new FloatConstant (res, left.Location);					} else if (left is ULongConstant){						ulong res;												if (ec.ConstantCheckState)							res = checked (((ULongConstant) left).Value *								((ULongConstant) right).Value);						else							res = unchecked (((ULongConstant) left).Value *								((ULongConstant) right).Value);												return new ULongConstant (res, left.Location);					} else if (left is LongConstant){						long res;												if (ec.ConstantCheckState)							res = checked (((LongConstant) left).Value *								((LongConstant) right).Value);						else							res = unchecked (((LongConstant) left).Value *								((LongConstant) right).Value);												return new LongConstant (res, left.Location);					} else if (left is UIntConstant){						uint res;												if (ec.ConstantCheckState)							res = checked (((UIntConstant) left).Value *								((UIntConstant) right).Value);						else							res = unchecked (((UIntConstant) left).Value *								((UIntConstant) right).Value);												return new UIntConstant (res, left.Location);					} else if (left is IntConstant){						int res;						if (ec.ConstantCheckState)							res = checked (((IntConstant) left).Value *								((IntConstant) right).Value);						else							res = unchecked (((IntConstant) left).Value *								((IntConstant) right).Value);						return new IntConstant (res, left.Location);					} else if (left is DecimalConstant) {						decimal res;						if (ec.ConstantCheckState)							res = checked (((DecimalConstant) left).Value *								((DecimalConstant) right).Value);						else							res = unchecked (((DecimalConstant) left).Value *								((DecimalConstant) right).Value);						return new DecimalConstant (res, left.Location);					} else {						throw new Exception ( "Unexepected multiply input: " + left);					}				} catch (OverflowException){					Error_CompileTimeOverflow (loc);				}				break;			case Binary.Operator.Division:				DoConstantNumericPromotions (ec, oper, ref left, ref right, loc);				if (left == null || right == null)					return null;				try {					if (left is DoubleConstant){						double res;												if (ec.ConstantCheckState)							res = checked (((DoubleConstant) left).Value /								((DoubleConstant) right).Value);						else							res = unchecked (((DoubleConstant) left).Value /								((DoubleConstant) right).Value);												return new DoubleConstant (res, left.Location);					} else if (left is FloatConstant){						float res;												if (ec.ConstantCheckState)							res = checked (((FloatConstant) left).Value /								((FloatConstant) right).Value);						else							res = unchecked (((FloatConstant) left).Value /								((FloatConstant) right).Value);												return new FloatConstant (res, left.Location);					} else if (left is ULongConstant){						ulong res;												if (ec.ConstantCheckState)							res = checked (((ULongConstant) left).Value /								((ULongConstant) right).Value);						else							res = unchecked (((ULongConstant) left).Value /								((ULongConstant) right).Value);												return new ULongConstant (res, left.Location);					} else if (left is LongConstant){						long res;												if (ec.ConstantCheckState)							res = checked (((LongConstant) left).Value /								((LongConstant) right).Value);						else							res = unchecked (((LongConstant) left).Value /								((LongConstant) right).Value);												return new LongConstant (res, left.Location);					} else if (left is UIntConstant){						uint res;												if (ec.ConstantCheckState)							res = checked (((UIntConstant) left).Value /								((UIntConstant) right).Value);						else							res = unchecked (((UIntConstant) left).Value /								((UIntConstant) right).Value);												return new UIntConstant (res, left.Location);					} else if (left is IntConstant){						int res;						if (ec.ConstantCheckState)							res = checked (((IntConstant) left).Value /								((IntConstant) right).Value);						else							res = unchecked (((IntConstant) left).Value /

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -