Skip to content

Commit 918eae5

Browse files
committed
Update Gravity
1 parent e19cee4 commit 918eae5

File tree

16 files changed

+33
-39
lines changed

16 files changed

+33
-39
lines changed

Dependencies/Gravity/src/compiler/debug_macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#include <stdlib.h>
1616
#include <string.h>
1717
#include <stdarg.h>
18+
#include <assert.h>
1819
#include <limits.h>
1920
#include <float.h>
2021
#include <math.h>
21-
#include <assert.h>
2222
#include "../shared/gravity_memory.h"
2323
#include "../shared/gravity_config.h"
2424

Dependencies/Gravity/src/compiler/gravity_ast.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "../utils/gravity_utils.h"
1313
#include "../compiler/gravity_visitor.h"
1414
#include "../compiler/gravity_symboltable.h"
15-
#include <assert.h>
1615

1716
#define SETBASE(node,tagv,_tok) node->base.tag = tagv; node->base.token = _tok
1817
#define SETDECL(node,_decl) node->base.decl = _decl

Dependencies/Gravity/src/compiler/gravity_codegen.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "../utils/gravity_utils.h"
1515
#include "../shared/gravity_array.h"
1616
#include "../shared/gravity_hash.h"
17-
#include <assert.h>
1817

1918
typedef marray_t(gnode_class_decl_t *) gnode_class_r;
2019
struct codegen_t {

Dependencies/Gravity/src/compiler/gravity_ircode.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "../shared/gravity_value.h"
1111
#include "../utils/gravity_debug.h"
1212
#include <inttypes.h>
13-
#include <assert.h>
1413

1514
typedef marray_t(inst_t *) code_r;
1615
typedef marray_t(bool *) context_r;
@@ -44,7 +43,10 @@ ircode_t *ircode_create (uint16_t nlocals) {
4443
code->error = false;
4544

4645
code->list = mem_alloc(NULL, sizeof(code_r));
47-
if (!code->list) return NULL;
46+
if (!code->list) {
47+
mem_free(code);
48+
return NULL;
49+
}
4850
marray_init(*code->list);
4951
marray_init(code->label_true);
5052
marray_init(code->label_false);

Dependencies/Gravity/src/compiler/gravity_lexer.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "../compiler/gravity_lexer.h"
1212
#include "../compiler/gravity_token.h"
1313
#include "../utils/gravity_utils.h"
14-
#include <assert.h>
1514

1615
struct gravity_lexer_t {
1716
const char *buffer; // buffer

Dependencies/Gravity/src/compiler/gravity_optimizer.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "../compiler/gravity_ircode.h"
1515
#include "../utils/gravity_utils.h"
1616
#include "../shared/gravity_value.h"
17-
#include <assert.h>
1817

1918
#define IS_MOVE(inst) ((inst) && (inst->op == MOVE))
2019
#define IS_RET(inst) ((inst) && (inst->op == RET))

Dependencies/Gravity/src/compiler/gravity_parser.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "../shared/gravity_hash.h"
1818
#include "../runtime/gravity_core.h"
1919
#include "../compiler/gravity_ast.h"
20-
#include <assert.h>
2120

2221
typedef marray_t(gravity_lexer_t*) lexer_r;
2322

@@ -438,7 +437,10 @@ static gnode_t *parse_file_expression (gravity_parser_t *parser) {
438437
while (gravity_lexer_peek(lexer) == TOK_OP_DOT) {
439438
gravity_lexer_next(lexer); // consume TOK_OP_DOT
440439
const char *identifier = parse_identifier(parser);
441-
if (!identifier) return NULL;
440+
if (!identifier) {
441+
mem_free(list);
442+
return NULL;
443+
}
442444
cstring_array_push(list, identifier);
443445
}
444446

Dependencies/Gravity/src/compiler/gravity_semacheck2.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "../compiler/gravity_compiler.h"
1212
#include "../compiler/gravity_visitor.h"
1313
#include "../runtime/gravity_core.h"
14-
#include <assert.h>
1514

1615
struct semacheck_t {
1716
gnode_r *declarations; // declarations stack

Dependencies/Gravity/src/compiler/gravity_symboltable.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "../shared/gravity_macros.h"
1111
#include "../shared/gravity_array.h"
1212
#include "../shared/gravity_hash.h"
13-
#include <assert.h>
1413

1514
// symbol table implementation using a stack of hash tables
1615
typedef marray_t(gravity_hash_t*) ghash_r;

Dependencies/Gravity/src/compiler/gravity_token.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#include "../compiler/gravity_token.h"
1010
#include "../utils/gravity_utils.h"
11-
#include <assert.h>
1211

1312
const char *token_string (gtoken_s token, uint32_t *len) {
1413
if (len) *len = token.bytes;

0 commit comments

Comments
 (0)