CatchClauseImpl constructor

CatchClauseImpl({
  1. required Token? onKeyword,
  2. required TypeAnnotationImpl? exceptionType,
  3. required Token? catchKeyword,
  4. required Token? leftParenthesis,
  5. required CatchClauseParameterImpl? exceptionParameter,
  6. required Token? comma,
  7. required CatchClauseParameterImpl? stackTraceParameter,
  8. required Token? rightParenthesis,
  9. required BlockImpl body,
})

Initialize a newly created catch clause. The onKeyword and exceptionType can be null if the clause will catch all exceptions. The comma and _stackTraceParameter can be null if the stack trace parameter is not defined.

Implementation

CatchClauseImpl({
  required this.onKeyword,
  required TypeAnnotationImpl? exceptionType,
  required this.catchKeyword,
  required this.leftParenthesis,
  required CatchClauseParameterImpl? exceptionParameter,
  required this.comma,
  required CatchClauseParameterImpl? stackTraceParameter,
  required this.rightParenthesis,
  required BlockImpl body,
})  : assert(onKeyword != null || catchKeyword != null),
      _exceptionType = exceptionType,
      _exceptionParameter = exceptionParameter,
      _stackTraceParameter = stackTraceParameter,
      _body = body {
  _becomeParentOf(_exceptionType);
  _becomeParentOf(_exceptionParameter);
  _becomeParentOf(_stackTraceParameter);
  _becomeParentOf(_body);
}