rubybreaker 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS +6 -46
- data/README.md +30 -19
- data/TODO +22 -20
- data/VERSION +1 -1
- data/bin/rubybreaker +11 -2
- data/lib/rubybreaker.rb +31 -11
- data/lib/rubybreaker/debug.rb +5 -49
- data/lib/rubybreaker/{context.rb → debug/context.rb} +0 -0
- data/lib/rubybreaker/debug/debug.rb +61 -0
- data/lib/rubybreaker/{error.rb → debug/error.rb} +1 -1
- data/lib/rubybreaker/runtime.rb +3 -2
- data/lib/rubybreaker/runtime/inspector.rb +20 -13
- data/lib/rubybreaker/runtime/monitor.rb +21 -13
- data/lib/rubybreaker/runtime/object_wrapper.rb +3 -1
- data/lib/rubybreaker/runtime/type_system.rb +3 -2
- data/lib/rubybreaker/test/testcase.rb +0 -1
- data/lib/rubybreaker/type/type.rb +1 -1
- data/lib/rubybreaker/type/type_grammar.treetop +1 -1
- data/lib/rubybreaker/type/type_unparser.rb +1 -1
- data/lib/rubybreaker/util.rb +3 -11
- data/test/integrated/tc_both_broken_breakable.rb +27 -0
- data/test/ts_integrated.rb +1 -0
- data/webpage/index.html +30 -19
- data/webpage/rdoc/RubyBreaker.html +127 -10
- data/webpage/rdoc/RubyBreaker/Breakable.html +1 -5
- data/webpage/rdoc/RubyBreaker/Broken.html +2 -6
- data/webpage/rdoc/RubyBreaker/Broken/BrokenEigen.html +3 -6
- data/webpage/rdoc/RubyBreaker/Context.html +6 -10
- data/webpage/rdoc/RubyBreaker/Errors.html +2 -6
- data/webpage/rdoc/RubyBreaker/Errors/InternalError.html +3 -7
- data/webpage/rdoc/RubyBreaker/Errors/InvalidSubtypeCheck.html +3 -7
- data/webpage/rdoc/RubyBreaker/Errors/InvalidTypeConstruction.html +2 -6
- data/webpage/rdoc/RubyBreaker/Errors/SubtypeFailure.html +2 -6
- data/webpage/rdoc/RubyBreaker/Errors/TypeError.html +3 -7
- data/webpage/rdoc/RubyBreaker/Errors/UserError.html +3 -7
- data/webpage/rdoc/RubyBreaker/Main.html +33 -20
- data/webpage/rdoc/RubyBreaker/ObjectPosition.html +4 -8
- data/webpage/rdoc/RubyBreaker/Position.html +7 -11
- data/webpage/rdoc/RubyBreaker/RubyTypeUtils.html +1 -5
- data/webpage/rdoc/RubyBreaker/Runtime.html +1 -5
- data/webpage/rdoc/RubyBreaker/Runtime/Inspector.html +25 -18
- data/webpage/rdoc/RubyBreaker/Runtime/MethodInfo.html +1 -5
- data/webpage/rdoc/RubyBreaker/Runtime/Monitor.html +4 -8
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorInstaller.html +20 -43
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorSwitch.html +7 -11
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorUtils.html +6 -10
- data/webpage/rdoc/RubyBreaker/Runtime/ObjectWrapper.html +7 -11
- data/webpage/rdoc/RubyBreaker/Runtime/Pluggable.html +1 -5
- data/webpage/rdoc/RubyBreaker/Runtime/TypePlaceholder.html +1 -5
- data/webpage/rdoc/RubyBreaker/Runtime/TypeSigParser.html +1 -5
- data/webpage/rdoc/RubyBreaker/Runtime/TypeSystem.html +8 -12
- data/webpage/rdoc/RubyBreaker/TestCase.html +1 -6
- data/webpage/rdoc/RubyBreaker/TypeComparer.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/AnyType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/BlockType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/DuckType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/FusionType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/MethodListType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/MethodType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/NilType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/NominalType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/OptionalType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/OrType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/SelfType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/Type.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/VarLengthType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeUnparser.html +1 -5
- data/webpage/rdoc/RubyBreaker/Typing.html +1 -5
- data/webpage/rdoc/RubyBreaker/{Utilities.html → Util.html} +8 -9
- data/webpage/rdoc/created.rid +15 -14
- data/webpage/rdoc/index.html +1 -5
- data/webpage/rdoc/js/search_index.js +1 -1
- data/webpage/rdoc/table_of_contents.html +22 -36
- metadata +9 -7
- data/webpage/rdoc/RubyBreaker/Debug.html +0 -411
- data/webpage/rdoc/RubyBreaker/Kernel.html +0 -259
@@ -114,8 +114,6 @@
|
|
114
114
|
|
115
115
|
<li><a href="../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
116
116
|
|
117
|
-
<li><a href="../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
118
|
-
|
119
117
|
<li><a href="../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
120
118
|
|
121
119
|
<li><a href="../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
@@ -130,8 +128,6 @@
|
|
130
128
|
|
131
129
|
<li><a href="../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
132
130
|
|
133
|
-
<li><a href="../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
134
|
-
|
135
131
|
<li><a href="../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
136
132
|
|
137
133
|
<li><a href="../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
@@ -200,7 +196,7 @@
|
|
200
196
|
|
201
197
|
<li><a href="../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
202
198
|
|
203
|
-
<li><a href="../RubyBreaker/
|
199
|
+
<li><a href="../RubyBreaker/Util.html">RubyBreaker::Util</a>
|
204
200
|
|
205
201
|
</ul>
|
206
202
|
</nav>
|
@@ -252,9 +248,10 @@ running <a href="../RubyBreaker.html">RubyBreaker</a>.</p>
|
|
252
248
|
|
253
249
|
|
254
250
|
<div class="method-source-code" id="input-source">
|
255
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line
|
251
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 72</span>
|
256
252
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">input</span>()
|
257
253
|
<span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>] <span class="ruby-operator">&&</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>])
|
254
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-string">"RubyBreaker input file exists...loading"</span>)
|
258
255
|
<span class="ruby-identifier">eval</span> <span class="ruby-node">"load \"#{OPTIONS[:io_file]}\""</span>, <span class="ruby-constant">TOPLEVEL_BINDING</span>
|
259
256
|
<span class="ruby-keyword">end</span></pre>
|
260
257
|
</div><!-- input-source -->
|
@@ -278,14 +275,16 @@ running <a href="../RubyBreaker.html">RubyBreaker</a>.</p>
|
|
278
275
|
|
279
276
|
<div class="method-description">
|
280
277
|
|
281
|
-
<p>This method will generate the output
|
278
|
+
<p>This method will generate the output.</p>
|
282
279
|
|
283
280
|
|
284
281
|
|
285
282
|
<div class="method-source-code" id="output-source">
|
286
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line
|
283
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 144</span>
|
287
284
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">output</span>()
|
288
285
|
|
286
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-string">"Generating type documentation"</span>)
|
287
|
+
|
289
288
|
<span class="ruby-identifier">io_exist</span> = <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>] <span class="ruby-operator">&&</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>])
|
290
289
|
|
291
290
|
<span class="ruby-identifier">str</span> = <span class="ruby-string">""</span>
|
@@ -309,6 +308,8 @@ running <a href="../RubyBreaker.html">RubyBreaker</a>.</p>
|
|
309
308
|
<span class="ruby-keyword">end</span>
|
310
309
|
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">str</span>
|
311
310
|
<span class="ruby-keyword">end</span>
|
311
|
+
|
312
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-string">"Done generating type documentation"</span>)
|
312
313
|
<span class="ruby-keyword">end</span></pre>
|
313
314
|
</div><!-- output-source -->
|
314
315
|
|
@@ -336,7 +337,7 @@ running <a href="../RubyBreaker.html">RubyBreaker</a>.</p>
|
|
336
337
|
|
337
338
|
|
338
339
|
<div class="method-source-code" id="pp_methods-source">
|
339
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line
|
340
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 79</span>
|
340
341
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">pp_methods</span>(<span class="ruby-identifier">pp</span>, <span class="ruby-identifier">meth_type_map</span>)
|
341
342
|
<span class="ruby-identifier">meth_type_map</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">meth_name</span>, <span class="ruby-identifier">meth_type</span><span class="ruby-operator">|</span>
|
342
343
|
<span class="ruby-keyword">case</span> <span class="ruby-identifier">meth_type</span>
|
@@ -383,7 +384,7 @@ running <a href="../RubyBreaker.html">RubyBreaker</a>.</p>
|
|
383
384
|
|
384
385
|
|
385
386
|
<div class="method-source-code" id="pp_module-source">
|
386
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line
|
387
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 101</span>
|
387
388
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">pp_module</span>(<span class="ruby-identifier">pp</span>, <span class="ruby-identifier">mod</span>)
|
388
389
|
<span class="ruby-comment"># Skip it if we already have seen it</span>
|
389
390
|
<span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">DOCUMENTED</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">mod</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">to_s</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-node">"#<"</span>
|
@@ -446,17 +447,25 @@ running <a href="../RubyBreaker.html">RubyBreaker</a>.</p>
|
|
446
447
|
|
447
448
|
<div class="method-description">
|
448
449
|
|
449
|
-
<p>This method will run the
|
450
|
+
<p>This method will run do things in the following order:</p>
|
451
|
+
|
452
|
+
<pre class="ruby">* <span class="ruby-constant">Checks</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">see</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">user</span> <span class="ruby-identifier">program</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">an</span> <span class="ruby-identifier">input</span> <span class="ruby-identifier">file</span> <span class="ruby-identifier">exists</span>
|
453
|
+
* <span class="ruby-constant">Loads</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">documentation</span> <span class="ruby-keyword">for</span> <span class="ruby-constant">Ruby</span> <span class="ruby-constant">Core</span> <span class="ruby-constant">Library</span> (<span class="ruby-constant">TODO</span>)
|
454
|
+
* <span class="ruby-constant">Reads</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">input</span> <span class="ruby-identifier">type</span> <span class="ruby-identifier">documentation</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">any</span>
|
455
|
+
* <span class="ruby-constant">Reads</span> (<span class="ruby-identifier">require</span><span class="ruby-string">'s) the user program
|
456
|
+
</span></pre>
|
450
457
|
|
451
458
|
|
452
459
|
|
453
460
|
<div class="method-source-code" id="run-source">
|
454
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line
|
461
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 182</span>
|
455
462
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">run</span>()
|
456
463
|
|
457
|
-
<span class="ruby-
|
464
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">setup_logger</span>()
|
465
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-string">"Running RubyBreaker"</span>)
|
458
466
|
|
459
|
-
<span class="ruby-
|
467
|
+
<span class="ruby-comment"># First, take care of the program file.</span>
|
468
|
+
<span class="ruby-identifier">argv0</span> = <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:file</span>]
|
460
469
|
<span class="ruby-identifier">prog_file</span> = <span class="ruby-identifier">argv0</span>
|
461
470
|
<span class="ruby-identifier">prog_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">prog_file</span>)
|
462
471
|
|
@@ -466,7 +475,7 @@ running <a href="../RubyBreaker.html">RubyBreaker</a>.</p>
|
|
466
475
|
<span class="ruby-keyword">end</span>
|
467
476
|
|
468
477
|
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">prog_file</span>)
|
469
|
-
<span class="ruby-identifier">
|
478
|
+
<span class="ruby-identifier">fatal</span>(<span class="ruby-node">"#{argv0} is an invalid file."</span>)
|
470
479
|
<span class="ruby-identifier">exit</span>(<span class="ruby-value">1</span>)
|
471
480
|
<span class="ruby-keyword">end</span>
|
472
481
|
|
@@ -477,6 +486,7 @@ running <a href="../RubyBreaker.html">RubyBreaker</a>.</p>
|
|
477
486
|
<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>] = <span class="ruby-constant">File</span>.<span class="ruby-identifier">absolute_path</span>(<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>])
|
478
487
|
|
479
488
|
<span class="ruby-keyword">if</span> <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:rubylib</span>]
|
489
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-string">"Loading RubyBreaker's Ruby Core Library documentation"</span>)
|
480
490
|
<span class="ruby-comment"># Load the core library type documentation</span>
|
481
491
|
<span class="ruby-identifier">eval</span>(<span class="ruby-string">"require \"rubybreaker/rubylib\""</span>, <span class="ruby-constant">TOPLEVEL_BINDING</span>)
|
482
492
|
<span class="ruby-keyword">end</span>
|
@@ -488,6 +498,8 @@ running <a href="../RubyBreaker.html">RubyBreaker</a>.</p>
|
|
488
498
|
<span class="ruby-comment"># Finally, require the program file! Let it run! Wheeee!</span>
|
489
499
|
<span class="ruby-identifier">eval</span>(<span class="ruby-node">"require '#{prog_file}'"</span>, <span class="ruby-constant">TOPLEVEL_BINDING</span>)
|
490
500
|
|
501
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-string">"Done running the input program"</span>)
|
502
|
+
|
491
503
|
<span class="ruby-keyword">end</span></pre>
|
492
504
|
</div><!-- run-source -->
|
493
505
|
|
@@ -515,14 +527,15 @@ running <a href="../RubyBreaker.html">RubyBreaker</a>.</p>
|
|
515
527
|
|
516
528
|
|
517
529
|
<div class="method-source-code" id="setup-source">
|
518
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line
|
530
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 50</span>
|
519
531
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">setup</span>()
|
520
532
|
|
521
533
|
<span class="ruby-constant">BREAKABLE</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mod</span><span class="ruby-operator">|</span>
|
522
|
-
|
523
|
-
<span class="ruby-comment">#
|
524
|
-
<span class="ruby-comment">#
|
525
|
-
<span class="ruby-
|
534
|
+
|
535
|
+
<span class="ruby-comment"># Remember, RubyBreaker now supports a hybrid of Breakable and</span>
|
536
|
+
<span class="ruby-comment"># Broken module. Just check if the module has already been</span>
|
537
|
+
<span class="ruby-comment"># instrumented.</span>
|
538
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-constant">INSTALLED</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">mod</span>)
|
526
539
|
<span class="ruby-constant">MonitorInstaller</span>.<span class="ruby-identifier">install_module_monitor</span>(<span class="ruby-identifier">mod</span>)
|
527
540
|
<span class="ruby-constant">INSTALLED</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">mod</span>
|
528
541
|
<span class="ruby-keyword">end</span>
|
@@ -47,7 +47,7 @@
|
|
47
47
|
<nav id="file-list-section" class="section">
|
48
48
|
<h3 class="section-header">Defined In</h3>
|
49
49
|
<ul>
|
50
|
-
<li>lib/rubybreaker/context.rb
|
50
|
+
<li>lib/rubybreaker/debug/context.rb
|
51
51
|
</ul>
|
52
52
|
</nav>
|
53
53
|
|
@@ -96,8 +96,6 @@
|
|
96
96
|
|
97
97
|
<li><a href="../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
98
98
|
|
99
|
-
<li><a href="../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
100
|
-
|
101
99
|
<li><a href="../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
102
100
|
|
103
101
|
<li><a href="../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
@@ -112,8 +110,6 @@
|
|
112
110
|
|
113
111
|
<li><a href="../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
114
112
|
|
115
|
-
<li><a href="../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
116
|
-
|
117
113
|
<li><a href="../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
118
114
|
|
119
115
|
<li><a href="../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
@@ -182,7 +178,7 @@
|
|
182
178
|
|
183
179
|
<li><a href="../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
184
180
|
|
185
|
-
<li><a href="../RubyBreaker/
|
181
|
+
<li><a href="../RubyBreaker/Util.html">RubyBreaker::Util</a>
|
186
182
|
|
187
183
|
</ul>
|
188
184
|
</nav>
|
@@ -267,7 +263,7 @@ a method being invoked.</p>
|
|
267
263
|
|
268
264
|
|
269
265
|
<div class="method-source-code" id="new-source">
|
270
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/context.rb, line 61</span>
|
266
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/debug/context.rb, line 61</span>
|
271
267
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_name</span>)
|
272
268
|
<span class="ruby-ivar">@obj</span> = <span class="ruby-identifier">obj</span>
|
273
269
|
<span class="ruby-ivar">@meth_name</span> = <span class="ruby-identifier">meth_name</span>
|
@@ -304,7 +300,7 @@ a method being invoked.</p>
|
|
304
300
|
|
305
301
|
|
306
302
|
<div class="method-source-code" id="to_s-source">
|
307
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/context.rb, line 66</span>
|
303
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/debug/context.rb, line 66</span>
|
308
304
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>()
|
309
305
|
<span class="ruby-identifier">m_delim</span> = <span class="ruby-ivar">@obj</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Module</span>) <span class="ruby-operator">?</span> <span class="ruby-string">"."</span> <span class="ruby-operator">:</span> <span class="ruby-node">"#"</span>
|
310
306
|
<span class="ruby-keyword">return</span> <span class="ruby-node">"> #{@obj.class}#{m_delim}#{@meth_name}"</span>
|
@@ -47,7 +47,7 @@
|
|
47
47
|
<nav id="file-list-section" class="section">
|
48
48
|
<h3 class="section-header">Defined In</h3>
|
49
49
|
<ul>
|
50
|
-
<li>lib/rubybreaker/context.rb
|
50
|
+
<li>lib/rubybreaker/debug/context.rb
|
51
51
|
</ul>
|
52
52
|
</nav>
|
53
53
|
|
@@ -102,8 +102,6 @@
|
|
102
102
|
|
103
103
|
<li><a href="../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
104
104
|
|
105
|
-
<li><a href="../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
106
|
-
|
107
105
|
<li><a href="../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
108
106
|
|
109
107
|
<li><a href="../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
@@ -118,8 +116,6 @@
|
|
118
116
|
|
119
117
|
<li><a href="../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
120
118
|
|
121
|
-
<li><a href="../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
122
|
-
|
123
119
|
<li><a href="../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
124
120
|
|
125
121
|
<li><a href="../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
@@ -188,7 +184,7 @@
|
|
188
184
|
|
189
185
|
<li><a href="../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
190
186
|
|
191
|
-
<li><a href="../RubyBreaker/
|
187
|
+
<li><a href="../RubyBreaker/Util.html">RubyBreaker::Util</a>
|
192
188
|
|
193
189
|
</ul>
|
194
190
|
</nav>
|
@@ -301,7 +297,7 @@ array.</p>
|
|
301
297
|
|
302
298
|
|
303
299
|
<div class="method-source-code" id="convert_caller_to_pos-source">
|
304
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/context.rb, line 49</span>
|
300
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/debug/context.rb, line 49</span>
|
305
301
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">convert_caller_to_pos</span>(<span class="ruby-identifier">caller_ary</span>, <span class="ruby-identifier">idx</span>=<span class="ruby-value">0</span>)
|
306
302
|
<span class="ruby-identifier">tokens</span> = <span class="ruby-identifier">caller_ary</span>[<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">split</span>(<span class="ruby-string">":"</span>)
|
307
303
|
<span class="ruby-keyword">return</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">tokens</span>[<span class="ruby-value">0</span>],<span class="ruby-identifier">tokens</span>[<span class="ruby-value">1</span>],<span class="ruby-value">-1</span>,<span class="ruby-identifier">tokens</span>[<span class="ruby-value">2</span>]) <span class="ruby-comment"># no col </span>
|
@@ -333,7 +329,7 @@ position.</p>
|
|
333
329
|
|
334
330
|
|
335
331
|
<div class="method-source-code" id="get-source">
|
336
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/context.rb, line 43</span>
|
332
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/debug/context.rb, line 43</span>
|
337
333
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get</span>()
|
338
334
|
<span class="ruby-keyword">return</span> <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">@@file</span>,<span class="ruby-identifier">@@line</span>,<span class="ruby-identifier">@@col</span>)
|
339
335
|
<span class="ruby-keyword">end</span></pre>
|
@@ -363,7 +359,7 @@ position.</p>
|
|
363
359
|
|
364
360
|
|
365
361
|
<div class="method-source-code" id="new-source">
|
366
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/context.rb, line 23</span>
|
362
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/debug/context.rb, line 23</span>
|
367
363
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">file</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">line</span>=<span class="ruby-value">-1</span>,<span class="ruby-identifier">col</span>=<span class="ruby-value">-1</span>,<span class="ruby-identifier">meth</span>=<span class="ruby-string">""</span>)
|
368
364
|
<span class="ruby-ivar">@file</span> = <span class="ruby-identifier">file</span>
|
369
365
|
<span class="ruby-ivar">@line</span> = <span class="ruby-identifier">line</span>
|
@@ -396,7 +392,7 @@ position.</p>
|
|
396
392
|
|
397
393
|
|
398
394
|
<div class="method-source-code" id="set-source">
|
399
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/context.rb, line 35</span>
|
395
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/debug/context.rb, line 35</span>
|
400
396
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">file</span>,<span class="ruby-identifier">line</span>,<span class="ruby-identifier">col</span>)
|
401
397
|
<span class="ruby-identifier">@@file</span> = <span class="ruby-identifier">file</span>
|
402
398
|
<span class="ruby-identifier">@@line</span> = <span class="ruby-identifier">line</span>
|
@@ -434,7 +430,7 @@ position.</p>
|
|
434
430
|
|
435
431
|
|
436
432
|
<div class="method-source-code" id="to_s-source">
|
437
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/context.rb, line 30</span>
|
433
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/debug/context.rb, line 30</span>
|
438
434
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>()
|
439
435
|
<span class="ruby-keyword">return</span> <span class="ruby-node">"#{@file}:(#{@line},#{@col}):in #{@method}"</span>
|
440
436
|
<span class="ruby-keyword">end</span></pre>
|
@@ -90,8 +90,6 @@
|
|
90
90
|
|
91
91
|
<li><a href="../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
92
92
|
|
93
|
-
<li><a href="../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
94
|
-
|
95
93
|
<li><a href="../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
96
94
|
|
97
95
|
<li><a href="../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
@@ -106,8 +104,6 @@
|
|
106
104
|
|
107
105
|
<li><a href="../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
108
106
|
|
109
|
-
<li><a href="../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
110
|
-
|
111
107
|
<li><a href="../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
112
108
|
|
113
109
|
<li><a href="../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
@@ -176,7 +172,7 @@
|
|
176
172
|
|
177
173
|
<li><a href="../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
178
174
|
|
179
|
-
<li><a href="../RubyBreaker/
|
175
|
+
<li><a href="../RubyBreaker/Util.html">RubyBreaker::Util</a>
|
180
176
|
|
181
177
|
</ul>
|
182
178
|
</nav>
|
@@ -86,8 +86,6 @@
|
|
86
86
|
|
87
87
|
<li><a href="../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
88
88
|
|
89
|
-
<li><a href="../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
90
|
-
|
91
89
|
<li><a href="../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
92
90
|
|
93
91
|
<li><a href="../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
@@ -102,8 +100,6 @@
|
|
102
100
|
|
103
101
|
<li><a href="../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
104
102
|
|
105
|
-
<li><a href="../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
106
|
-
|
107
103
|
<li><a href="../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
108
104
|
|
109
105
|
<li><a href="../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
@@ -172,7 +168,7 @@
|
|
172
168
|
|
173
169
|
<li><a href="../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
174
170
|
|
175
|
-
<li><a href="../RubyBreaker/
|
171
|
+
<li><a href="../RubyBreaker/Util.html">RubyBreaker::Util</a>
|
176
172
|
|
177
173
|
</ul>
|
178
174
|
</nav>
|
@@ -94,8 +94,6 @@
|
|
94
94
|
|
95
95
|
<li><a href="../../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
96
96
|
|
97
|
-
<li><a href="../../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
98
|
-
|
99
97
|
<li><a href="../../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
100
98
|
|
101
99
|
<li><a href="../../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
@@ -110,8 +108,6 @@
|
|
110
108
|
|
111
109
|
<li><a href="../../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
112
110
|
|
113
|
-
<li><a href="../../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
114
|
-
|
115
111
|
<li><a href="../../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
116
112
|
|
117
113
|
<li><a href="../../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
@@ -180,7 +176,7 @@
|
|
180
176
|
|
181
177
|
<li><a href="../../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
182
178
|
|
183
|
-
<li><a href="../../RubyBreaker/
|
179
|
+
<li><a href="../../RubyBreaker/Util.html">RubyBreaker::Util</a>
|
184
180
|
|
185
181
|
</ul>
|
186
182
|
</nav>
|
@@ -193,8 +189,9 @@
|
|
193
189
|
|
194
190
|
<div id="description" class="description">
|
195
191
|
|
196
|
-
<p>This module inspects a <a href="../Breakable.html">Breakable</a> module
|
197
|
-
|
192
|
+
<p>This module inspects a <a href="../Breakable.html">Breakable</a> module, a
|
193
|
+
<a href="../Broken.html">Broken</a> module, or a hybrid module to fetch the
|
194
|
+
type information for each method.</p>
|
198
195
|
|
199
196
|
</div><!-- description -->
|
200
197
|
|
@@ -233,7 +230,7 @@ containing (method name, method type) pairs.</p>
|
|
233
230
|
|
234
231
|
|
235
232
|
<div class="method-source-code" id="inspect_all-source">
|
236
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/inspector.rb, line
|
233
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/inspector.rb, line 53</span>
|
237
234
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">inspect_all</span>(<span class="ruby-identifier">mod</span>)
|
238
235
|
<span class="ruby-identifier">mtypes</span> = {}
|
239
236
|
<span class="ruby-identifier">mm</span> = <span class="ruby-constant">Breakable</span><span class="ruby-operator">::</span><span class="ruby-constant">TYPE_PLACEHOLDER_MAP</span>[<span class="ruby-identifier">mod</span>]
|
@@ -242,6 +239,12 @@ containing (method name, method type) pairs.</p>
|
|
242
239
|
<span class="ruby-identifier">mtypes</span>[<span class="ruby-identifier">im</span>] = <span class="ruby-identifier">mtype</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">mtype</span>
|
243
240
|
}
|
244
241
|
<span class="ruby-keyword">end</span>
|
242
|
+
<span class="ruby-identifier">mm</span> = <span class="ruby-constant">Broken</span><span class="ruby-operator">::</span><span class="ruby-constant">TYPE_PLACEHOLDER_MAP</span>[<span class="ruby-identifier">mod</span>]
|
243
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">mm</span>
|
244
|
+
<span class="ruby-identifier">mm</span>.<span class="ruby-identifier">meth_type_map</span>.<span class="ruby-identifier">each_pair</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">im</span>,<span class="ruby-identifier">mtype</span><span class="ruby-operator">|</span>
|
245
|
+
<span class="ruby-identifier">mtypes</span>[<span class="ruby-identifier">im</span>] = <span class="ruby-identifier">mtype</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">mtype</span>
|
246
|
+
}
|
247
|
+
<span class="ruby-keyword">end</span>
|
245
248
|
<span class="ruby-keyword">return</span> <span class="ruby-identifier">mtypes</span>
|
246
249
|
<span class="ruby-keyword">end</span></pre>
|
247
250
|
</div><!-- inspect_all-source -->
|
@@ -273,7 +276,7 @@ eigen class.</p>
|
|
273
276
|
|
274
277
|
|
275
278
|
<div class="method-source-code" id="inspect_class_meth-source">
|
276
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/inspector.rb, line
|
279
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/inspector.rb, line 37</span>
|
277
280
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">inspect_class_meth</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-identifier">mname</span>)
|
278
281
|
<span class="ruby-identifier">eigen_class</span> = <span class="ruby-constant">Runtime</span>.<span class="ruby-identifier">eigen_class</span>(<span class="ruby-identifier">mod</span>)
|
279
282
|
<span class="ruby-keyword">return</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">inspect_meth</span>(<span class="ruby-identifier">eigen_class</span>, <span class="ruby-identifier">mname</span>)
|
@@ -299,24 +302,28 @@ eigen class.</p>
|
|
299
302
|
|
300
303
|
<div class="method-description">
|
301
304
|
|
302
|
-
<p>This method inspects the module for specified method
|
303
|
-
method type or method list type for the given method
|
304
|
-
|
305
|
+
<p>This method inspects the module for the type of the specified method. It
|
306
|
+
returns the method type or method list type for the given method, by
|
307
|
+
looking at, first, the placeholder for the <a
|
308
|
+
href="../Breakable.html">Breakable</a> side of the module, and then, the
|
309
|
+
placeholder for the <a href="../Broken.html">Broken</a> side of the module.
|
310
|
+
If no method exists or if there is no type information for the method, it
|
311
|
+
returns nil.</p>
|
305
312
|
|
306
313
|
|
307
314
|
|
308
315
|
<div class="method-source-code" id="inspect_meth-source">
|
309
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/inspector.rb, line
|
316
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/inspector.rb, line 22</span>
|
310
317
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">inspect_meth</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-identifier">mname</span>)
|
311
318
|
<span class="ruby-identifier">mname</span> = <span class="ruby-identifier">mname</span>.<span class="ruby-identifier">to_sym</span>
|
312
319
|
<span class="ruby-keyword">if</span> <span class="ruby-constant">Breakable</span><span class="ruby-operator">::</span><span class="ruby-constant">TYPE_PLACEHOLDER_MAP</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">mod</span>)
|
313
320
|
<span class="ruby-identifier">placeholder</span> = <span class="ruby-constant">Breakable</span><span class="ruby-operator">::</span><span class="ruby-constant">TYPE_PLACEHOLDER_MAP</span>[<span class="ruby-identifier">mod</span>]
|
314
|
-
<span class="ruby-keyword">elsif</span> <span class="ruby-constant">Broken</span><span class="ruby-operator">::</span><span class="ruby-constant">TYPE_PLACEHOLDER_MAP</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">mod</span>)
|
315
|
-
<span class="ruby-identifier">placeholder</span> = <span class="ruby-constant">Broken</span><span class="ruby-operator">::</span><span class="ruby-constant">TYPE_PLACEHOLDER_MAP</span>[<span class="ruby-identifier">mod</span>]
|
316
|
-
<span class="ruby-keyword">else</span>
|
317
|
-
<span class="ruby-comment"># TODO</span>
|
318
321
|
<span class="ruby-keyword">end</span>
|
319
322
|
<span class="ruby-identifier">t</span> = <span class="ruby-identifier">placeholder</span>.<span class="ruby-identifier">meth_type_map</span>[<span class="ruby-identifier">mname</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">placeholder</span>
|
323
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">t</span> <span class="ruby-operator">&&</span> <span class="ruby-constant">Broken</span><span class="ruby-operator">::</span><span class="ruby-constant">TYPE_PLACEHOLDER_MAP</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">mod</span>)
|
324
|
+
<span class="ruby-identifier">placeholder</span> = <span class="ruby-constant">Broken</span><span class="ruby-operator">::</span><span class="ruby-constant">TYPE_PLACEHOLDER_MAP</span>[<span class="ruby-identifier">mod</span>]
|
325
|
+
<span class="ruby-identifier">t</span> = <span class="ruby-identifier">placeholder</span>.<span class="ruby-identifier">meth_type_map</span>[<span class="ruby-identifier">mname</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">placeholder</span>
|
326
|
+
<span class="ruby-keyword">end</span>
|
320
327
|
<span class="ruby-keyword">return</span> <span class="ruby-identifier">t</span>
|
321
328
|
<span class="ruby-keyword">end</span></pre>
|
322
329
|
</div><!-- inspect_meth-source -->
|
@@ -347,7 +354,7 @@ a hash of (mname, mtype) pairs.</p>
|
|
347
354
|
|
348
355
|
|
349
356
|
<div class="method-source-code" id="inspect_meths-source">
|
350
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/inspector.rb, line
|
357
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/inspector.rb, line 43</span>
|
351
358
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">inspect_meths</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-identifier">mnames</span>)
|
352
359
|
<span class="ruby-identifier">mtype_hash</span> = {}
|
353
360
|
<span class="ruby-identifier">mnames</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">mname</span><span class="ruby-operator">|</span>
|