Skip to content

Commit

Permalink
fixes #305: modifed the fix location.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kray-G committed Jul 20, 2021
1 parent 8584726 commit 458bd2e
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* #272: Supported a binary mode in HTTP.
* #273: Supported `read`/`write` in `File`.
* #290: Supported `chmod` in `File`.
* #308: Improvement of the stack usage.
* Small improvements and enhancements as follows without managing by issues.
* Supported SemanticVersion class with `using SemanticVersion;`.
* Supported putting a comma at the end of an argument's list for both declaration and calling.
Expand Down
4 changes: 4 additions & 0 deletions ChangeLog_v1.0.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## V1.0.3 (Current Development Version)

* Improvements
* #308: Improvement of the stack usage.
* Some feedbacks from V1.1.0.
* Supported putting a comma at the end of an argument's list for both declaration and calling.
* Bug Fixed
* #302: Fixed a prblem of the string optimization.
* #305: Fixed a prblem of no POPC in try.
Expand Down
1 change: 1 addition & 0 deletions include/kxastobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ extern kx_object_t *kx_gen_texpr_object(kx_object_t *lhs, kx_object_t *rhs, kx_o
extern kx_object_t *kx_gen_stmt_object(int type, kx_object_t *lhs, kx_object_t *rhs, kx_object_t *ex);
extern kx_object_t *kx_gen_stmt_object_line(int type, kx_object_t *lhs, kx_object_t *rhs, kx_object_t *ex, int line);
extern kx_object_t *kx_gen_modifier(kx_object_t *modifier, kx_object_t *stmt);
extern kx_object_t *kx_gen_try_stmt_object(kx_object_t *lhs, kx_object_t *rhs, kx_object_t *ex);
extern kx_object_t *kx_gen_case_stmt_object(int optional, kx_object_t *lhs);
extern kx_object_t *kx_gen_break_object(int type, const char *name);
extern kx_object_t *kx_gen_label_object(int type, const char *name, kx_object_t *lhs);
Expand Down
5 changes: 5 additions & 0 deletions src/ast_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,11 @@ kx_object_t *kx_gen_modifier(kx_object_t *modifier, kx_object_t *stmt)
return stmt;
}

kx_object_t *kx_gen_try_stmt_object(kx_object_t *lhs, kx_object_t *rhs, kx_object_t *ex)
{
return kx_gen_stmt_object(KXST_TRY, lhs, rhs, ex ? ex : kx_gen_block_object(NULL));
}

kx_object_t *kx_gen_case_stmt_object(int optional, kx_object_t *lhs)
{
return kx_gen_obj(KXST_CASE, optional, lhs, NULL, NULL);
Expand Down
6 changes: 3 additions & 3 deletions src/kinx.y
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ ForInVariable
;

TryCatchStatement
: TRY BlockStatement CatchStatement_Opt FinallyStatement_Opt { $$ = kx_gen_stmt_object(KXST_TRY, $2, $3, $4); }
: TRY BlockStatement CatchStatement_Opt FinallyStatement_Opt { $$ = kx_gen_try_stmt_object($2, $3, $4); }
;

CatchStatement_Opt
Expand All @@ -351,8 +351,8 @@ CatchVariable
;

FinallyStatement_Opt
: { $$ = kx_gen_block_object(NULL); }
| FINALLY BlockStatement { $$ = ($2 == NULL) ? kx_gen_block_object(NULL) : $2; }
: { $$ = NULL; }
| FINALLY BlockStatement { $$ = $2; }
;

BreakStatement
Expand Down
6 changes: 3 additions & 3 deletions src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -2139,7 +2139,7 @@ int yyparse(YYPARSE_ARG)
{ yyval.obj = kx_gen_forin_object(YYASP(4-8).obj, YYASP(6-8).obj, YYASP(8-8).obj, 1); } break;
case 78:
#line 340 "src/kinx.y"
{ yyval.obj = kx_gen_stmt_object(KXST_TRY, YYASP(2-4).obj, YYASP(3-4).obj, YYASP(4-4).obj); } break;
{ yyval.obj = kx_gen_try_stmt_object(YYASP(2-4).obj, YYASP(3-4).obj, YYASP(4-4).obj); } break;
case 79:
#line 344 "src/kinx.y"
{ yyval.obj = NULL; } break;
Expand All @@ -2154,10 +2154,10 @@ int yyparse(YYPARSE_ARG)
{ yyval.obj = kx_gen_var_object_line_pos(YYASP(2-3).strinfo.name, KX_UNKNOWN_T, YYASP(2-3).strinfo.line, YYASP(2-3).strinfo.pos1, YYASP(2-3).strinfo.pos2); } break;
case 83:
#line 354 "src/kinx.y"
{ yyval.obj = kx_gen_block_object(NULL); } break;
{ yyval.obj = NULL; } break;
case 84:
#line 355 "src/kinx.y"
{ yyval.obj = (YYASP(2-2).obj == NULL) ? kx_gen_block_object(NULL) : YYASP(2-2).obj; } break;
{ yyval.obj = YYASP(2-2).obj; } break;
case 85:
#line 359 "src/kinx.y"
{ yyval.obj = kx_gen_modifier(YYASP(2-3).obj, kx_gen_break_object(KXST_BREAK, NULL)); } break;
Expand Down

0 comments on commit 458bd2e

Please sign in to comment.