Replace typeOf with TypeOf in stage0

master
Robin Voetter 2019-12-09 21:34:40 +01:00 committed by Andrew Kelley
parent c519bb02df
commit f0ee0688f2
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
6 changed files with 17 additions and 17 deletions

View File

@ -2393,7 +2393,7 @@ struct ScopeFnDef {
ZigFn *fn_entry;
};
// This scope is created for a @typeOf.
// This scope is created for a @TypeOf.
// All runtime side-effects are elided within it.
// NodeTypeFnCallExpr
struct ScopeTypeOf {

View File

@ -121,7 +121,7 @@ static ScopeExpr *find_expr_scope(Scope *scope) {
}
static void update_progress_display(CodeGen *g) {
stage2_progress_update_node(g->sub_progress_node,
stage2_progress_update_node(g->sub_progress_node,
g->resolve_queue_index + g->fn_defs_index,
g->resolve_queue.length + g->fn_defs.length);
}
@ -1732,7 +1732,7 @@ Error type_allowed_in_extern(CodeGen *g, ZigType *type_entry, bool *result) {
ZigType *get_auto_err_set_type(CodeGen *g, ZigFn *fn_entry) {
ZigType *err_set_type = new_type_table_entry(ZigTypeIdErrorSet);
buf_resize(&err_set_type->name, 0);
buf_appendf(&err_set_type->name, "@typeOf(%s).ReturnType.ErrorSet", buf_ptr(&fn_entry->symbol_name));
buf_appendf(&err_set_type->name, "@TypeOf(%s).ReturnType.ErrorSet", buf_ptr(&fn_entry->symbol_name));
err_set_type->data.error_set.err_count = 0;
err_set_type->data.error_set.errors = nullptr;
err_set_type->data.error_set.infer_fn = fn_entry;

View File

@ -1647,7 +1647,7 @@ static void gen_assign_raw(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_type,
ptr_type->data.pointer.vector_index, false);
LLVMValueRef loaded_vector = gen_load(g, ptr, ptr_type, "");
LLVMValueRef new_vector = LLVMBuildInsertElement(g->builder, loaded_vector, value,
index_val, "");
index_val, "");
gen_store(g, new_vector, ptr, ptr_type);
return;
}
@ -8067,7 +8067,7 @@ static void define_builtin_fns(CodeGen *g) {
create_builtin_fn(g, BuiltinFnIdTypeInfo, "typeInfo", 1);
create_builtin_fn(g, BuiltinFnIdType, "Type", 1);
create_builtin_fn(g, BuiltinFnIdHasField, "hasField", 2);
create_builtin_fn(g, BuiltinFnIdTypeof, "typeOf", 1); // TODO rename to TypeOf
create_builtin_fn(g, BuiltinFnIdTypeof, "TypeOf", 1);
create_builtin_fn(g, BuiltinFnIdAddWithOverflow, "addWithOverflow", 4);
create_builtin_fn(g, BuiltinFnIdSubWithOverflow, "subWithOverflow", 4);
create_builtin_fn(g, BuiltinFnIdMulWithOverflow, "mulWithOverflow", 4);
@ -8407,7 +8407,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) {
break;
}
buf_appendf(contents, "pub const output_mode = OutputMode.%s;\n", out_type);
const char *link_type = g->is_dynamic ? "Dynamic" : "Static";
const char *link_type = g->is_dynamic ? "Dynamic" : "Static";
buf_appendf(contents, "pub const link_mode = LinkMode.%s;\n", link_type);
buf_appendf(contents, "pub const is_test = %s;\n", bool_to_str(g->is_test_build));
buf_appendf(contents, "pub const single_threaded = %s;\n", bool_to_str(g->is_single_threaded));

View File

@ -9267,7 +9267,7 @@ static ZigValue *ir_exec_const_result(CodeGen *codegen, IrExecutable *exec) {
}
}
if (get_scope_typeof(instruction->scope) != nullptr) {
// doesn't count, it's inside a @typeOf()
// doesn't count, it's inside a @TypeOf()
continue;
}
exec_add_error_node(codegen, exec, instruction->source_node,
@ -10413,7 +10413,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted
return result;
}
bool ok_cv_qualifiers =
bool ok_cv_qualifiers =
(!actual_ptr_type->data.pointer.is_const || wanted_ptr_type->data.pointer.is_const) &&
(!actual_ptr_type->data.pointer.is_volatile || wanted_ptr_type->data.pointer.is_volatile);
if (!ok_cv_qualifiers) {
@ -13779,7 +13779,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
(wanted_type->id == ZigTypeIdOptional && wanted_type->data.maybe.child_type->id == ZigTypeIdEnum))
{
IrInstruction *result = ir_analyze_enum_literal(ira, source_instr, value, wanted_type->data.maybe.child_type);
if (result == ira->codegen->invalid_instruction)
if (result == ira->codegen->invalid_instruction)
return result;
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
(wanted_type->id == ZigTypeIdErrorUnion && wanted_type->data.error_union.payload_type->id == ZigTypeIdEnum))
{
IrInstruction *result = ir_analyze_enum_literal(ira, source_instr, value, wanted_type->data.error_union.payload_type);
if (result == ira->codegen->invalid_instruction)
if (result == ira->codegen->invalid_instruction)
return result;
return ir_analyze_err_wrap_payload(ira, result, value, wanted_type, nullptr);
}
@ -19328,7 +19328,7 @@ static IrInstruction *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruct
{
size_t offset = ptr_field->data.x_ptr.data.base_array.elem_index;
uint64_t new_index = offset + index;
if (ptr_field->data.x_ptr.data.base_array.array_val->data.x_array.special !=
if (ptr_field->data.x_ptr.data.base_array.array_val->data.x_array.special !=
ConstArraySpecialBuf)
{
ir_assert(new_index <

View File

@ -873,7 +873,7 @@ static void ir_print_vector_store_elem(IrPrint *irp, IrInstructionVectorStoreEle
}
static void ir_print_typeof(IrPrint *irp, IrInstructionTypeOf *instruction) {
fprintf(irp->f, "@typeOf(");
fprintf(irp->f, "@TypeOf(");
ir_print_other_instruction(irp, instruction->value);
fprintf(irp->f, ")");
}

View File

@ -4230,7 +4230,7 @@ static AstNode *resolve_typedef_decl(Context *c, const ZigClangTypedefNameDecl *
emit_warning(c, ZigClangTypedefNameDecl_getLocation(typedef_decl),
"typedef %s - unresolved child type", buf_ptr(type_name));
c->decl_table.put(typedef_decl, nullptr);
// TODO add global var with type_name equal to @compileError("unable to resolve C type")
// TODO add global var with type_name equal to @compileError("unable to resolve C type")
return nullptr;
}
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
*tok_i += 1;
//if (@typeId(@typeOf(x)) == @import("builtin").TypeId.Pointer)
//if (@typeId(@TypeOf(x)) == @import("builtin").TypeId.Pointer)
// @ptrCast(dest, x)
//else if (@typeId(@typeOf(x)) == @import("builtin").TypeId.Integer)
//else if (@typeId(@TypeOf(x)) == @import("builtin").TypeId.Integer)
// @intToPtr(dest, x)
//else
// (dest)(x)
@ -4931,7 +4931,7 @@ static AstNode *parse_ctok_primary_expr(Context *c, CTokenize *ctok, size_t *tok
AstNode *typeid_type = trans_create_node_field_access_str(c, import_builtin, "TypeId");
AstNode *typeid_pointer = trans_create_node_field_access_str(c, typeid_type, "Pointer");
AstNode *typeid_integer = trans_create_node_field_access_str(c, typeid_type, "Int");
AstNode *typeof_x = trans_create_node_builtin_fn_call_str(c, "typeOf");
AstNode *typeof_x = trans_create_node_builtin_fn_call_str(c, "TypeOf");
typeof_x->data.fn_call_expr.params.append(node_to_cast);
AstNode *typeid_value = trans_create_node_builtin_fn_call_str(c, "typeId");
typeid_value->data.fn_call_expr.params.append(typeof_x);