is_a 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,6 +19,8 @@ hdrs = ->{
19
19
  res = %w{
20
20
  vm_core.h
21
21
  }.all?{|hdr| have_header(hdr)}
22
+ have_struct_member("rb_iseq_t", "location", "vm_core.h")
23
+ have_func("rb_vm_get_sourceline", "vm_core.h")
22
24
  res
23
25
  }
24
26
 
@@ -24,6 +24,27 @@ rb_object_id_of(VALUE self, VALUE obj)
24
24
  #include "ruby/encoding.h"
25
25
  #include "vm_core.h"
26
26
 
27
+ #ifndef ID_ALLOCATOR
28
+ #define ID_ALLOCATOR 0
29
+ #endif
30
+
31
+ #ifndef HAVE_RB_VM_GET_SOURCELINE
32
+ inline static int
33
+ calc_lineno(const rb_iseq_t *iseq, const VALUE *pc)
34
+ {
35
+ return rb_iseq_line_no(iseq, pc - iseq->iseq_encoded);
36
+ }
37
+ int rb_vm_get_sourceline(const rb_control_frame_t * cfp){
38
+ int lineno = 0;
39
+ const rb_iseq_t *iseq = cfp->iseq;
40
+
41
+ if (RUBY_VM_NORMAL_ISEQ_P(iseq)) {
42
+ lineno = calc_lineno(cfp->iseq, cfp->pc);
43
+ }
44
+ return lineno;
45
+ }
46
+ #endif
47
+
27
48
  #define HAVE_CALLER_AT
28
49
  static VALUE caller_line(int offset)
29
50
  {
@@ -42,10 +63,22 @@ static VALUE caller_line(int offset)
42
63
  if (cfp->pc != 0) {
43
64
  rb_iseq_t *iseq = cfp->iseq;
44
65
  int line_no = rb_vm_get_sourceline(cfp);
66
+
67
+ #ifndef HAVE_RB_ISEQ_T_LOCATION
45
68
  VALUE file = iseq->filename;
69
+ #else
70
+ VALUE file = iseq->location.path;
71
+ #endif
72
+
46
73
  //name may be passed from previous iteration
47
74
  if(!name)
48
- name = iseq->name;
75
+ name =
76
+ #ifdef HAVE_RB_ISEQ_T_LOCATION
77
+ iseq->location.label;
78
+ #else
79
+ iseq->name;
80
+ #endif
81
+
49
82
  if (line_no) {
50
83
  return rb_enc_sprintf(
51
84
  rb_enc_compatible(file, name),
@@ -1,3 +1,3 @@
1
1
  module IsA
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: is_a
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-03 00:00:00.000000000 Z
12
+ date: 2013-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: debugger-ruby_core_source
@@ -92,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  segments:
94
94
  - 0
95
- hash: 2510194417071522637
95
+ hash: 4587415308896797553
96
96
  required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  segments:
103
103
  - 0
104
- hash: 2510194417071522637
104
+ hash: 4587415308896797553
105
105
  requirements: []
106
106
  rubyforge_project:
107
107
  rubygems_version: 1.8.24