Revert "gen: add type name to comp for (#10881)"
Reason:pull/10353/head713a079
is more general and provides the same information. This reverts commitdd3ee20566
.
parent
dd3ee20566
commit
06de9c799c
|
@ -108,7 +108,6 @@ pub:
|
||||||
args []MethodArgs
|
args []MethodArgs
|
||||||
return_type int
|
return_type int
|
||||||
typ int
|
typ int
|
||||||
type_name string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FieldData holds information about a field. Fields reside on structs.
|
// FieldData holds information about a field. Fields reside on structs.
|
||||||
|
@ -120,7 +119,6 @@ pub:
|
||||||
is_mut bool
|
is_mut bool
|
||||||
is_shared bool
|
is_shared bool
|
||||||
typ int
|
typ int
|
||||||
type_name string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum AttributeKind {
|
enum AttributeKind {
|
||||||
|
|
|
@ -459,7 +459,6 @@ fn (mut g Gen) comp_for(node ast.CompFor) {
|
||||||
ret_typ := method.return_type.idx()
|
ret_typ := method.return_type.idx()
|
||||||
g.writeln('\t${node.val_var}.typ = $styp;')
|
g.writeln('\t${node.val_var}.typ = $styp;')
|
||||||
g.writeln('\t${node.val_var}.return_type = $ret_typ;')
|
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}.return_type'] = ret_typ
|
||||||
g.comptime_var_type_map['${node.val_var}.typ'] = styp
|
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");')
|
// g.writeln('\t${node.val_var}.typ = _SLIT("$field_sym.name");')
|
||||||
styp := field.typ
|
styp := field.typ
|
||||||
g.writeln('\t${node.val_var}.typ = $styp;')
|
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_pub = $field.is_pub;')
|
||||||
g.writeln('\t${node.val_var}.is_mut = $field.is_mut;')
|
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)};')
|
g.writeln('\t${node.val_var}.is_shared = ${field.typ.has_flag(.shared_f)};')
|
||||||
|
|
|
@ -68,7 +68,6 @@ fn test_comptime_for_fields() {
|
||||||
$for field in App.fields {
|
$for field in App.fields {
|
||||||
println(' field: $field.name | ' + no_lines('$field'))
|
println(' field: $field.name | ' + no_lines('$field'))
|
||||||
$if field.typ is string {
|
$if field.typ is string {
|
||||||
assert field.type_name == 'string'
|
|
||||||
assert field.name in ['a', 'b', 'g']
|
assert field.name in ['a', 'b', 'g']
|
||||||
}
|
}
|
||||||
$if field.typ is f32 {
|
$if field.typ is f32 {
|
||||||
|
|
Loading…
Reference in New Issue