0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.0.0075

Problem:    Using number for exception type lacks type checking.
Solution:   Use an enum.
This commit is contained in:
Bram Moolenaar
2016-11-10 20:20:05 +01:00
parent 95f096030e
commit 8a5883b748
5 changed files with 17 additions and 14 deletions

View File

@@ -814,6 +814,16 @@ struct msglist
struct msglist *next; /* next of several messages in a row */
};
/*
* The exception types.
*/
typedef enum
{
ET_USER, /* exception caused by ":throw" command */
ET_ERROR, /* error exception */
ET_INTERRUPT /* interrupt exception triggered by Ctrl-C */
} except_type_T;
/*
* Structure describing an exception.
* (don't use "struct exception", it's used by the math library).
@@ -821,7 +831,7 @@ struct msglist
typedef struct vim_exception except_T;
struct vim_exception
{
int type; /* exception type */
except_type_T type; /* exception type */
char_u *value; /* exception value */
struct msglist *messages; /* message(s) causing error exception */
char_u *throw_name; /* name of the throw point */
@@ -829,13 +839,6 @@ struct vim_exception
except_T *caught; /* next exception on the caught stack */
};
/*
* The exception types.
*/
#define ET_USER 0 /* exception caused by ":throw" command */
#define ET_ERROR 1 /* error exception */
#define ET_INTERRUPT 2 /* interrupt exception triggered by Ctrl-C */
/*
* Structure to save the error/interrupt/exception state between calls to
* enter_cleanup() and leave_cleanup(). Must be allocated as an automatic