looksee 4.2.0 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,24 @@
1
+ #ifndef INTERNAL_SERIAL_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_SERIAL_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @brief Internal header for rb_serial_t.
11
+ */
12
+ #include "ruby/internal/config.h" /* for HAVE_LONG_LONG */
13
+ #include "ruby/defines.h" /* for LONG_LONG */
14
+
15
+ #ifndef HAVE_LONG_LONG
16
+ # error need C99+
17
+ #endif
18
+
19
+ typedef unsigned LONG_LONG rb_serial_t;
20
+ #define SERIALT2NUM ULL2NUM
21
+ #define PRI_SERIALT_PREFIX PRI_LL_PREFIX
22
+ #define SIZEOF_SERIAL_T SIZEOF_LONG_LONG
23
+
24
+ #endif /* INTERNAL_SERIAL_H */
@@ -0,0 +1,17 @@
1
+ #ifndef INTERNAL_STATIC_ASSERT_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_STATIC_ASSERT_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @brief C11 shim for _Static_assert.
11
+ */
12
+ #include "ruby/internal/static_assert.h"
13
+ #ifndef STATIC_ASSERT
14
+ # define STATIC_ASSERT RBIMPL_STATIC_ASSERT
15
+ #endif
16
+
17
+ #endif /* INTERNAL_STATIC_ASSERT_H */
@@ -0,0 +1,17 @@
1
+ #ifndef INTERNAL_WARNINGS_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_WARNINGS_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @brief Internal header to suppres / mandate warnings.
11
+ */
12
+ #include "ruby/internal/warning_push.h"
13
+ #define COMPILER_WARNING_PUSH RBIMPL_WARNING_PUSH()
14
+ #define COMPILER_WARNING_POP RBIMPL_WARNING_POP()
15
+ #define COMPILER_WARNING_ERROR(flag) RBIMPL_WARNING_ERROR(flag)
16
+ #define COMPILER_WARNING_IGNORED(flag) RBIMPL_WARNING_IGNORED(flag)
17
+ #endif /* INTERNAL_WARNINGS_H */
@@ -0,0 +1,246 @@
1
+ #ifndef RUBY_METHOD_H
2
+ #define RUBY_METHOD_H 1
3
+ /**********************************************************************
4
+ *
5
+ * method.h -
6
+ *
7
+ * $Author$
8
+ * created at: Wed Jul 15 20:02:33 2009
9
+ *
10
+ * Copyright (C) 2009 Koichi Sasada
11
+ *
12
+ **********************************************************************/
13
+
14
+ #include "internal.h"
15
+ #include "internal/imemo.h"
16
+ #include "internal/compilers.h"
17
+ #include "internal/static_assert.h"
18
+ #include "internal/class.h"
19
+
20
+ #ifndef END_OF_ENUMERATION
21
+ # if defined(__GNUC__) &&! defined(__STRICT_ANSI__)
22
+ # define END_OF_ENUMERATION(key)
23
+ # else
24
+ # define END_OF_ENUMERATION(key) END_OF_##key##_PLACEHOLDER = 0
25
+ # endif
26
+ #endif
27
+
28
+ /* cref */
29
+
30
+ typedef enum {
31
+ METHOD_VISI_UNDEF = 0x00,
32
+ METHOD_VISI_PUBLIC = 0x01,
33
+ METHOD_VISI_PRIVATE = 0x02,
34
+ METHOD_VISI_PROTECTED = 0x03,
35
+
36
+ METHOD_VISI_MASK = 0x03
37
+ } rb_method_visibility_t;
38
+
39
+ typedef struct rb_scope_visi_struct {
40
+ BITFIELD(rb_method_visibility_t, method_visi, 3);
41
+ unsigned int module_func : 1;
42
+ } rb_scope_visibility_t;
43
+
44
+ /*! CREF (Class REFerence) */
45
+ typedef struct rb_cref_struct {
46
+ VALUE flags;
47
+ VALUE refinements;
48
+ VALUE klass;
49
+ struct rb_cref_struct * next;
50
+ const rb_scope_visibility_t scope_visi;
51
+ } rb_cref_t;
52
+
53
+ /* method data type */
54
+
55
+ typedef struct rb_method_entry_struct {
56
+ VALUE flags;
57
+ VALUE defined_class;
58
+ struct rb_method_definition_struct * const def;
59
+ ID called_id;
60
+ VALUE owner;
61
+ } rb_method_entry_t;
62
+
63
+ typedef struct rb_callable_method_entry_struct { /* same fields with rb_method_entry_t */
64
+ VALUE flags;
65
+ const VALUE defined_class;
66
+ struct rb_method_definition_struct * const def;
67
+ ID called_id;
68
+ const VALUE owner;
69
+ } rb_callable_method_entry_t;
70
+
71
+ #define METHOD_ENTRY_VISI(me) (rb_method_visibility_t)(((me)->flags & (IMEMO_FL_USER0 | IMEMO_FL_USER1)) >> (IMEMO_FL_USHIFT+0))
72
+ #define METHOD_ENTRY_BASIC(me) (int) (((me)->flags & (IMEMO_FL_USER2 )) >> (IMEMO_FL_USHIFT+2))
73
+ #define METHOD_ENTRY_COMPLEMENTED(me) ((me)->flags & IMEMO_FL_USER3)
74
+ #define METHOD_ENTRY_COMPLEMENTED_SET(me) ((me)->flags |= IMEMO_FL_USER3)
75
+ #define METHOD_ENTRY_CACHED(me) ((me)->flags & IMEMO_FL_USER4)
76
+ #define METHOD_ENTRY_CACHED_SET(me) ((me)->flags |= IMEMO_FL_USER4)
77
+ #define METHOD_ENTRY_INVALIDATED(me) ((me)->flags & IMEMO_FL_USER5)
78
+ #define METHOD_ENTRY_INVALIDATED_SET(me) ((me)->flags |= IMEMO_FL_USER5)
79
+ #define METHOD_ENTRY_CACHEABLE(me) !(METHOD_ENTRY_VISI(me) == METHOD_VISI_PROTECTED)
80
+
81
+ static inline void
82
+ METHOD_ENTRY_VISI_SET(rb_method_entry_t *me, rb_method_visibility_t visi)
83
+ {
84
+ VM_ASSERT((int)visi >= 0 && visi <= 3);
85
+ me->flags = (me->flags & ~(IMEMO_FL_USER0 | IMEMO_FL_USER1)) | (visi << (IMEMO_FL_USHIFT+0));
86
+ }
87
+ static inline void
88
+ METHOD_ENTRY_BASIC_SET(rb_method_entry_t *me, unsigned int basic)
89
+ {
90
+ VM_ASSERT(basic <= 1);
91
+ me->flags = (me->flags & ~(IMEMO_FL_USER2 )) | (basic << (IMEMO_FL_USHIFT+2));
92
+ }
93
+ static inline void
94
+ METHOD_ENTRY_FLAGS_SET(rb_method_entry_t *me, rb_method_visibility_t visi, unsigned int basic)
95
+ {
96
+ VM_ASSERT((int)visi >= 0 && visi <= 3);
97
+ VM_ASSERT(basic <= 1);
98
+ me->flags =
99
+ (me->flags & ~(IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2)) |
100
+ ((visi << (IMEMO_FL_USHIFT+0)) | (basic << (IMEMO_FL_USHIFT+2)));
101
+ }
102
+ static inline void
103
+ METHOD_ENTRY_FLAGS_COPY(rb_method_entry_t *dst, const rb_method_entry_t *src)
104
+ {
105
+ dst->flags =
106
+ (dst->flags & ~(IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2)) |
107
+ (src->flags & (IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2));
108
+ }
109
+
110
+ typedef enum {
111
+ VM_METHOD_TYPE_ISEQ, /*!< Ruby method */
112
+ VM_METHOD_TYPE_CFUNC, /*!< C method */
113
+ VM_METHOD_TYPE_ATTRSET, /*!< attr_writer or attr_accessor */
114
+ VM_METHOD_TYPE_IVAR, /*!< attr_reader or attr_accessor */
115
+ VM_METHOD_TYPE_BMETHOD,
116
+ VM_METHOD_TYPE_ZSUPER,
117
+ VM_METHOD_TYPE_ALIAS,
118
+ VM_METHOD_TYPE_UNDEF,
119
+ VM_METHOD_TYPE_NOTIMPLEMENTED,
120
+ VM_METHOD_TYPE_OPTIMIZED, /*!< Kernel#send, Proc#call, etc */
121
+ VM_METHOD_TYPE_MISSING, /*!< wrapper for method_missing(id) */
122
+ VM_METHOD_TYPE_REFINED, /*!< refinement */
123
+
124
+ END_OF_ENUMERATION(VM_METHOD_TYPE)
125
+ } rb_method_type_t;
126
+ #define VM_METHOD_TYPE_MINIMUM_BITS 4
127
+ STATIC_ASSERT(VM_METHOD_TYPE_MINIMUM_BITS,
128
+ VM_METHOD_TYPE_REFINED <= (1<<VM_METHOD_TYPE_MINIMUM_BITS));
129
+
130
+ #ifndef rb_iseq_t
131
+ typedef struct rb_iseq_struct rb_iseq_t;
132
+ #define rb_iseq_t rb_iseq_t
133
+ #endif
134
+
135
+ typedef struct rb_method_iseq_struct {
136
+ rb_iseq_t * iseqptr; /*!< iseq pointer, should be separated from iseqval */
137
+ rb_cref_t * cref; /*!< class reference, should be marked */
138
+ } rb_method_iseq_t; /* check rb_add_method_iseq() when modify the fields */
139
+
140
+ typedef struct rb_method_cfunc_struct {
141
+ VALUE (*func)(ANYARGS);
142
+ VALUE (*invoker)(VALUE recv, int argc, const VALUE *argv, VALUE (*func)(ANYARGS));
143
+ int argc;
144
+ } rb_method_cfunc_t;
145
+
146
+ typedef struct rb_method_attr_struct {
147
+ ID id;
148
+ VALUE location; /* should be marked */
149
+ } rb_method_attr_t;
150
+
151
+ typedef struct rb_method_alias_struct {
152
+ struct rb_method_entry_struct * original_me; /* original_me->klass is original owner */
153
+ } rb_method_alias_t;
154
+
155
+ typedef struct rb_method_refined_struct {
156
+ struct rb_method_entry_struct * orig_me;
157
+ VALUE owner;
158
+ } rb_method_refined_t;
159
+
160
+ typedef struct rb_method_bmethod_struct {
161
+ VALUE proc; /* should be marked */
162
+ struct rb_hook_list_struct *hooks;
163
+ VALUE defined_ractor;
164
+ } rb_method_bmethod_t;
165
+
166
+ enum method_optimized_type {
167
+ OPTIMIZED_METHOD_TYPE_SEND,
168
+ OPTIMIZED_METHOD_TYPE_CALL,
169
+ OPTIMIZED_METHOD_TYPE_BLOCK_CALL,
170
+ OPTIMIZED_METHOD_TYPE__MAX
171
+ };
172
+
173
+ struct rb_method_definition_struct {
174
+ BITFIELD(rb_method_type_t, type, VM_METHOD_TYPE_MINIMUM_BITS);
175
+ int alias_count : 28;
176
+ int complemented_count : 28;
177
+
178
+ union {
179
+ rb_method_iseq_t iseq;
180
+ rb_method_cfunc_t cfunc;
181
+ rb_method_attr_t attr;
182
+ rb_method_alias_t alias;
183
+ rb_method_refined_t refined;
184
+ rb_method_bmethod_t bmethod;
185
+
186
+ enum method_optimized_type optimize_type;
187
+ } body;
188
+
189
+ ID original_id;
190
+ uintptr_t method_serial;
191
+ };
192
+
193
+ struct rb_id_table;
194
+
195
+ typedef struct rb_method_definition_struct rb_method_definition_t;
196
+ STATIC_ASSERT(sizeof_method_def, offsetof(rb_method_definition_t, body)==8);
197
+
198
+ #define UNDEFINED_METHOD_ENTRY_P(me) (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)
199
+ #define UNDEFINED_REFINED_METHOD_P(def) \
200
+ ((def)->type == VM_METHOD_TYPE_REFINED && \
201
+ UNDEFINED_METHOD_ENTRY_P((def)->body.refined.orig_me))
202
+
203
+ void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_visibility_t visi);
204
+ void rb_add_method_iseq(VALUE klass, ID mid, const rb_iseq_t *iseq, rb_cref_t *cref, rb_method_visibility_t visi);
205
+ void rb_add_refined_method_entry(VALUE refined_class, ID mid);
206
+ void rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_visibility_t visi);
207
+
208
+ rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_visibility_t noex);
209
+ rb_method_entry_t *rb_method_entry_create(ID called_id, VALUE klass, rb_method_visibility_t visi, const rb_method_definition_t *def);
210
+
211
+ const rb_method_entry_t *rb_method_entry_at(VALUE obj, ID id);
212
+
213
+ const rb_method_entry_t *rb_method_entry(VALUE klass, ID id);
214
+ const rb_method_entry_t *rb_method_entry_with_refinements(VALUE klass, ID id, VALUE *defined_class);
215
+ const rb_method_entry_t *rb_method_entry_without_refinements(VALUE klass, ID id, VALUE *defined_class);
216
+ const rb_method_entry_t *rb_resolve_refined_method(VALUE refinements, const rb_method_entry_t *me);
217
+ RUBY_SYMBOL_EXPORT_BEGIN
218
+ const rb_method_entry_t *rb_resolve_me_location(const rb_method_entry_t *, VALUE[5]);
219
+ RUBY_SYMBOL_EXPORT_END
220
+
221
+ const rb_callable_method_entry_t *rb_callable_method_entry(VALUE klass, ID id);
222
+ const rb_callable_method_entry_t *rb_callable_method_entry_with_refinements(VALUE klass, ID id, VALUE *defined_class);
223
+ const rb_callable_method_entry_t *rb_callable_method_entry_without_refinements(VALUE klass, ID id, VALUE *defined_class);
224
+
225
+ int rb_method_entry_arity(const rb_method_entry_t *me);
226
+ int rb_method_entry_eq(const rb_method_entry_t *m1, const rb_method_entry_t *m2);
227
+ st_index_t rb_hash_method_entry(st_index_t hash, const rb_method_entry_t *me);
228
+
229
+ VALUE rb_method_entry_location(const rb_method_entry_t *me);
230
+
231
+ void rb_free_method_entry(const rb_method_entry_t *me);
232
+
233
+ const rb_method_entry_t *rb_method_entry_clone(const rb_method_entry_t *me);
234
+ const rb_callable_method_entry_t *rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, ID called_id, VALUE defined_class);
235
+ void rb_method_entry_copy(rb_method_entry_t *dst, const rb_method_entry_t *src);
236
+
237
+ void rb_method_table_insert(VALUE klass, struct rb_id_table *table, ID method_id, const rb_method_entry_t *me);
238
+
239
+ void rb_scope_visibility_set(rb_method_visibility_t);
240
+
241
+ VALUE rb_unnamed_parameters(int arity);
242
+
243
+ void rb_clear_method_cache(VALUE klass_or_module, ID mid);
244
+ void rb_clear_method_cache_all(void);
245
+
246
+ #endif /* RUBY_METHOD_H */
Binary file
@@ -1,5 +1,5 @@
1
1
  module Looksee
