authorgravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2019-12-09 21:34:40+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-12-10 11:09:30-05:00
logf0ee0688f20dd012b4e069324abdba081ff19369
tree1ce5af447206921e64411fbf9b14cbf9127f0dc5
parentc519bb02df4df0938c5ac12e8b4e8f8ab503df63
signature Commit is signed but in an unrecognized format.

Replace typeOf with TypeOf in stage0


6 files changed, 17 insertions(+), 17 deletions(-)

src/all_types.hpp+1-1
...@@ -2393,7 +2393,7 @@ struct ScopeFnDef {...@@ -2393,7 +2393,7 @@ struct ScopeFnDef {
2393 ZigFn *fn_entry;2393 ZigFn *fn_entry;
2394};2394};
23952395
2396// This scope is created for a @typeOf.2396// This scope is created for a @TypeOf.
2397// All runtime side-effects are elided within it.2397// All runtime side-effects are elided within it.
2398// NodeTypeFnCallExpr2398// NodeTypeFnCallExpr
2399struct ScopeTypeOf {2399struct ScopeTypeOf {
src/analyze.cpp+2-2
...@@ -121,7 +121,7 @@ static ScopeExpr *find_expr_scope(Scope *scope) {...@@ -121,7 +121,7 @@ static ScopeExpr *find_expr_scope(Scope *scope) {
121}121}
122122
123static void update_progress_display(CodeGen *g) {123static void update_progress_display(CodeGen *g) {
124 stage2_progress_update_node(g->sub_progress_node, 124 stage2_progress_update_node(g->sub_progress_node,
125 g->resolve_queue_index + g->fn_defs_index,125 g->resolve_queue_index + g->fn_defs_index,
126 g->resolve_queue.length + g->fn_defs.length);126 g->resolve_queue.length + g->fn_defs.length);
127}127}
...@@ -1732,7 +1732,7 @@ Error type_allowed_in_extern(CodeGen *g, ZigType *type_entry, bool *result) {...@@ -1732,7 +1732,7 @@ Error type_allowed_in_extern(CodeGen *g, ZigType *type_entry, bool *result) {
1732ZigType *get_auto_err_set_type(CodeGen *g, ZigFn *fn_entry) {1732ZigType *get_auto_err_set_type(CodeGen *g, ZigFn *fn_entry) {
1733 ZigType *err_set_type = new_type_table_entry(ZigTypeIdErrorSet);1733 ZigType *err_set_type = new_type_table_entry(ZigTypeIdErrorSet);
1734 buf_resize(&err_set_type->name, 0);1734 buf_resize(&err_set_type->name, 0);
1735 buf_appendf(&err_set_type->name, "@typeOf(%s).ReturnType.ErrorSet", buf_ptr(&fn_entry->symbol_name));1735 buf_appendf(&err_set_type->name, "@TypeOf(%s).ReturnType.ErrorSet", buf_ptr(&fn_entry->symbol_name));
1736 err_set_type->data.error_set.err_count = 0;1736 err_set_type->data.error_set.err_count = 0;
1737 err_set_type->data.error_set.errors = nullptr;1737 err_set_type->data.error_set.errors = nullptr;
1738 err_set_type->data.error_set.infer_fn = fn_entry;1738 err_set_type->data.error_set.infer_fn = fn_entry;
src/codegen.cpp+3-3
...@@ -1647,7 +1647,7 @@ static void gen_assign_raw(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_type,...@@ -1647,7 +1647,7 @@ static void gen_assign_raw(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_type,
1647 ptr_type->data.pointer.vector_index, false);1647 ptr_type->data.pointer.vector_index, false);
1648 LLVMValueRef loaded_vector = gen_load(g, ptr, ptr_type, "");1648 LLVMValueRef loaded_vector = gen_load(g, ptr, ptr_type, "");
1649 LLVMValueRef new_vector = LLVMBuildInsertElement(g->builder, loaded_vector, value,1649 LLVMValueRef new_vector = LLVMBuildInsertElement(g->builder, loaded_vector, value,
1650 index_val, ""); 1650 index_val, "");
1651 gen_store(g, new_vector, ptr, ptr_type);1651 gen_store(g, new_vector, ptr, ptr_type);
1652 return;1652 return;
1653 }1653 }
...@@ -8067,7 +8067,7 @@ static void define_builtin_fns(CodeGen *g) {...@@ -8067,7 +8067,7 @@ static void define_builtin_fns(CodeGen *g) {
8067 create_builtin_fn(g, BuiltinFnIdTypeInfo, "typeInfo", 1);8067 create_builtin_fn(g, BuiltinFnIdTypeInfo, "typeInfo", 1);
8068 create_builtin_fn(g, BuiltinFnIdType, "Type", 1);8068 create_builtin_fn(g, BuiltinFnIdType, "Type", 1);
8069 create_builtin_fn(g, BuiltinFnIdHasField, "hasField", 2);8069 create_builtin_fn(g, BuiltinFnIdHasField, "hasField", 2);
8070 create_builtin_fn(g, BuiltinFnIdTypeof, "typeOf", 1); // TODO rename to TypeOf8070 create_builtin_fn(g, BuiltinFnIdTypeof, "TypeOf", 1);
8071 create_builtin_fn(g, BuiltinFnIdAddWithOverflow, "addWithOverflow", 4);8071 create_builtin_fn(g, BuiltinFnIdAddWithOverflow, "addWithOverflow", 4);
8072 create_builtin_fn(g, BuiltinFnIdSubWithOverflow, "subWithOverflow", 4);8072 create_builtin_fn(g, BuiltinFnIdSubWithOverflow, "subWithOverflow", 4);
8073 create_builtin_fn(g, BuiltinFnIdMulWithOverflow, "mulWithOverflow", 4);8073 create_builtin_fn(g, BuiltinFnIdMulWithOverflow, "mulWithOverflow", 4);
...@@ -8407,7 +8407,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) {...@@ -8407,7 +8407,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) {
8407 break;8407 break;
8408 }8408 }
8409 buf_appendf(contents, "pub const output_mode = OutputMode.%s;\n", out_type);8409 buf_appendf(contents, "pub const output_mode = OutputMode.%s;\n", out_type);
8410 const char *link_type = g->is_dynamic ? "Dynamic" : "Static"; 8410 const char *link_type = g->is_dynamic ? "Dynamic" : "Static";
8411 buf_appendf(contents, "pub const link_mode = LinkMode.%s;\n", link_type);8411 buf_appendf(contents, "pub const link_mode = LinkMode.%s;\n", link_type);
8412 buf_appendf(contents, "pub const is_test = %s;\n", bool_to_str(g->is_test_build));8412 buf_appendf(contents, "pub const is_test = %s;\n", bool_to_str(g->is_test_build));
8413 buf_appendf(contents, "pub const single_threaded = %s;\n", bool_to_str(g->is_single_threaded));8413 buf_appendf(contents, "pub const single_threaded = %s;\n", bool_to_str(g->is_single_threaded));
src/ir.cpp+6-6
...@@ -9267,7 +9267,7 @@ static ZigValue *ir_exec_const_result(CodeGen *codegen, IrExecutable *exec) {...@@ -9267,7 +9267,7 @@ static ZigValue *ir_exec_const_result(CodeGen *codegen, IrExecutable *exec) {
9267 }9267 }
9268 }9268 }
9269 if (get_scope_typeof(instruction->scope) != nullptr) {9269 if (get_scope_typeof(instruction->scope) != nullptr) {
9270 // doesn't count, it's inside a @typeOf()9270 // doesn't count, it's inside a @TypeOf()
9271 continue;9271 continue;
9272 }9272 }
9273 exec_add_error_node(codegen, exec, instruction->source_node,9273 exec_add_error_node(codegen, exec, instruction->source_node,
...@@ -10413,7 +10413,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted...@@ -10413,7 +10413,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted
10413 return result;10413 return result;
10414 }10414 }
1041510415
10416 bool ok_cv_qualifiers = 10416 bool ok_cv_qualifiers =
10417 (!actual_ptr_type->data.pointer.is_const || wanted_ptr_type->data.pointer.is_const) &&10417 (!actual_ptr_type->data.pointer.is_const || wanted_ptr_type->data.pointer.is_const) &&
10418 (!actual_ptr_type->data.pointer.is_volatile || wanted_ptr_type->data.pointer.is_volatile);10418 (!actual_ptr_type->data.pointer.is_volatile || wanted_ptr_type->data.pointer.is_volatile);
10419 if (!ok_cv_qualifiers) {10419 if (!ok_cv_qualifiers) {
...@@ -13779,7 +13779,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst...@@ -13779,7 +13779,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
13779 (wanted_type->id == ZigTypeIdOptional && wanted_type->data.maybe.child_type->id == ZigTypeIdEnum))13779 (wanted_type->id == ZigTypeIdOptional && wanted_type->data.maybe.child_type->id == ZigTypeIdEnum))
13780 {13780 {
13781 IrInstruction *result = ir_analyze_enum_literal(ira, source_instr, value, wanted_type->data.maybe.child_type);13781 IrInstruction *result = ir_analyze_enum_literal(ira, source_instr, value, wanted_type->data.maybe.child_type);
13782 if (result == ira->codegen->invalid_instruction) 13782 if (result == ira->codegen->invalid_instruction)
13783 return result;13783 return result;
1378413784
13785 return ir_analyze_optional_wrap(ira, result, value, wanted_type, nullptr);13785 return ir_analyze_optional_wrap(ira, result, value, wanted_type, nullptr);
...@@ -13790,9 +13790,9 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst...@@ -13790,9 +13790,9 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
13790 (wanted_type->id == ZigTypeIdErrorUnion && wanted_type->data.error_union.payload_type->id == ZigTypeIdEnum))13790 (wanted_type->id == ZigTypeIdErrorUnion && wanted_type->data.error_union.payload_type->id == ZigTypeIdEnum))
13791 {13791 {
13792 IrInstruction *result = ir_analyze_enum_literal(ira, source_instr, value, wanted_type->data.error_union.payload_type);13792 IrInstruction *result = ir_analyze_enum_literal(ira, source_instr, value, wanted_type->data.error_union.payload_type);
13793 if (result == ira->codegen->invalid_instruction) 13793 if (result == ira->codegen->invalid_instruction)
13794 return result;13794 return result;
13795 13795
13796 return ir_analyze_err_wrap_payload(ira, result, value, wanted_type, nullptr);13796 return ir_analyze_err_wrap_payload(ira, result, value, wanted_type, nullptr);
13797 }13797 }
1379813798
...@@ -19328,7 +19328,7 @@ static IrInstruction *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruct...@@ -19328,7 +19328,7 @@ static IrInstruction *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruct
19328 {19328 {
19329 size_t offset = ptr_field->data.x_ptr.data.base_array.elem_index;19329 size_t offset = ptr_field->data.x_ptr.data.base_array.elem_index;
19330 uint64_t new_index = offset + index;19330 uint64_t new_index = offset + index;
19331 if (ptr_field->data.x_ptr.data.base_array.array_val->data.x_array.special != 19331 if (ptr_field->data.x_ptr.data.base_array.array_val->data.x_array.special !=
19332 ConstArraySpecialBuf)19332 ConstArraySpecialBuf)
19333 {19333 {
19334 ir_assert(new_index <19334 ir_assert(new_index <
src/ir_print.cpp+1-1
...@@ -873,7 +873,7 @@ static void ir_print_vector_store_elem(IrPrint *irp, IrInstructionVectorStoreEle...@@ -873,7 +873,7 @@ static void ir_print_vector_store_elem(IrPrint *irp, IrInstructionVectorStoreEle
873}873}
874874
875static void ir_print_typeof(IrPrint *irp, IrInstructionTypeOf *instruction) {875static void ir_print_typeof(IrPrint *irp, IrInstructionTypeOf *instruction) {
876 fprintf(irp->f, "@typeOf(");876 fprintf(irp->f, "@TypeOf(");
877 ir_print_other_instruction(irp, instruction->value);877 ir_print_other_instruction(irp, instruction->value);
878 fprintf(irp->f, ")");878 fprintf(irp->f, ")");
879}879}
src/translate_c.cpp+4-4
...@@ -4230,7 +4230,7 @@ static AstNode *resolve_typedef_decl(Context *c, const ZigClangTypedefNameDecl *...@@ -4230,7 +4230,7 @@ static AstNode *resolve_typedef_decl(Context *c, const ZigClangTypedefNameDecl *
4230 emit_warning(c, ZigClangTypedefNameDecl_getLocation(typedef_decl),4230 emit_warning(c, ZigClangTypedefNameDecl_getLocation(typedef_decl),
4231 "typedef %s - unresolved child type", buf_ptr(type_name));4231 "typedef %s - unresolved child type", buf_ptr(type_name));
4232 c->decl_table.put(typedef_decl, nullptr);4232 c->decl_table.put(typedef_decl, nullptr);
4233 // TODO add global var with type_name equal to @compileError("unable to resolve C type") 4233 // TODO add global var with type_name equal to @compileError("unable to resolve C type")
4234 return nullptr;4234 return nullptr;
4235 }4235 }
4236 add_global_var(c, type_name, type_node);4236 add_global_var(c, type_name, type_node);
...@@ -4919,9 +4919,9 @@ static AstNode *parse_ctok_primary_expr(Context *c, CTokenize *ctok, size_t *tok...@@ -4919,9 +4919,9 @@ static AstNode *parse_ctok_primary_expr(Context *c, CTokenize *ctok, size_t *tok
4919 *tok_i += 1;4919 *tok_i += 1;
49204920
49214921
4922 //if (@typeId(@typeOf(x)) == @import("builtin").TypeId.Pointer)4922 //if (@typeId(@TypeOf(x)) == @import("builtin").TypeId.Pointer)
4923 // @ptrCast(dest, x)4923 // @ptrCast(dest, x)
4924 //else if (@typeId(@typeOf(x)) == @import("builtin").TypeId.Integer)4924 //else if (@typeId(@TypeOf(x)) == @import("builtin").TypeId.Integer)
4925 // @intToPtr(dest, x)4925 // @intToPtr(dest, x)
4926 //else4926 //else
4927 // (dest)(x)4927 // (dest)(x)
...@@ -4931,7 +4931,7 @@ static AstNode *parse_ctok_primary_expr(Context *c, CTokenize *ctok, size_t *tok...@@ -4931,7 +4931,7 @@ static AstNode *parse_ctok_primary_expr(Context *c, CTokenize *ctok, size_t *tok
4931 AstNode *typeid_type = trans_create_node_field_access_str(c, import_builtin, "TypeId");4931 AstNode *typeid_type = trans_create_node_field_access_str(c, import_builtin, "TypeId");
4932 AstNode *typeid_pointer = trans_create_node_field_access_str(c, typeid_type, "Pointer");4932 AstNode *typeid_pointer = trans_create_node_field_access_str(c, typeid_type, "Pointer");
4933 AstNode *typeid_integer = trans_create_node_field_access_str(c, typeid_type, "Int");4933 AstNode *typeid_integer = trans_create_node_field_access_str(c, typeid_type, "Int");
4934 AstNode *typeof_x = trans_create_node_builtin_fn_call_str(c, "typeOf");4934 AstNode *typeof_x = trans_create_node_builtin_fn_call_str(c, "TypeOf");
4935 typeof_x->data.fn_call_expr.params.append(node_to_cast);4935 typeof_x->data.fn_call_expr.params.append(node_to_cast);
4936 AstNode *typeid_value = trans_create_node_builtin_fn_call_str(c, "typeId");4936 AstNode *typeid_value = trans_create_node_builtin_fn_call_str(c, "typeId");
4937 typeid_value->data.fn_call_expr.params.append(typeof_x);4937 typeid_value->data.fn_call_expr.params.append(typeof_x);