Skip to content

Commit

Permalink
version + js
Browse files Browse the repository at this point in the history
  • Loading branch information
thradams committed Dec 22, 2024
1 parent a1d494c commit f434127
Show file tree
Hide file tree
Showing 3 changed files with 2,946 additions and 2,909 deletions.
45 changes: 33 additions & 12 deletions src/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ enum diagnostic_id {
C_MULTICHAR_ERROR = 1370,
C_INVALID_TOKEN = 1380,
C_INVALID_ARGUMENT_NELEMENTSOF = 1390,
C_ERROR_RETURN_CANNOT_BE_USED_INSIDE_DEFER = 1400
};


Expand Down Expand Up @@ -13676,6 +13677,8 @@ struct parser_ctx
*/
const struct try_statement* _Opt p_current_try_statement_opt;

const struct defer_statement* _Opt p_current_defer_statement_opt;

/*
* Points to the selection_statement we're in. Or null.
*/
Expand Down Expand Up @@ -27949,7 +27952,7 @@ void defer_start_visit_declaration(struct defer_visit_ctx* ctx, struct declarati

//#pragma once

#define CAKE_VERSION "0.9.42"
#define CAKE_VERSION "0.9.43"



Expand Down Expand Up @@ -30521,7 +30524,7 @@ struct init_declarator* _Owner _Opt init_declarator(struct parser_ctx* ctx,
p_init_declarator->initializer,
is_constant);

p_init_declarator->p_declarator->object.type.num_of_elements =
p_init_declarator->p_declarator->object.type.num_of_elements =
p_init_declarator->p_declarator->type.num_of_elements;

}
Expand Down Expand Up @@ -36508,24 +36511,31 @@ struct defer_statement* _Owner _Opt defer_statement(struct parser_ctx* ctx)
throw;
}

if (ctx->current->type != TK_KEYWORD_DEFER)
throw;

p_defer_statement = calloc(1, sizeof(struct defer_statement));

if (p_defer_statement == NULL)
throw;

if (ctx->current->type == TK_KEYWORD_DEFER)
{
p_defer_statement->first_token = ctx->current;
parser_match(ctx);
p_defer_statement->first_token = ctx->current;
parser_match(ctx);

struct secondary_block* _Owner _Opt p_secondary_block = secondary_block(ctx);
if (p_secondary_block == NULL) throw;
const struct defer_statement* _Opt p_previous_defer_statement_opt =
ctx->p_current_defer_statement_opt;

p_defer_statement->secondary_block = p_secondary_block;
if (ctx->previous == NULL) throw;
ctx->p_current_defer_statement_opt = p_defer_statement;

p_defer_statement->last_token = ctx->previous;
}
struct secondary_block* _Owner _Opt p_secondary_block = secondary_block(ctx);
if (p_secondary_block == NULL) throw;

p_defer_statement->secondary_block = p_secondary_block;
if (ctx->previous == NULL) throw;

p_defer_statement->last_token = ctx->previous;

ctx->p_current_defer_statement_opt = p_previous_defer_statement_opt;
}
catch
{
Expand Down Expand Up @@ -36828,6 +36838,17 @@ struct jump_statement* _Owner _Opt jump_statement(struct parser_ctx* ctx)
}
else if (ctx->current->type == TK_KEYWORD_RETURN)
{
if (ctx->p_current_defer_statement_opt != NULL)
{
compiler_diagnostic_message(C_ERROR_RETURN_CANNOT_BE_USED_INSIDE_DEFER,
ctx,
ctx->current,
NULL,
"%s",
"return cannot be used inside defer statement");
throw;
}

const struct token* const p_return_token = ctx->current;
parser_match(ctx);

Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

#pragma once

#define CAKE_VERSION "0.9.42"
#define CAKE_VERSION "0.9.43"


5,808 changes: 2,912 additions & 2,896 deletions src/web/cake.js

Large diffs are not rendered by default.

0 comments on commit f434127

Please sign in to comment.