Commit 7463eaf2
7463eaf29072Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · ~1 modified · -2 deleted
Description
Revert "feat(codegen): emit <obj>.class as a class-name string literal"
This reverts commit e2a36d6be9266dc2794581553e43d52f319848b6.
Details
- Commit
- 7463eaf29072
- Parent
- ae1a0f329f3d
spinel_codegen.rbmodifiedView file
@@ -3013,18 +3013,6 @@
30133013
end30143014
end30153015
3016-
# `<obj>.class` returns the class name as a string (Spinel3017-
# collapses Class/Module objects to their textual name; the3018-
# only consumers in practice are interpolation3019-
# `"#<#{self.class}>"` and `.to_s.split` chains, both of3020-
# which work fine on a plain string).3021-
if recv >= 0 && mname == "class"3022-
rt = infer_type(recv)3023-
if is_obj_type(rt) == 13024-
return "string"3025-
end3026-
end3027-
30283016
# `recv.__sp_ieval_<N>(...)`: the rewritten form of an30293017
# `recv.instance_eval { ... }` call. v1 only fired on top-level call30303018
# sites, where the call's value was always discarded — so its return@@ -28205,16 +28193,6 @@
2820528193
arrow = "->"2820628194
if @cls_is_value_type[ci] == 12820728195
arrow = "."28208-
end28209-
# `<obj>.class` — collapse to the class name as a string28210-
# literal. Spinel doesn't allocate runtime Class objects,28211-
# but the typical consumers (interpolation in inspect,28212-
# `.to_s.split("::").last` shape) all treat the result as28213-
# a string. Underscore-flattened nested module names28214-
# (`Optcarrot_NES`) render as-is rather than the original28215-
# `Optcarrot::NES` form; the loss is cosmetic.28216-
if mname == "class"28217-
return c_string_literal(cname)2821828196
end2821928197
# attr_reader2822028198
readers = @cls_attr_readers[ci].split(";")test/obj_class_returns_string.rbdeleted
Loading diff…
test/obj_class_returns_string.rb.expecteddeleted
Loading diff…