rubybreaker 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS +48 -0
- data/README.md +56 -20
- data/Rakefile +9 -34
- data/TODO +10 -10
- data/VERSION +1 -0
- data/bin/gen_stub_rubylib +35 -36
- data/bin/rubybreaker +1 -4
- data/lib/rubybreaker/debug.rb +8 -4
- data/lib/rubybreaker/rubylib/core.rb +738 -571
- data/lib/rubybreaker/runtime/inspector.rb +16 -7
- data/lib/rubybreaker/runtime/monitor.rb +14 -18
- data/lib/rubybreaker/runtime/object_wrapper.rb +9 -3
- data/lib/rubybreaker/runtime/overrides.rb +51 -8
- data/lib/rubybreaker/runtime/pluggable.rb +1 -3
- data/lib/rubybreaker/runtime/type_placeholder.rb +2 -6
- data/lib/rubybreaker/runtime/type_system.rb +53 -17
- data/lib/rubybreaker/runtime/typesig_parser.rb +1 -0
- data/lib/rubybreaker/runtime/util.rb +18 -0
- data/lib/rubybreaker/runtime.rb +42 -15
- data/lib/rubybreaker/type/type_comparer.rb +10 -10
- data/lib/rubybreaker/type/type_grammar.treetop +30 -21
- data/lib/rubybreaker/type/type_unparser.rb +2 -2
- data/lib/rubybreaker/typing/subtyping.rb +21 -21
- data/lib/rubybreaker/util.rb +11 -1
- data/lib/rubybreaker.rb +75 -54
- data/test/integrated/tc_class_methods.rb +35 -0
- data/test/integrated/tc_inherit_broken.rb +29 -0
- data/test/integrated/tc_method_missing.rb +1 -1
- data/test/runtime/tc_obj_wrapper.rb +104 -4
- data/test/ts_integrated.rb +2 -0
- data/test/type/tc_comparer.rb +96 -96
- data/test/type/tc_parser.rb +18 -0
- data/test/type/tc_unparser.rb +16 -0
- data/test/typing/tc_typing.rb +20 -20
- data/webpage/footer.html +1 -1
- data/webpage/header.html +7 -7
- data/webpage/index.html +65 -28
- data/webpage/rdoc/RubyBreaker/Breakable.html +280 -0
- data/webpage/rdoc/RubyBreaker/Broken/BrokenEigen.html +304 -0
- data/webpage/rdoc/RubyBreaker/Broken.html +308 -0
- data/webpage/rdoc/RubyBreaker/Context.html +421 -0
- data/webpage/rdoc/RubyBreaker/Debug.html +411 -0
- data/webpage/rdoc/RubyBreaker/Errors/InternalError.html +263 -0
- data/webpage/rdoc/RubyBreaker/Errors/InvalidSubtypeCheck.html +263 -0
- data/webpage/rdoc/RubyBreaker/Errors/InvalidTypeConstruction.html +214 -0
- data/webpage/rdoc/RubyBreaker/Errors/SubtypeFailure.html +212 -0
- data/webpage/rdoc/RubyBreaker/Errors/TypeError.html +212 -0
- data/webpage/rdoc/RubyBreaker/Errors/UserError.html +264 -0
- data/webpage/rdoc/RubyBreaker/Errors.html +209 -0
- data/webpage/rdoc/RubyBreaker/Kernel.html +259 -0
- data/webpage/rdoc/RubyBreaker/Main.html +560 -0
- data/webpage/rdoc/RubyBreaker/ObjectPosition.html +334 -0
- data/webpage/rdoc/RubyBreaker/Position.html +463 -0
- data/webpage/rdoc/RubyBreaker/RubyTypeUtils.html +308 -0
- data/webpage/rdoc/RubyBreaker/Runtime/Inspector.html +380 -0
- data/webpage/rdoc/RubyBreaker/Runtime/MethodInfo.html +324 -0
- data/webpage/rdoc/RubyBreaker/Runtime/Monitor.html +354 -0
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorInstaller.html +379 -0
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorSwitch.html +382 -0
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorUtils.html +400 -0
- data/webpage/rdoc/RubyBreaker/Runtime/ObjectWrapper.html +411 -0
- data/webpage/rdoc/RubyBreaker/Runtime/Pluggable.html +305 -0
- data/webpage/rdoc/RubyBreaker/Runtime/TypePlaceholder.html +280 -0
- data/webpage/rdoc/RubyBreaker/Runtime/TypeSigParser.html +283 -0
- data/webpage/rdoc/RubyBreaker/Runtime/TypeSystem.html +630 -0
- data/webpage/rdoc/RubyBreaker/Runtime.html +255 -0
- data/webpage/rdoc/RubyBreaker/TestCase.html +332 -0
- data/webpage/rdoc/RubyBreaker/TypeComparer.html +304 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/AnyType.html +260 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/BlockType.html +310 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/DuckType.html +320 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/FusionType.html +323 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/MethodListType.html +281 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/MethodType.html +282 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/NilType.html +260 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/NominalType.html +282 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/OptionalType.html +281 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/OrType.html +281 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/SelfType.html +329 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/Type.html +409 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/VarLengthType.html +282 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs.html +212 -0
- data/webpage/rdoc/RubyBreaker/TypeUnparser.html +273 -0
- data/webpage/rdoc/RubyBreaker/Typing.html +305 -0
- data/webpage/rdoc/RubyBreaker/Utilities.html +294 -0
- data/webpage/rdoc/RubyBreaker.html +337 -0
- data/webpage/rdoc/created.rid +26 -0
- data/webpage/rdoc/images/add.png +0 -0
- data/webpage/rdoc/images/brick.png +0 -0
- data/webpage/rdoc/images/brick_link.png +0 -0
- data/webpage/rdoc/images/bug.png +0 -0
- data/webpage/rdoc/images/bullet_black.png +0 -0
- data/webpage/rdoc/images/bullet_toggle_minus.png +0 -0
- data/webpage/rdoc/images/bullet_toggle_plus.png +0 -0
- data/webpage/rdoc/images/date.png +0 -0
- data/webpage/rdoc/images/delete.png +0 -0
- data/webpage/rdoc/images/find.png +0 -0
- data/webpage/rdoc/images/loadingAnimation.gif +0 -0
- data/webpage/rdoc/images/macFFBgHack.png +0 -0
- data/webpage/rdoc/images/package.png +0 -0
- data/webpage/rdoc/images/page_green.png +0 -0
- data/webpage/rdoc/images/page_white_text.png +0 -0
- data/webpage/rdoc/images/page_white_width.png +0 -0
- data/webpage/rdoc/images/plugin.png +0 -0
- data/webpage/rdoc/images/ruby.png +0 -0
- data/webpage/rdoc/images/tag_blue.png +0 -0
- data/webpage/rdoc/images/tag_green.png +0 -0
- data/webpage/rdoc/images/transparent.png +0 -0
- data/webpage/rdoc/images/wrench.png +0 -0
- data/webpage/rdoc/images/wrench_orange.png +0 -0
- data/webpage/rdoc/images/zoom.png +0 -0
- data/webpage/rdoc/index.html +165 -0
- data/webpage/rdoc/js/darkfish.js +153 -0
- data/webpage/rdoc/js/jquery.js +18 -0
- data/webpage/rdoc/js/navigation.js +142 -0
- data/webpage/rdoc/js/search.js +94 -0
- data/webpage/rdoc/js/search_index.js +1 -0
- data/webpage/rdoc/js/searcher.js +228 -0
- data/webpage/rdoc/rdoc.css +543 -0
- data/webpage/rdoc/table_of_contents.html +376 -0
- data/webpage/rubybreaker.css +31 -31
- metadata +93 -6
@@ -0,0 +1,273 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>module RubyBreaker::TypeUnparser - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "../";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="module">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="../index.html">Home</a>
|
28
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/rubybreaker/type/type_unparser.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
|
60
|
+
<!-- Included Modules -->
|
61
|
+
<nav id="includes-section" class="section">
|
62
|
+
<h3 class="section-header">Included Modules</h3>
|
63
|
+
|
64
|
+
<ul class="link-list">
|
65
|
+
|
66
|
+
|
67
|
+
<li><a class="include" href="TypeDefs.html">RubyBreaker::TypeDefs</a>
|
68
|
+
|
69
|
+
|
70
|
+
</ul>
|
71
|
+
</nav>
|
72
|
+
|
73
|
+
<!-- Method Quickref -->
|
74
|
+
<nav id="method-list-section" class="section">
|
75
|
+
<h3 class="section-header">Methods</h3>
|
76
|
+
|
77
|
+
<ul class="link-list">
|
78
|
+
|
79
|
+
<li><a href="#method-c-unparse">::unparse</a>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
</nav>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<div id="project-metadata">
|
87
|
+
|
88
|
+
<nav id="classindex-section" class="section project-section">
|
89
|
+
<h3 class="section-header">Class and Module Index</h3>
|
90
|
+
|
91
|
+
<ul class="link-list">
|
92
|
+
|
93
|
+
<li><a href="../RubyBreaker.html">RubyBreaker</a>
|
94
|
+
|
95
|
+
<li><a href="../RubyBreaker/Breakable.html">RubyBreaker::Breakable</a>
|
96
|
+
|
97
|
+
<li><a href="../RubyBreaker/Broken.html">RubyBreaker::Broken</a>
|
98
|
+
|
99
|
+
<li><a href="../RubyBreaker/Broken/BrokenEigen.html">RubyBreaker::Broken::BrokenEigen</a>
|
100
|
+
|
101
|
+
<li><a href="../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
102
|
+
|
103
|
+
<li><a href="../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
104
|
+
|
105
|
+
<li><a href="../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
106
|
+
|
107
|
+
<li><a href="../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
108
|
+
|
109
|
+
<li><a href="../RubyBreaker/Errors/InvalidSubtypeCheck.html">RubyBreaker::Errors::InvalidSubtypeCheck</a>
|
110
|
+
|
111
|
+
<li><a href="../RubyBreaker/Errors/InvalidTypeConstruction.html">RubyBreaker::Errors::InvalidTypeConstruction</a>
|
112
|
+
|
113
|
+
<li><a href="../RubyBreaker/Errors/SubtypeFailure.html">RubyBreaker::Errors::SubtypeFailure</a>
|
114
|
+
|
115
|
+
<li><a href="../RubyBreaker/Errors/TypeError.html">RubyBreaker::Errors::TypeError</a>
|
116
|
+
|
117
|
+
<li><a href="../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
118
|
+
|
119
|
+
<li><a href="../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
120
|
+
|
121
|
+
<li><a href="../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
122
|
+
|
123
|
+
<li><a href="../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
124
|
+
|
125
|
+
<li><a href="../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
126
|
+
|
127
|
+
<li><a href="../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
128
|
+
|
129
|
+
<li><a href="../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
130
|
+
|
131
|
+
<li><a href="../RubyBreaker/Runtime/Inspector.html">RubyBreaker::Runtime::Inspector</a>
|
132
|
+
|
133
|
+
<li><a href="../RubyBreaker/Runtime/MethodInfo.html">RubyBreaker::Runtime::MethodInfo</a>
|
134
|
+
|
135
|
+
<li><a href="../RubyBreaker/Runtime/Monitor.html">RubyBreaker::Runtime::Monitor</a>
|
136
|
+
|
137
|
+
<li><a href="../RubyBreaker/Runtime/MonitorInstaller.html">RubyBreaker::Runtime::MonitorInstaller</a>
|
138
|
+
|
139
|
+
<li><a href="../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
140
|
+
|
141
|
+
<li><a href="../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
142
|
+
|
143
|
+
<li><a href="../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
144
|
+
|
145
|
+
<li><a href="../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
146
|
+
|
147
|
+
<li><a href="../RubyBreaker/Runtime/TypePlaceholder.html">RubyBreaker::Runtime::TypePlaceholder</a>
|
148
|
+
|
149
|
+
<li><a href="../RubyBreaker/Runtime/TypeSigParser.html">RubyBreaker::Runtime::TypeSigParser</a>
|
150
|
+
|
151
|
+
<li><a href="../RubyBreaker/Runtime/TypeSystem.html">RubyBreaker::Runtime::TypeSystem</a>
|
152
|
+
|
153
|
+
<li><a href="../RubyBreaker/TestCase.html">RubyBreaker::TestCase</a>
|
154
|
+
|
155
|
+
<li><a href="../RubyBreaker/TypeComparer.html">RubyBreaker::TypeComparer</a>
|
156
|
+
|
157
|
+
<li><a href="../RubyBreaker/TypeDefs.html">RubyBreaker::TypeDefs</a>
|
158
|
+
|
159
|
+
<li><a href="../RubyBreaker/TypeDefs/AnyType.html">RubyBreaker::TypeDefs::AnyType</a>
|
160
|
+
|
161
|
+
<li><a href="../RubyBreaker/TypeDefs/BlockType.html">RubyBreaker::TypeDefs::BlockType</a>
|
162
|
+
|
163
|
+
<li><a href="../RubyBreaker/TypeDefs/DuckType.html">RubyBreaker::TypeDefs::DuckType</a>
|
164
|
+
|
165
|
+
<li><a href="../RubyBreaker/TypeDefs/FusionType.html">RubyBreaker::TypeDefs::FusionType</a>
|
166
|
+
|
167
|
+
<li><a href="../RubyBreaker/TypeDefs/MethodListType.html">RubyBreaker::TypeDefs::MethodListType</a>
|
168
|
+
|
169
|
+
<li><a href="../RubyBreaker/TypeDefs/MethodType.html">RubyBreaker::TypeDefs::MethodType</a>
|
170
|
+
|
171
|
+
<li><a href="../RubyBreaker/TypeDefs/NilType.html">RubyBreaker::TypeDefs::NilType</a>
|
172
|
+
|
173
|
+
<li><a href="../RubyBreaker/TypeDefs/NominalType.html">RubyBreaker::TypeDefs::NominalType</a>
|
174
|
+
|
175
|
+
<li><a href="../RubyBreaker/TypeDefs/OptionalType.html">RubyBreaker::TypeDefs::OptionalType</a>
|
176
|
+
|
177
|
+
<li><a href="../RubyBreaker/TypeDefs/OrType.html">RubyBreaker::TypeDefs::OrType</a>
|
178
|
+
|
179
|
+
<li><a href="../RubyBreaker/TypeDefs/SelfType.html">RubyBreaker::TypeDefs::SelfType</a>
|
180
|
+
|
181
|
+
<li><a href="../RubyBreaker/TypeDefs/Type.html">RubyBreaker::TypeDefs::Type</a>
|
182
|
+
|
183
|
+
<li><a href="../RubyBreaker/TypeDefs/VarLengthType.html">RubyBreaker::TypeDefs::VarLengthType</a>
|
184
|
+
|
185
|
+
<li><a href="../RubyBreaker/TypeUnparser.html">RubyBreaker::TypeUnparser</a>
|
186
|
+
|
187
|
+
<li><a href="../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
188
|
+
|
189
|
+
<li><a href="../RubyBreaker/Utilities.html">RubyBreaker::Utilities</a>
|
190
|
+
|
191
|
+
</ul>
|
192
|
+
</nav>
|
193
|
+
|
194
|
+
</div>
|
195
|
+
</nav>
|
196
|
+
|
197
|
+
<div id="documentation">
|
198
|
+
<h1 class="module">module RubyBreaker::TypeUnparser</h1>
|
199
|
+
|
200
|
+
<div id="description" class="description">
|
201
|
+
|
202
|
+
<p>This module prints the <a href="../RubyBreaker.html">RubyBreaker</a> types
|
203
|
+
in a user-friendly way.</p>
|
204
|
+
|
205
|
+
</div><!-- description -->
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<!-- Methods -->
|
220
|
+
|
221
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
222
|
+
<h3 class="section-header">Public Class Methods</h3>
|
223
|
+
|
224
|
+
|
225
|
+
<div id="method-c-unparse" class="method-detail ">
|
226
|
+
|
227
|
+
<div class="method-heading">
|
228
|
+
<span class="method-name">unparse</span><span
|
229
|
+
class="method-args">(t)</span>
|
230
|
+
<span class="method-click-advice">click to toggle source</span>
|
231
|
+
</div>
|
232
|
+
|
233
|
+
|
234
|
+
<div class="method-description">
|
235
|
+
|
236
|
+
<p>This method is used to display any <a
|
237
|
+
href="../RubyBreaker.html">RubyBreaker</a> type in a user-friendly way
|
238
|
+
using the pretty print method.</p>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
<div class="method-source-code" id="unparse-source">
|
243
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/type/type_unparser.rb, line 124</span>
|
244
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">unparse</span>(<span class="ruby-identifier">t</span>)
|
245
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-string">""</span>
|
246
|
+
<span class="ruby-identifier">pp</span> = <span class="ruby-constant">PrettyPrint</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">str</span>)
|
247
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">unparse_pp</span>(<span class="ruby-identifier">pp</span>,<span class="ruby-identifier">t</span>)
|
248
|
+
<span class="ruby-identifier">pp</span>.<span class="ruby-identifier">flush</span>
|
249
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">str</span>.<span class="ruby-identifier">strip</span>()
|
250
|
+
<span class="ruby-keyword">end</span></pre>
|
251
|
+
</div><!-- unparse-source -->
|
252
|
+
|
253
|
+
</div>
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
</div><!-- unparse-method -->
|
259
|
+
|
260
|
+
|
261
|
+
</section><!-- public-class-method-details -->
|
262
|
+
|
263
|
+
</section><!-- 5Buntitled-5D -->
|
264
|
+
|
265
|
+
</div><!-- documentation -->
|
266
|
+
|
267
|
+
|
268
|
+
<footer id="validator-badges">
|
269
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
270
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
271
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
272
|
+
</footer>
|
273
|
+
|
@@ -0,0 +1,305 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>module RubyBreaker::Typing - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "../";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="module">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="../index.html">Home</a>
|
28
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/rubybreaker/typing/subtyping.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
|
60
|
+
<!-- Included Modules -->
|
61
|
+
<nav id="includes-section" class="section">
|
62
|
+
<h3 class="section-header">Included Modules</h3>
|
63
|
+
|
64
|
+
<ul class="link-list">
|
65
|
+
|
66
|
+
|
67
|
+
<li><a class="include" href="TypeDefs.html">RubyBreaker::TypeDefs</a>
|
68
|
+
|
69
|
+
|
70
|
+
</ul>
|
71
|
+
</nav>
|
72
|
+
|
73
|
+
<!-- Method Quickref -->
|
74
|
+
<nav id="method-list-section" class="section">
|
75
|
+
<h3 class="section-header">Methods</h3>
|
76
|
+
|
77
|
+
<ul class="link-list">
|
78
|
+
|
79
|
+
<li><a href="#method-c-subtype_rel-3F">::subtype_rel?</a>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
</nav>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<div id="project-metadata">
|
87
|
+
|
88
|
+
<nav id="classindex-section" class="section project-section">
|
89
|
+
<h3 class="section-header">Class and Module Index</h3>
|
90
|
+
|
91
|
+
<ul class="link-list">
|
92
|
+
|
93
|
+
<li><a href="../RubyBreaker.html">RubyBreaker</a>
|
94
|
+
|
95
|
+
<li><a href="../RubyBreaker/Breakable.html">RubyBreaker::Breakable</a>
|
96
|
+
|
97
|
+
<li><a href="../RubyBreaker/Broken.html">RubyBreaker::Broken</a>
|
98
|
+
|
99
|
+
<li><a href="../RubyBreaker/Broken/BrokenEigen.html">RubyBreaker::Broken::BrokenEigen</a>
|
100
|
+
|
101
|
+
<li><a href="../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
102
|
+
|
103
|
+
<li><a href="../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
104
|
+
|
105
|
+
<li><a href="../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
106
|
+
|
107
|
+
<li><a href="../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
108
|
+
|
109
|
+
<li><a href="../RubyBreaker/Errors/InvalidSubtypeCheck.html">RubyBreaker::Errors::InvalidSubtypeCheck</a>
|
110
|
+
|
111
|
+
<li><a href="../RubyBreaker/Errors/InvalidTypeConstruction.html">RubyBreaker::Errors::InvalidTypeConstruction</a>
|
112
|
+
|
113
|
+
<li><a href="../RubyBreaker/Errors/SubtypeFailure.html">RubyBreaker::Errors::SubtypeFailure</a>
|
114
|
+
|
115
|
+
<li><a href="../RubyBreaker/Errors/TypeError.html">RubyBreaker::Errors::TypeError</a>
|
116
|
+
|
117
|
+
<li><a href="../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
118
|
+
|
119
|
+
<li><a href="../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
120
|
+
|
121
|
+
<li><a href="../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
122
|
+
|
123
|
+
<li><a href="../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
124
|
+
|
125
|
+
<li><a href="../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
126
|
+
|
127
|
+
<li><a href="../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
128
|
+
|
129
|
+
<li><a href="../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
130
|
+
|
131
|
+
<li><a href="../RubyBreaker/Runtime/Inspector.html">RubyBreaker::Runtime::Inspector</a>
|
132
|
+
|
133
|
+
<li><a href="../RubyBreaker/Runtime/MethodInfo.html">RubyBreaker::Runtime::MethodInfo</a>
|
134
|
+
|
135
|
+
<li><a href="../RubyBreaker/Runtime/Monitor.html">RubyBreaker::Runtime::Monitor</a>
|
136
|
+
|
137
|
+
<li><a href="../RubyBreaker/Runtime/MonitorInstaller.html">RubyBreaker::Runtime::MonitorInstaller</a>
|
138
|
+
|
139
|
+
<li><a href="../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
140
|
+
|
141
|
+
<li><a href="../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
142
|
+
|
143
|
+
<li><a href="../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
144
|
+
|
145
|
+
<li><a href="../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
146
|
+
|
147
|
+
<li><a href="../RubyBreaker/Runtime/TypePlaceholder.html">RubyBreaker::Runtime::TypePlaceholder</a>
|
148
|
+
|
149
|
+
<li><a href="../RubyBreaker/Runtime/TypeSigParser.html">RubyBreaker::Runtime::TypeSigParser</a>
|
150
|
+
|
151
|
+
<li><a href="../RubyBreaker/Runtime/TypeSystem.html">RubyBreaker::Runtime::TypeSystem</a>
|
152
|
+
|
153
|
+
<li><a href="../RubyBreaker/TestCase.html">RubyBreaker::TestCase</a>
|
154
|
+
|
155
|
+
<li><a href="../RubyBreaker/TypeComparer.html">RubyBreaker::TypeComparer</a>
|
156
|
+
|
157
|
+
<li><a href="../RubyBreaker/TypeDefs.html">RubyBreaker::TypeDefs</a>
|
158
|
+
|
159
|
+
<li><a href="../RubyBreaker/TypeDefs/AnyType.html">RubyBreaker::TypeDefs::AnyType</a>
|
160
|
+
|
161
|
+
<li><a href="../RubyBreaker/TypeDefs/BlockType.html">RubyBreaker::TypeDefs::BlockType</a>
|
162
|
+
|
163
|
+
<li><a href="../RubyBreaker/TypeDefs/DuckType.html">RubyBreaker::TypeDefs::DuckType</a>
|
164
|
+
|
165
|
+
<li><a href="../RubyBreaker/TypeDefs/FusionType.html">RubyBreaker::TypeDefs::FusionType</a>
|
166
|
+
|
167
|
+
<li><a href="../RubyBreaker/TypeDefs/MethodListType.html">RubyBreaker::TypeDefs::MethodListType</a>
|
168
|
+
|
169
|
+
<li><a href="../RubyBreaker/TypeDefs/MethodType.html">RubyBreaker::TypeDefs::MethodType</a>
|
170
|
+
|
171
|
+
<li><a href="../RubyBreaker/TypeDefs/NilType.html">RubyBreaker::TypeDefs::NilType</a>
|
172
|
+
|
173
|
+
<li><a href="../RubyBreaker/TypeDefs/NominalType.html">RubyBreaker::TypeDefs::NominalType</a>
|
174
|
+
|
175
|
+
<li><a href="../RubyBreaker/TypeDefs/OptionalType.html">RubyBreaker::TypeDefs::OptionalType</a>
|
176
|
+
|
177
|
+
<li><a href="../RubyBreaker/TypeDefs/OrType.html">RubyBreaker::TypeDefs::OrType</a>
|
178
|
+
|
179
|
+
<li><a href="../RubyBreaker/TypeDefs/SelfType.html">RubyBreaker::TypeDefs::SelfType</a>
|
180
|
+
|
181
|
+
<li><a href="../RubyBreaker/TypeDefs/Type.html">RubyBreaker::TypeDefs::Type</a>
|
182
|
+
|
183
|
+
<li><a href="../RubyBreaker/TypeDefs/VarLengthType.html">RubyBreaker::TypeDefs::VarLengthType</a>
|
184
|
+
|
185
|
+
<li><a href="../RubyBreaker/TypeUnparser.html">RubyBreaker::TypeUnparser</a>
|
186
|
+
|
187
|
+
<li><a href="../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
188
|
+
|
189
|
+
<li><a href="../RubyBreaker/Utilities.html">RubyBreaker::Utilities</a>
|
190
|
+
|
191
|
+
</ul>
|
192
|
+
</nav>
|
193
|
+
|
194
|
+
</div>
|
195
|
+
</nav>
|
196
|
+
|
197
|
+
<div id="documentation">
|
198
|
+
<h1 class="module">module RubyBreaker::Typing</h1>
|
199
|
+
|
200
|
+
<div id="description" class="description">
|
201
|
+
|
202
|
+
<p>This module contains subtyping logic used in <a
|
203
|
+
href="../RubyBreaker.html">RubyBreaker</a>. See <em>rubytype.rb</em> for
|
204
|
+
logic related to subclassing which is directly related to pure Ruby types.</p>
|
205
|
+
|
206
|
+
</div><!-- description -->
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
<!-- Methods -->
|
221
|
+
|
222
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
223
|
+
<h3 class="section-header">Public Class Methods</h3>
|
224
|
+
|
225
|
+
|
226
|
+
<div id="method-c-subtype_rel-3F" class="method-detail ">
|
227
|
+
|
228
|
+
<div class="method-heading">
|
229
|
+
<span class="method-name">subtype_rel?</span><span
|
230
|
+
class="method-args">(lhs, rhs)</span>
|
231
|
+
<span class="method-click-advice">click to toggle source</span>
|
232
|
+
</div>
|
233
|
+
|
234
|
+
|
235
|
+
<div class="method-description">
|
236
|
+
|
237
|
+
<p>This method determines if one type is a subtype of another. This check is
|
238
|
+
for <a href="../RubyBreaker.html">RubyBreaker</a> defined types. See <em><a
|
239
|
+
href="TypeDefs.html">TypeDefs</a></em> module for more detail.</p>
|
240
|
+
<dl class="rdoc-list note-list"><dt>lhs
|
241
|
+
<dd>
|
242
|
+
<p>The allegedly “subtype”</p>
|
243
|
+
</dd><dt>rhs
|
244
|
+
<dd>
|
245
|
+
<p>The allegedly “supertype”</p>
|
246
|
+
</dd></dl>
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
<div class="method-source-code" id="subtype_rel-3F-source">
|
251
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/typing/subtyping.rb, line 435</span>
|
252
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">subtype_rel?</span>(<span class="ruby-identifier">lhs</span>, <span class="ruby-identifier">rhs</span>)
|
253
|
+
|
254
|
+
<span class="ruby-comment"># Don't even bother if they are same object or syntactically</span>
|
255
|
+
<span class="ruby-comment"># equivalent. NOTE: would this really help improve performance???</span>
|
256
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> (<span class="ruby-identifier">lhs</span>.<span class="ruby-identifier">equal?</span>(<span class="ruby-identifier">rhs</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">lhs</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">rhs</span>))
|
257
|
+
|
258
|
+
<span class="ruby-comment"># Break down the cases by what LHS is.</span>
|
259
|
+
<span class="ruby-identifier">is_subtype</span> = <span class="ruby-keyword">false</span>
|
260
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">lhs</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">NilType</span>)
|
261
|
+
<span class="ruby-identifier">is_subtype</span> = <span class="ruby-identifier">rhs</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">NilType</span>)
|
262
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">lhs</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">AnyType</span>)
|
263
|
+
<span class="ruby-identifier">is_subtype</span> = <span class="ruby-keyword">true</span>
|
264
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">lhs</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">SelfType</span>)
|
265
|
+
<span class="ruby-identifier">is_subtype</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">self_subtype_rel?</span>(<span class="ruby-identifier">lhs</span>,<span class="ruby-identifier">rhs</span>)
|
266
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">lhs</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">NominalType</span>)
|
267
|
+
<span class="ruby-identifier">is_subtype</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">nominal_subtype_rel?</span>(<span class="ruby-identifier">lhs</span>,<span class="ruby-identifier">rhs</span>)
|
268
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">lhs</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">FusionType</span>)
|
269
|
+
<span class="ruby-identifier">is_subtype</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">fusion_subtype_rel?</span>(<span class="ruby-identifier">lhs</span>,<span class="ruby-identifier">rhs</span>)
|
270
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">lhs</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">DuckType</span>)
|
271
|
+
<span class="ruby-identifier">is_subtype</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">duck_subtype_rel?</span>(<span class="ruby-identifier">lhs</span>,<span class="ruby-identifier">rhs</span>)
|
272
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">lhs</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">MethodType</span>)
|
273
|
+
<span class="ruby-identifier">is_subtype</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">method_subtype_rel?</span>(<span class="ruby-identifier">lhs</span>,<span class="ruby-identifier">rhs</span>)
|
274
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">lhs</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">OrType</span>)
|
275
|
+
<span class="ruby-identifier">is_subtype</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">or_subtype_rel?</span>(<span class="ruby-identifier">lhs</span>,<span class="ruby-identifier">rhs</span>)
|
276
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">lhs</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">BlockType</span>)
|
277
|
+
<span class="ruby-identifier">is_subtype</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">proc_subtype_rel?</span>(<span class="ruby-identifier">lhs</span>,<span class="ruby-identifier">rhs</span>)
|
278
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">lhs</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">MethodListType</span>)
|
279
|
+
<span class="ruby-identifier">is_subtype</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">method_subtype_rel?</span>(<span class="ruby-identifier">lhs</span>,<span class="ruby-identifier">rhs</span>)
|
280
|
+
<span class="ruby-keyword">end</span>
|
281
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">is_subtype</span>
|
282
|
+
<span class="ruby-keyword">end</span></pre>
|
283
|
+
</div><!-- subtype_rel-3F-source -->
|
284
|
+
|
285
|
+
</div>
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
</div><!-- subtype_rel-3F-method -->
|
291
|
+
|
292
|
+
|
293
|
+
</section><!-- public-class-method-details -->
|
294
|
+
|
295
|
+
</section><!-- 5Buntitled-5D -->
|
296
|
+
|
297
|
+
</div><!-- documentation -->
|
298
|
+
|
299
|
+
|
300
|
+
<footer id="validator-badges">
|
301
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
302
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
303
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
304
|
+
</footer>
|
305
|
+
|