From 06de9c799c8d9b1dab91b22346964c9b3c74655f Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 21 Jul 2021 23:56:00 +0300 Subject: [PATCH] Revert "gen: add type name to comp for (#10881)" Reason: 713a079 is more general and provides the same information. This reverts commit dd3ee205663542a5aad6c6de01c1bdab6c68260b. --- vlib/builtin/builtin.v | 2 -- vlib/v/gen/c/comptime.v | 2 -- vlib/v/tests/comptime_for_test.v | 1 - 3 files changed, 5 deletions(-) diff --git a/vlib/builtin/builtin.v b/vlib/builtin/builtin.v index eb3b43c2bb..ec6ebc813a 100644 --- a/vlib/builtin/builtin.v +++ b/vlib/builtin/builtin.v @@ -108,7 +108,6 @@ pub: args []MethodArgs return_type int typ int - type_name string } // FieldData holds information about a field. Fields reside on structs. @@ -120,7 +119,6 @@ pub: is_mut bool is_shared bool typ int - type_name string } enum AttributeKind { diff --git a/vlib/v/gen/c/comptime.v b/vlib/v/gen/c/comptime.v index d32695db53..78ed3ff44c 100644 --- a/vlib/v/gen/c/comptime.v +++ b/vlib/v/gen/c/comptime.v @@ -459,7 +459,6 @@ fn (mut g Gen) comp_for(node ast.CompFor) { ret_typ := method.return_type.idx() g.writeln('\t${node.val_var}.typ = $styp;') g.writeln('\t${node.val_var}.return_type = $ret_typ;') - g.writeln('\t${node.val_var}.type_name = _SLIT("${g.table.get_type_symbol(ret_typ).name}");') // g.comptime_var_type_map['${node.val_var}.return_type'] = ret_typ g.comptime_var_type_map['${node.val_var}.typ'] = styp @@ -503,7 +502,6 @@ fn (mut g Gen) comp_for(node ast.CompFor) { // g.writeln('\t${node.val_var}.typ = _SLIT("$field_sym.name");') styp := field.typ g.writeln('\t${node.val_var}.typ = $styp;') - g.writeln('\t${node.val_var}.type_name = _SLIT("${g.table.get_type_symbol(styp).name}");') g.writeln('\t${node.val_var}.is_pub = $field.is_pub;') g.writeln('\t${node.val_var}.is_mut = $field.is_mut;') g.writeln('\t${node.val_var}.is_shared = ${field.typ.has_flag(.shared_f)};') diff --git a/vlib/v/tests/comptime_for_test.v b/vlib/v/tests/comptime_for_test.v index a49df3ef2b..4c070fc0c6 100644 --- a/vlib/v/tests/comptime_for_test.v +++ b/vlib/v/tests/comptime_for_test.v @@ -68,7 +68,6 @@ fn test_comptime_for_fields() { $for field in App.fields { println(' field: $field.name | ' + no_lines('$field')) $if field.typ is string { - assert field.type_name == 'string' assert field.name in ['a', 'b', 'g'] } $if field.typ is f32 {