20
20
#
21
21
# The expressions passed as arguments to `typeof` do not evaluate. The compiler
22
22
# only analyzes their return type.
23
+ #
24
+ # * See [`typeof`](https://crystal-lang.org/reference/syntax_and_semantics/typeof.html) in the language specification.
23
25
def __crystal_pseudo_typeof (* expression) : Class
24
26
end
25
27
45
47
# This is because a `Reference`'s memory is allocated on the heap and a pointer
46
48
# to it is passed around. The size of a class on the heap can be determined
47
49
# using `#instance_sizeof`.
50
+ #
51
+ # * See [`sizeof`](https://crystal-lang.org/reference/syntax_and_semantics/sizeof.html) in the language specification.
48
52
def __crystal_pseudo_sizeof (type : Class ) : Int32
49
53
end
50
54
58
62
# ```
59
63
#
60
64
# See `sizeof` for determining the size of value types.
65
+ #
66
+ # * See [`instance_sizeof`](https://crystal-lang.org/reference/syntax_and_semantics/instance_sizeof.html) in the language specification.
61
67
def __crystal_pseudo_instance_sizeof (type : Class ) : Int32
62
68
end
63
69
82
88
# This is because a `Reference`'s memory is allocated on the heap and a pointer
83
89
# to it is passed around. The alignment of a class on the heap can be determined
84
90
# using `#instance_alignof`.
91
+ #
92
+ # * See [`alignof`](https://crystal-lang.org/reference/syntax_and_semantics/alignof.html) in the language specification.
85
93
def __crystal_pseudo_alignof (type : Class ) : Int32
86
94
end
87
95
95
103
# ```
96
104
#
97
105
# See `alignof` for determining the size of value types.
106
+ #
107
+ # * See [`instance_alignof`](https://crystal-lang.org/reference/syntax_and_semantics/instance_alignof.html) in the language specification.
98
108
def __crystal_pseudo_instance_alignof (type : Class ) : Int32
99
109
end
100
110
109
119
#
110
120
# a # => 2
111
121
# ```
122
+ #
123
+ # * See [`pointerof`](https://crystal-lang.org/reference/syntax_and_semantics/pointerof.html) in the language specification.
112
124
def __crystal_pseudo_pointerof (variable : T ) : Pointer (T ) forall T
113
125
end
114
126
125
137
# offsetof({Int32, Int8, Int32}, 1) # => 4
126
138
# offsetof({Int32, Int8, Int32}, 2) # => 8
127
139
# ```
140
+ #
141
+ # * See [`offsetof`](https://crystal-lang.org/reference/syntax_and_semantics/offsetof.html) in the language specification.
128
142
def __crystal_pseudo_offsetof (type : Class , offset) : Int32
129
143
end
130
144
@@ -155,6 +169,8 @@ class Object
155
169
# a.is_a?(Number) # => true
156
170
# a.is_a?(Int32 | String) # => true
157
171
# ```
172
+ #
173
+ # * See [`is_a?`](https://crystal-lang.org/reference/syntax_and_semantics/is_a.html) in the language specification.
158
174
def __crystal_pseudo_is_a ?(type : Class ) : Bool
159
175
end
160
176
@@ -166,6 +182,8 @@ class Object
166
182
# ```
167
183
#
168
184
# This method is equivalent to `is_a?(Nil)`.
185
+ #
186
+ # * See [`nil?`](https://crystal-lang.org/reference/syntax_and_semantics/nil_question.html) in the language specification.
169
187
def __crystal_pseudo_nil ? : Bool
170
188
end
171
189
@@ -196,6 +214,8 @@ class Object
196
214
# typeof(a.as(Int32 | Bool)) # => Int32
197
215
# a.as(Int32 | Bool) # => 1
198
216
# ```
217
+ #
218
+ # * See [`as`](https://crystal-lang.org/reference/syntax_and_semantics/as.html) in the language specification.
199
219
def __crystal_pseudo_as (type : Class )
200
220
end
201
221
@@ -222,6 +242,8 @@ class Object
222
242
# typeof(a.as?(Int32 | Bool)) # => Int32 | Nil
223
243
# a.as?(Int32 | Bool) # => 1
224
244
# ```
245
+ #
246
+ # * See [`#as?`](https://crystal-lang.org/reference/syntax_and_semantics/as_question.html) in the language specification.
225
247
def __crystal_pseudo_as ?(type : Class )
226
248
end
227
249
@@ -234,6 +256,8 @@ class Object
234
256
# a.responds_to?(:abs) # => true
235
257
# a.responds_to?(:size) # => false
236
258
# ```
259
+ #
260
+ # * See [`#responds_to?`](https://crystal-lang.org/reference/syntax_and_semantics/responds_to.html) in the language specification.
237
261
def __crystal_pseudo_responds_to ?(name : Symbol ) : Bool
238
262
end
239
263
end
0 commit comments