2
- VERSION = [4, 2, 0]
2
+ VERSION = [4, 4, 0]
3
3
 
4
4
  class << VERSION
5
5
  include Comparable
@@ -32,8 +32,8 @@ describe "Looksee.adapter" do
32
32
  'Mocha', 'Spec',
33
33
  # RSpec 2
34
34
  'RSpec::',
35
- # not sure what pulls this in
36
- 'PP',
35
+ # not sure what pulls these in
36
+ 'PP', 'JSON::Ext::Generator::GeneratorMethods::Object',
37
37
  # our own pollution
38
38
  'Looksee::ObjectMixin',
39
39
  ]
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: looksee
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Ogata
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-26 00:00:00.000000000 Z
11
+ date: 2021-01-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description:
13
+ description:
14
14
  email:
15
15
  - george.ogata@gmail.com
16
16
  executables: []
@@ -34,6 +34,17 @@ files:
34
34
  - ext/mri/2.3.0/method.h
35
35
  - ext/mri/2.7.0/internal.h
36
36
  - ext/mri/2.7.0/method.h
37
+ - ext/mri/3.0.0/id_table.h
38
+ - ext/mri/3.0.0/internal.h
39
+ - ext/mri/3.0.0/internal/array.h
40
+ - ext/mri/3.0.0/internal/class.h
41
+ - ext/mri/3.0.0/internal/compilers.h
42
+ - ext/mri/3.0.0/internal/gc.h
43
+ - ext/mri/3.0.0/internal/imemo.h
44
+ - ext/mri/3.0.0/internal/serial.h
45
+ - ext/mri/3.0.0/internal/static_assert.h
46
+ - ext/mri/3.0.0/internal/warnings.h
47
+ - ext/mri/3.0.0/method.h
37
48
  - ext/mri/mri.c
