Skip to content

Commit a025178

Browse files
committed
Use NotImplementedError
1 parent 3eae4b9 commit a025178

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

lib/truffle/truffle/fiddle_backend.rb

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def self.type_to_nfi(type)
3737
when Fiddle::TYPE_DOUBLE
3838
'DOUBLE'
3939
else
40-
raise "#{type} not implemented"
40+
raise NotImplementedError, "#{type} not implemented"
4141
end
4242
end
4343

@@ -48,7 +48,7 @@ def self.int_type(size)
4848
when SIZEOF_LONG
4949
Fiddle::TYPE_LONG
5050
else
51-
raise
51+
raise NotImplementedError
5252
end
5353
end
5454

@@ -66,7 +66,7 @@ def self.convert_ruby_to_native(type, val)
6666
elsif val.is_a?(Integer)
6767
val
6868
else
69-
raise "#{val.inspect} to pointer"
69+
raise NotImplementedError, "#{val.inspect} to pointer"
7070
end
7171
when Fiddle::TYPE_INT
7272
Integer(val)
@@ -75,7 +75,7 @@ def self.convert_ruby_to_native(type, val)
7575
when Fiddle::TYPE_FLOAT, Fiddle::TYPE_DOUBLE
7676
Float(val)
7777
else
78-
raise "#{val.inspect} to type #{type}"
78+
raise NotImplementedError, "#{val.inspect} to type #{type}"
7979
end
8080
end
8181

@@ -88,7 +88,7 @@ def self.convert_native_to_ruby(type, val)
8888
when Fiddle::TYPE_INT, Fiddle::TYPE_FLOAT, Fiddle::TYPE_DOUBLE
8989
val
9090
else
91-
raise "#{val.inspect} from type #{type}"
91+
raise NotImplementedError, "#{val.inspect} from type #{type}"
9292
end
9393
end
9494

@@ -152,11 +152,11 @@ class DLError < StandardError
152152
BUILD_RUBY_PLATFORM = RUBY_PLATFORM
153153

154154
def self.dlwrap(*args)
155-
raise 'not implemented'
155+
raise NotImplementedError
156156
end
157157

158158
def self.dlunwrap(*args)
159-
raise 'not implemented'
159+
raise NotImplementedError
160160
end
161161

162162
def self.malloc(size)
@@ -205,19 +205,19 @@ def initialize(ret, args, abi = Function::DEFAULT)
205205
end
206206

207207
def to_i(*args)
208-
raise 'not implemented'
208+
raise NotImplementedError
209209
end
210210

211211
end
212212

213213
class Handle
214214

215215
def self.sym(*args)
216-
raise 'not implemented'
216+
raise NotImplementedError
217217
end
218218

219219
def self.[](*args)
220-
raise 'not implemented'
220+
raise NotImplementedError
221221
end
222222

223223
RTLD_LAZY = Truffle::Config['platform.dlopen.RTLD_LAZY']
@@ -234,11 +234,11 @@ def initialize(library = nil, flags = RTLD_LAZY | RTLD_GLOBAL)
234234
end
235235

236236
def to_i(*args)
237-
raise 'not implemented'
237+
raise NotImplementedError
238238
end
239239

240240
def close(*args)
241-
raise 'not implemented'
241+
raise NotImplementedError
242242
end
243243

244244
def sym(name)
@@ -250,32 +250,32 @@ def sym(name)
250250
alias_method :[], :sym
251251

252252
def disable_close(*args)
253-
raise 'not implemented'
253+
raise NotImplementedError
254254
end
255255

256256
def enable_close(*args)
257-
raise 'not implemented'
257+
raise NotImplementedError
258258
end
259259

260260
def close_enabled?(*args)
261-
raise 'not implemented'
261+
raise NotImplementedError
262262
end
263263

264264
end
265265

266266
class Pointer
267267

268268
def self.malloc(*args)
269-
raise 'not implemented'
269+
raise NotImplementedError
270270
end
271271

272272
def self.to_ptr(val)
273273
if val.is_a?(IO)
274-
raise 'not implemented'
274+
raise NotImplementedError
275275
elsif val.is_a?(String)
276276
ptr = Pointer.new(Truffle::CExt.string_pointer_to_native(val), val.bytesize)
277277
elsif val.respond_to?(:to_ptr)
278-
raise 'not implemented'
278+
raise NotImplementedError
279279
else
280280
ptr = Pointer.new(Integer(val))
281281
end
@@ -294,75 +294,75 @@ def initialize(address, size = 0, freefunc = nil)
294294
end
295295

296296
def free=(*args)
297-
raise 'not implemented'
297+
raise NotImplementedError
298298
end
299299

300300
def free(*args)
301-
raise 'not implemented'
301+
raise NotImplementedError
302302
end
303303

304304
def to_i(*args)
305305
@pointer.address
306306
end
307307

308308
def to_int(*args)
309-
raise 'not implemented'
309+
raise NotImplementedError
310310
end
311311

312312
def to_value(*args)
313-
raise 'not implemented'
313+
raise NotImplementedError
314314
end
315315

316316
def ptr(*args)
317-
raise 'not implemented'
317+
raise NotImplementedError
318318
end
319319

320320
def +@(*args)
321-
raise 'not implemented'
321+
raise NotImplementedError
322322
end
323323

324324
def ref(*args)
325-
raise 'not implemented'
325+
raise NotImplementedError
326326
end
327327

328328
def -@(*args)
329-
raise 'not implemented'
329+
raise NotImplementedError
330330
end
331331

332332
def null?(*args)
333-
raise 'not implemented'
333+
raise NotImplementedError
334334
end
335335

336336
def to_s(*args)
337-
raise 'not implemented'
337+
raise NotImplementedError
338338
end
339339

340340
def to_str(*args)
341-
raise 'not implemented'
341+
raise NotImplementedError
342342
end
343343

344344
def inspect(*args)
345-
raise 'not implemented'
345+
raise NotImplementedError
346346
end
347347

348348
def <=>(*args)
349-
raise 'not implemented'
349+
raise NotImplementedError
350350
end
351351

352352
def ==(*args)
353-
raise 'not implemented'
353+
raise NotImplementedError
354354
end
355355

356356
def eql?(*args)
357-
raise 'not implemented'
357+
raise NotImplementedError
358358
end
359359

360360
def +(*args)
361-
raise 'not implemented'
361+
raise NotImplementedError
362362
end
363363

364364
def -(*args)
365-
raise 'not implemented'
365+
raise NotImplementedError
366366
end
367367

368368
def [](start, length = nil)
@@ -374,15 +374,15 @@ def [](start, length = nil)
374374
end
375375

376376
def []=(*args)
377-
raise 'not implemented'
377+
raise NotImplementedError
378378
end
379379

380380
def size(*args)
381-
raise 'not implemented'
381+
raise NotImplementedError
382382
end
383383

384384
def size=(*args)
385-
raise 'not implemented'
385+
raise NotImplementedError
386386
end
387387

388388
NULL = Pointer.new(0)

0 commit comments

Comments
 (0)