diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-04-13 19:29:17 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-04-13 19:29:17 +0100 |
| commit | d8d22e34dd63547cb6492e8e15b55fcaec4cb3e5 (patch) | |
| tree | 2356e8733f06e73af03391f0511f965661bd4d3e /src | |
| parent | 627ee002e8d09a00b29c7e5a9f1cf6d96a48b57f (diff) | |
Fix fmt for type; remove dead stuff
Diffstat (limited to 'src')
| -rw-r--r-- | src/checker.c | 9 | ||||
| -rw-r--r-- | src/ir.c | 7 | ||||
| -rw-r--r-- | src/parser.c | 17 |
3 files changed, 4 insertions, 29 deletions
diff --git a/src/checker.c b/src/checker.c index 22b48ca00..f8ecac489 100644 --- a/src/checker.c +++ b/src/checker.c @@ -28,7 +28,6 @@ typedef enum BuiltinProcId { BuiltinProc_new, BuiltinProc_free, - // BuiltinProc_new_slice, BuiltinProc_make, BuiltinProc_reserve, @@ -64,8 +63,6 @@ typedef enum BuiltinProcId { BuiltinProc_kmag, BuiltinProc_conj, - // BuiltinProc_ptr_offset, - // BuiltinProc_ptr_sub, BuiltinProc_slice_ptr, BuiltinProc_slice_to_bytes, @@ -84,7 +81,6 @@ gb_global BuiltinProc builtin_procs[BuiltinProc_Count] = { {STR_LIT("new"), 1, false, Expr_Expr}, {STR_LIT("free"), 1, false, Expr_Stmt}, - // {STR_LIT("new_slice"), 2, true, Expr_Expr}, {STR_LIT("make"), 1, true, Expr_Expr}, {STR_LIT("reserve"), 2, false, Expr_Stmt}, @@ -108,7 +104,6 @@ gb_global BuiltinProc builtin_procs[BuiltinProc_Count] = { {STR_LIT("panic"), 1, false, Expr_Stmt}, {STR_LIT("copy"), 2, false, Expr_Expr}, - // {STR_LIT("append"), 2, false, Expr_Expr}, {STR_LIT("swizzle"), 1, true, Expr_Expr}, @@ -120,8 +115,6 @@ gb_global BuiltinProc builtin_procs[BuiltinProc_Count] = { {STR_LIT("kmag"), 1, false, Expr_Expr}, {STR_LIT("conj"), 1, false, Expr_Expr}, - // {STR_LIT("ptr_offset"), 2, false, Expr_Expr}, - // {STR_LIT("ptr_sub"), 2, false, Expr_Expr}, {STR_LIT("slice_ptr"), 2, true, Expr_Expr}, {STR_LIT("slice_to_bytes"), 1, false, Expr_Stmt}, @@ -310,7 +303,7 @@ typedef struct CheckerInfo { MapScope scopes; // Key: AstNode * | Node -> Scope MapExprInfo untyped; // Key: AstNode * | Expression -> ExprInfo MapDeclInfo entities; // Key: Entity * - MapEntity implicits; // Key: AstNode * + MapEntity implicits; // Key: AstNode * MapEntity foreigns; // Key: String MapAstFile files; // Key: String (full path) MapIsize type_info_map; // Key: Type * @@ -5410,11 +5410,9 @@ void ir_build_range_string(irProcedure *proc, irValue *expr, Type *val_type, irBlock *done = NULL; irBlock *body = NULL; - irValue *index = ir_add_local_generated(proc, t_int); - ir_emit_store(proc, index, v_zero); irValue *offset_ = ir_add_local_generated(proc, t_int); - ir_emit_store(proc, index, v_zero); + ir_emit_store(proc, offset_, v_zero); loop = ir_new_block(proc, NULL, "for.string.loop"); ir_emit_jump(proc, loop); @@ -5441,11 +5439,10 @@ void ir_build_range_string(irProcedure *proc, irValue *expr, Type *val_type, ir_emit_store(proc, offset_, ir_emit_arith(proc, Token_Add, offset, len, t_int)); - idx = ir_emit_load(proc, index); + idx = offset; if (val_type != NULL) { val = ir_emit_struct_ev(proc, rune_and_len, 0); } - ir_emit_increment(proc, index); if (val_) *val_ = val; if (idx_) *idx_ = idx; diff --git a/src/parser.c b/src/parser.c index 8e56279ab..e9c1a9a44 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1724,11 +1724,7 @@ AstNode *parse_operand(AstFile *f, bool lhs) { AstNode *operand = NULL; // Operand switch (f->curr_token.kind) { case Token_Ident: - operand = parse_ident(f); - if (!lhs) { - // TODO(bill): Handle? - } - return operand; + return parse_ident(f); case Token_context: return ast_implicit(f, expect_token(f, Token_context)); @@ -1834,17 +1830,6 @@ AstNode *parse_operand(AstFile *f, bool lhs) { return type; } - // case Token_if: - // if (!lhs && f->expr_level >= 0) { - // return parse_if_expr(f); - // } - // break; - // case Token_OpenBrace: - // if (!lhs && f->expr_level >= 0) { - // return parse_block_expr(f); - // } - // break; - default: { AstNode *type = parse_type_or_ident(f); if (type != NULL) { |