/// <summary>
 /// Creates a 'rethrow' intrinsic, which rethrows a captured exception.
 /// The difference between 'rethrow' and 'throw' is that the former
 /// takes a captured exception and retains stack trace information
 /// whereas the latter takes a (raw) exception value and constructs
 /// a new stack trace.
 /// </summary>
 /// <param name="capturedExceptionType">
 /// The type of the captured exception to rethrow.
 /// </param>
 /// <param name="capturedException">
 /// The captured exception to rethrow.
 /// </param>
 /// <returns>A 'rethrow' intrinsic.</returns>
 public static Instruction CreateRethrowIntrinsic(
     IType capturedExceptionType,
     ValueTag capturedException)
 {
     return(ExceptionIntrinsics.CreateRethrowPrototype(capturedExceptionType)
            .Instantiate(new[] { capturedException }));
 }
 /// <summary>
 /// Creates a 'throw' intrinsic, which throws an exception.
 /// </summary>
 /// <param name="exceptionType">
 /// The type of exception to throw.
 /// </param>
 /// <param name="exception">
 /// The exception to throw.
 /// </param>
 /// <returns>A 'throw' intrinsic.</returns>
 public static Instruction CreateThrowIntrinsic(
     IType exceptionType,
     ValueTag exception)
 {
     return(ExceptionIntrinsics.CreateThrowPrototype(exceptionType)
            .Instantiate(new[] { exception }));
 }
 /// <summary>
 /// Creates a 'get_captured_exception' intrinsic, which throws an exception.
 /// </summary>
 /// <param name="resultType">
 /// The type of the exception value returned
 /// by this operation.
 /// </param>
 /// <param name="argumentType">
 /// The type of the captured exception to examine.
 /// </param>
 /// <param name="argument">
 /// A captured exception to examine.
 /// </param>
 /// <returns>A 'get_captured_exception' intrinsic.</returns>
 public static Instruction CreateGetCapturedExceptionIntrinsic(
     IType resultType,
     IType argumentType,
     ValueTag argument)
 {
     return(ExceptionIntrinsics.CreateGetCapturedExceptionPrototype(resultType, argumentType)
            .Instantiate(new[] { argument }));
 }
Example #4
0
 /// <summary>
 /// Creates a 'capture' intrinsic, which captures a (thrown)
 /// exception.
 /// </summary>
 /// <param name="resultType">
 /// The type of a captured exception.
 /// </param>
 /// <param name="argumentType">
 /// The type of the exception to capture.
 /// </param>
 /// <param name="argument">
 /// An exception to capture.
 /// </param>
 /// <returns>A 'capture' intrinsic.</returns>
 public static Instruction CreateCaptureIntrinsic(
     IType resultType,
     IType argumentType,
     ValueTag argument)
 {
     return(ExceptionIntrinsics.CreateCapturePrototype(resultType, argumentType)
            .Instantiate(argument));
 }