38
49
  - ext/rbx/rbx.c
39
50
  - lib/looksee.rb
@@ -47,6 +58,7 @@ files:
47
58
  - lib/looksee/help.rb
48
59
  - lib/looksee/inspector.rb
49
60
  - lib/looksee/lookup_path.rb
61
+ - lib/looksee/mri.bundle
50
62
  - lib/looksee/version.rb
51
63
  - spec/looksee/adapter_spec.rb
52
64
  - spec/looksee/clean_spec.rb
@@ -63,7 +75,7 @@ homepage: http://github.com/oggy/looksee
63
75
  licenses:
64
76
  - MIT
65
77
  metadata: {}
66
- post_install_message:
78
+ post_install_message:
67
79
  rdoc_options: []
68
80
  require_paths:
69
81
  - lib
@@ -78,19 +90,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
90
  - !ruby/object:Gem::Version
79
91
  version: '0'
80
92
  requirements: []
81
- rubygems_version: 3.1.2
82
- signing_key:
93
+ rubygems_version: 3.2.3
94
+ signing_key:
83
95
  specification_version: 3
84
96
  summary: Supercharged method introspection in IRB.
85
97
  test_files:
86
- - spec/spec_helper.rb
98
+ - spec/looksee/adapter_spec.rb
87
99
  - spec/looksee/clean_spec.rb
88
- - spec/looksee/inspector_spec.rb
89
- - spec/looksee/core_ext_spec.rb
90
100
  - spec/looksee/columnizer_spec.rb
91
- - spec/looksee/adapter_spec.rb
101
+ - spec/looksee/core_ext_spec.rb
92
102
  - spec/looksee/editor_spec.rb
103
+ - spec/looksee/inspector_spec.rb
93
104
  - spec/looksee/lookup_path_spec.rb
105
+ - spec/spec_helper.rb
94
106
  - spec/support/core_ext.rb
95
107
  - spec/support/temporary_classes.rb
96
108
  - spec/support/test_adapter.rb