mirah 0.2.0-java → 0.2.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3dbc388f42b56d2b4fd602bb263bf8e6118ad68
4
- data.tar.gz: a373064dc7812cc00b8fba091452689bc0732e30
3
+ metadata.gz: 95d1b94e903fd018b5f99cc5af06b14bf8f9b7df
4
+ data.tar.gz: 4a7c4d5a02d79841d6a9d4b6c91d2fddc4da2500
5
5
  SHA512:
6
- metadata.gz: 9fa1a9c98a2c720de6e510a01f875d210d85cec308f7d60bded3fa796cac3da1605ad4c2f75c95873a62ff8549a31a5bcc12486c88a3aa7476c03f59bccd40fe
7
- data.tar.gz: 31ed8a26b5dc6121c441c26ec36dce342ede7a504c94bc53bd5ed87da91ad8ec279b896688c6cbf2c9620faac51ef8def8953c6571c1c01f4ae49b1b2c8e04c5
6
+ metadata.gz: d8bc7d1987dd12cc5550bc9739acba38f1ffaf5794a962cf1d769b8e31249f4543efcfe2423efebe682b672c714ed5469b2cb6bfdfc88f145191e063c018bfa3
7
+ data.tar.gz: a899eed66c202cded5f74cb22ea146828a38a1478d43baa505abc35f3e111f4c8d3124c82a9d63b9aff6cfa574beb26ba6900d8afdfd855b0d5a00dd408d2adf
@@ -0,0 +1,276 @@
1
+ 0.2.0 Back In Action
2
+ ====================
3
+
4
+ This is a large release, relatively speaking. It's been a long time since the last release (Mar 2015!), but Mirah's had a lot of improvements since then. I decided to bump the minor release to 0.2 because it felt right. This release has a lot of code in it from a number of contributors.
5
+
6
+ Here's a list of highlights for this release. If I miss anything cool, it's my fault not the authors of the fixes.
7
+
8
+ ## Semantics
9
+
10
+ Now == != tests for value equality and === / !== tests for identity. I'd talked about this before [link].
11
+
12
+ In Java, == and != are value equality for primitives, but reference equality for references--ie identity. In Ruby, they don't test identity. Now Mirah acts more like Ruby in this way. When using == on an object, it will return the results of calling `equals`.
13
+
14
+ ## New Macros
15
+
16
+ Casts were ambiguous, as they looked like calls. They also could make code trickier to follow. Mirah now has a new cast macro built in.
17
+
18
+ # Instead of this:
19
+ int(a_float)
20
+ # Do this
21
+ a_float.as!(int)
22
+
23
+ Synchonization
24
+
25
+ my_object.synchonize { thing_that_needs(a.lock) }
26
+
27
+ javadoc support
28
+ 8bb9632 java doc support
29
+
30
+
31
+ Access control flags as modifiers
32
+
33
+ private def my_method; end
34
+
35
+ ## Syntax
36
+
37
+ Strings as keys in hash literals
38
+
39
+ {"x": 1}
40
+
41
+
42
+ ## Lots of bug fixes
43
+
44
+ * Better error messages on parse failures.
45
+ * The code generator won't generate a message for every class anymore.
46
+ * The warning about matching scope sizes is gone.
47
+
48
+ ## Internals / Build
49
+ * Parser moved to mirah repo, and hooked into build
50
+ There's a whole lot of cleaning things up. For instance, now running rake test will build the parser directly and then use that version of the parser when running tests
51
+ * Update asm to 5.
52
+ * Logging in the compiler is now macro-ified which makes the compiler noticably faster when debugging is off.
53
+ * Macros are now registered as service providers. This should make it easier for libaries to create jars that export their macros. I've got some ideas to build on this that should make it easier.
54
+
55
+
56
+ ## CLI
57
+ --new-closures is gone as there's only one closure implementation now.
58
+
59
+ ## pull requests
60
+ parser#32
61
+ mirah#434
62
+
63
+ mirah#430
64
+
65
+
66
+
67
+ --------------------
68
+ --------------------
69
+ --------------------
70
+ --------------------
71
+ --------------------
72
+ --------------------
73
+ --------------------
74
+ --------------------
75
+ --------------------
76
+ --------------------
77
+ --------------------
78
+ --------------------
79
+ --------------------
80
+ --------------------
81
+ --------------------
82
+ --------------------
83
+ --------------------
84
+ --------------------
85
+ --------------------
86
+ --------------------
87
+
88
+
89
+
90
+ 462d375 Fix bug https://github.com/mirah/mirah/issues/388.
91
+
92
+ 624f0e0 Fix code which made use of bug https://github.com/mirah/mirah/issues/383.
93
+ 7b7f471 Fix bug https://github.com/mirah/mirah/issues/383.
94
+ 2581f69 Test for bug https://github.com/mirah/mirah/issues/383.
95
+
96
+
97
+ e93cca1 merge issue: fixed broken commit: 23460a5 issues/#23
98
+ 68968b5 Fix bug https://github.com/mirah/mirah/issues/369.
99
+ 5af2a7f Test for bug https://github.com/mirah/mirah/issues/369.
100
+
101
+
102
+ 96255c1 added a test for blocks over abstract class accepting itself as a closure in static method
103
+ 2fb2d32 operators support for primitive wrappers
104
+ 04e03ac support for unsigned shift operator
105
+
106
+ a6aec7e macro resgistration using java services SPI
107
+ 7c956c0 optional macro arguments: fix tests and alignment
108
+ 12c24c3 optional arguments for macro: register separate macro for each optional argument (cherry picked from commit 19b49e6)
109
+
110
+ 4b11204 fixed minor issues. made utf8 default encoding. added test for cp1251 encoding
111
+
112
+ 2615ed5 mirahc support for -encoding option like javac (cherry picked from commit b4af32b)
113
+
114
+ c0d68cb Fix crash when operating on arrays of type variables.
115
+
116
+
117
+ 971f161 Fix bug https://github.com/mirah/mirah/issues/361.
118
+ 7cd6afd Test for bug https://github.com/mirah/mirah/issues/361.
119
+ 8b41384 Honor tabulators and other white space when underlining.
120
+
121
+ c260ed1 Test for another variant of bug https://github.com/mirah/mirah/issues/357.
122
+ 8274dea Test for bug https://github.com/mirah/mirah/issues/357.
123
+
124
+ 99a8709 allow imports in rescues
125
+ 1c8a6ba Defer temporary variable names to which-ever top-level Scope is reachable, as ScriptScope is currently not always top-level. This fixes bug https://github.com/mirah/mirah/issues/355.
126
+ 8defb35 Test for bug https://github.com/mirah/mirah/issues/355.
127
+
128
+ 729e738 Make synthetic variables inacessible (and thus inclashable) from the user language.
129
+ de3993a Implement SyntheticLambdaDefinition.
130
+
131
+ ca9b0ad Use #to_array to yield a Java [] array, reserve #to_a to yield a Java List.
132
+ 65340e2 Fix documenting comments.
133
+ 7b08338 Apply suggestion from review.
134
+ b0175b2 Make ant sources explicit.
135
+
136
+
137
+ 03a4cd0 Support 0-arguments block for String#each_codepoint.
138
+ 59f0f70 Support "protected" on a list of methods.
139
+ a086ed2 Testcase for bug https://github.com/mirah/mirah/issues/345.
140
+
141
+ 2e5e973 Do not implement static puts() macro with 0 arguments now, as we need a new compiler binary for this.
142
+ 607c091 Make 0-arguments instance macro coexist with 0-arguments static macro with the same name.
143
+ 3984ea3 Fix bug https://github.com/mirah/mirah/issues/345.
144
+
145
+ 5292a0f Merge pull request #370 from uujava/support_source_encoding
146
+ 04c65d4 Merge pull request #308 from felixvf/feature_native_methods
147
+ 13bcded Merge pull request #384 from felixvf/fix_bug_383
148
+ 9f8f666 Merge pull request #301 from felixvf/feature_synchronized_methods
149
+ 4aab793 Merge pull request #311 from felixvf/feature_string_to_int
150
+ 10844a9 Merge pull request #374 from uujava/unboxing_numeric_operators
151
+ 863f3d1 Merge pull request #373 from uujava/optional_arguments_for_macro
152
+ c1fa175 Merge pull request #28 from uujava/unsigned_shift_operator
153
+ f2b68da Merge pull request #376 from uujava/abstract_class_closure_test
154
+ fd7812a Merge pull request #378 from felixvf/fix_bug_369
155
+ 94f690d Merge pull request #347 from KeenS/remove-edb
156
+ 9cd5edd Merge pull request #368 from felixvf/fix_type_invoker_array_on_type_variable_bug
157
+ 9422f30 Merge pull request #356 from felixvf/fix_bug_355
158
+ 681f3a4 Merge pull request #325 from felixvf/featureset_ruby_collections
159
+ b3c724f Merge pull request #362 from felixvf/fix_bug_361
160
+ 044a4fd Merge pull request #358 from felixvf/fix_bug_357
161
+ 868d8da Merge pull request #27 from felixvf/feature_synthetic_lambda_definition
162
+ 56a2bef Merge pull request #343 from felixvf/feature_protected_methods
163
+ 08de5f2 Merge pull request #349 from felixvf/fix_missing_0_arguments_puts
164
+ e6ec8ee Merge pull request #333 from felixvf/featureset_rubystyle_string
165
+ a7fffbe Merge pull request #338 from felixvf/feature_efficient_equals
166
+ efee957 Merge pull request #336 from felixvf/feature_logging_optimization
167
+ 541b691 Merge pull request #302 from felixvf/feature_static_final_fields
168
+ 4cfc2eb Merge pull request #342 from felixvf/fix_jruby9000_compatibility
169
+ 86b2b68 Merge pull request #339 from felixvf/fix_bug_335
170
+ 83219e6 Merge pull request #329 from felixvf/fix_bug_328
171
+
172
+ b6e2f50 Use more modern MMeta.
173
+ 8fc3f74 Test "protected" on a nested list of methods.
174
+
175
+ f57d236 Test whether compilation works when we define a superinterface late.
176
+
177
+
178
+ -------------
179
+ macros / features
180
+
181
+ 04a6d42 support for using constants from static imports
182
+
183
+ d7592ca add join(separator) to Collections extensions
184
+
185
+ ad5eae1 Implement [].new(size.block) for Java-arrays.
186
+ ac458ec Implement String#each_codepoint.
187
+ 722ab47 Test []#size.
188
+ b325b25 Test Collection#mapa.
189
+ 7264894 Test #join(separator).
190
+ 8f2443d Test []#join().
191
+ dce3517 Test Collection#join().
192
+ fb82d7c Define Collection#to_a(basetype).
193
+ 01639af Define Iterable#each_with_index.
194
+ ba626b4 Support Object#tap.
195
+ 9ad1ccb Implement List#first, List#last.
196
+ 97a85f0 Differentiate between #first, #first!, #last, #last!.
197
+ bd4db83 Support String#match.
198
+
199
+ 6fbb826 Implement Collection.<<().
200
+ 1e0db3a Define Hash#each.
201
+ 54ac8af Move []#mapa to CollectionExtensions#mapa.
202
+ 0f56a6a Define []#size.
203
+ bf54440 Define []#isEmpty.
204
+ 2dd9365 Implement []#mapa.
205
+ 6f68fa5 Implement []#as_list.
206
+ af000e3 Implement []#each_with_index.
207
+ 3bf01bc Implement []#join().
208
+ 04b8255 Implement []#join(separator).
209
+ 3d092d7 Implement []#sort, []#sort!, []#dup.
210
+ 751c692 Implement []#map.
211
+ 0c25ae2 Implement java.lang.String#to_int.
212
+ 5c8085b Implement java.util.List#sort().
213
+ a657d3c Implement java.util.List#sort(comparator).
214
+ 5df99c6 Make ListExtensions#sort!(comparator), ListExtensions#sort(comparator) able to process block-form comparators.
215
+ 8683eca Make ListExtensions#sort!(comparator), ListExtensions#sort(comparator) able to process java.util.Comparators.
216
+
217
+ 62c8cf7 Add Collection#join macro.
218
+ db3832f Add Collection#select macro.
219
+ 0bffd26 add empty? to collection extensions
220
+
221
+ de04b79 Implement support for native methods.
222
+ 253fbee When emitting native methods, do not emit an implementation.
223
+
224
+
225
+ 6ad60a9 Support transient fields.
226
+ bae1b0d Make static_final a standard macro.
227
+ 97907d7 Support static final long fields.
228
+
229
+ 11038a8 add option to compile macros to separate destination
230
+ de51072 separate build dirs for different jar run outputs, add ws
231
+
232
+ 3f4c7e9 Added support for private, protected, and package_private keywords on method definitions. Should probably add them for classes as well, but haven't done that yet. https://github.com/mirah/mirah/issues/220
233
+
234
+ fe7d9f4 Added support for including comment and whitespace tokens in lexer. https://github.com/mirah/mirah-parser/issues/14
235
+
236
+ b9842f9 [mirah] support for java 8 interface virtual extension methods (#279)
237
+
238
+ b9b35ca Disable #verify_columns for the time being, as it is currently not usable, as the columns created by macro "quote" are currently not satisfying #verify_columns.
239
+ 2559069 Check for matching columns in "def ...; ...; end" and other blocks ended with "end".
240
+
241
+
242
+ --------------
243
+ bugs
244
+ ----------------
245
+ 63116c1 Fix JRUBY9000 compatibility.
246
+
247
+ a7317d3 MirahCommand.main should exit with the exit code of whatever it ran
248
+ 01504c8 Prevent calling System.exit in Mirah.run().
249
+ 84a8f30 A StringEval should be evaluated once, not possibly multiple times if it has more than 1 children. This fixes https://github.com/mirah/mirah/issues/322 .
250
+ 97ab9dc Fix warning that "initialize" and "self.initialize" may conflict, when they actually do not conflict.
251
+ da6ce70 If we support inner classes, then we should also support inner interfaces.
252
+
253
+ 0c67175 Return proper status code when being called using bin/mirahc.
254
+
255
+ f97cd43 Prevent calling System.exit when being embedded into a JVM (e.g. being embedded into ant).
256
+ 321f6fe move class literal filter into getAllDeclaredMethods so innerclasses are not listed as declared methods
257
+
258
+ a05ed3c Fix bug where changes to a class body during execution of a macro were not reflected if the macro was the last element of the body of the class.
259
+ cf10112 Fix mirah/mirah#297.
260
+ 95dfce8 Merge pull request #26 from felixvf/fix_bug_mirah-parser_25
261
+ a900c10 Fix bug https://github.com/mirah/mirah-parser/issues/25 for DStrings.
262
+ a13ebdf Fix bug https://github.com/mirah/mirah-parser/issues/25 for SStrings.
263
+ 42af39e Testcase for bug https://github.com/mirah/mirah-parser/issues/25.
264
+ 7a1fd3a Merge pull request #24 from felixvf/fix_bug_mirah-parser_23
265
+ 23460a5 Fix bug https://github.com/mirah/mirah-parser/issues/23.
266
+ 87dbc31 Test for bug https://github.com/mirah/mirah-parser/issues/23.
267
+ b06fbfe Test for bug https://github.com/mirah/mirah/issues/330.
268
+ 54c6708 Test for bug https://github.com/mirah/mirah-parser/issues/25.
269
+ 9699ad5 Test for bug https://github.com/mirah/mirah-parser/issues/23.
270
+ 7ee1db1 Do not copy the grandchildren in Unquote#nodes, as the child may actually be a ProxyNode, and the currently selected grandchild may not be the correct final grandchild, resulting in subtle compilation errors. This fixes https://github.com/mirah/mirah/issues/330.
271
+ 541f92b Test for bug https://github.com/mirah/mirah/issues/322 .
272
+ d7a3049 Test for bug mirah/mirah#320.
273
+ 63a7f37 Test for bug https://github.com/mirah/mirah/issues/335.
274
+ f7736c9 Fix MirahClassLoader bug, where the binary name of the class (as of the Java Language Specification) was not properly deduced.
275
+
276
+ c6e0fe5 Fix inheritance of interfaces in any order.
@@ -1,3 +1,35 @@
1
+ 0.2.1 Self Closure / 9-25-2016
2
+ ==========================
3
+
4
+ cdd5e69 Bump versions to 0.2.1
5
+ 3577458 binding adjuster. If a fn call's unresolved, dont replace it
6
+ 67f0a03 clean up some object ext comments
7
+ 67a3c4e add == impl for arrays using java.util.Arrays
8
+ 25a3472 rm some dead code, clean up formatting in places
9
+ 8350ff3 Fix TODO for DescendentFinder rm duplicated code that was commented out in the parser
10
+ c881333 should also be able to close over super type's methods
11
+ 7141cc4 fixes for compiling mirah with an older mirah
12
+ bbf5f3a fix const lookups within the same compilation unit
13
+ 0e3c706 ensure double colon works atleast for previously compiled artifacts
14
+ 3143364 add self closing too
15
+ 4ae4f53 get most closure types to a working state!
16
+ e499840 better exit failure message when running mirah
17
+ 7e1bfa5 field / self closures work. :)
18
+ d91bc5a fix release link
19
+ 0200bb3 remove unused imports for SimpleScope(r)
20
+ aeace8a Mirah run mode should not stop the process unless compile failed
21
+ ad9b31d minor whitespace fixes
22
+ 7414af5 Really fix by changing builder's naming
23
+ f74bf7a Change naming scheme for macros to use the macro name
24
+ ccb3aba Fix metacircularity of the parser.
25
+ 6c09be2 just use test-unit at whatever version
26
+ be6c757 Merge pull request #436 from KoKumagai/fix-typo
27
+ 63a6b62 Merge pull request #440 from uujava/fix_list_assignment_macro
28
+ 9175280 fix list assignment to use set instead of add (cherry picked from commit 5bd8af1)
29
+ 7dd1219 bump to 0.2.1.dev version
30
+ d8fdbc1 Fix a typo
31
+
32
+
1
33
  0.2.0 Back In Action / 2016-8-6
2
34
  ===============================
3
35
 
data/README.md CHANGED
@@ -45,7 +45,7 @@ INSTALL
45
45
 
46
46
  ### RUBY
47
47
 
48
- If your gem and rake are not from from JRuby, prefix the commands with `jruby -S`
48
+ If your gem and rake are not from JRuby, prefix the commands with `jruby -S`
49
49
 
50
50
  $ gem install mirah
51
51
 
@@ -57,7 +57,7 @@ Mirah is distributed as a jar through maven central. You can download the latest
57
57
  ### ZIP
58
58
 
59
59
  You can also install Mirah from a zip file. Download the latest stable
60
- release from https://github.com/mirah/mirah/downloads.
60
+ release from https://github.com/mirah/mirah/releases.
61
61
  Extract it, and add `bin` to your `$PATH` to be able to use `mirah`, `mirahc`, etc.
62
62
 
63
63
  ### SOURCE
data/Rakefile CHANGED
@@ -79,7 +79,7 @@ end
79
79
  namespace :test do
80
80
 
81
81
  desc "run parser tests"
82
- Rake::TestTask.new :parser => ['build/mirah-parser.jar'] do |t|
82
+ Rake::TestTask.new :parser => ['dist/mirah-parser.jar'] do |t|
83
83
  t.test_files = FileList["mirah-parser/test/**/test*.rb"]
84
84
  end
85
85
 
@@ -247,6 +247,108 @@ end
247
247
  def bootstrap_mirah_from(old_jar, new_jar)
248
248
  name = new_jar.gsub /[\.\/]/, '_'
249
249
 
250
+ # Mirah Parser build tasks
251
+
252
+ mirah_parser_build_dir = "build/#{name}-parser"
253
+ mirah_parser_jar = "build/#{name}-parser.jar"
254
+ mirah_parser_gen_src = "#{mirah_parser_build_dir}-gen/mirahparser/impl/Mirah.mirah"
255
+
256
+ parser_node_meta_class = "#{mirah_parser_build_dir}/org/mirahparser/ast/NodeMeta.class"
257
+ parser_node_java_gen_src = "#{mirah_parser_build_dir}-gen/mirahparser/lang/ast/Node.java"
258
+ parser_node_class = "#{mirah_parser_build_dir}/mirahparser/lang/ast/Node.class"
259
+ parser_meta_src = 'mirah-parser/src/org/mirah/ast/meta.mirah'
260
+ prev_jar = old_jar #'javalib/mirahc-prev.jar'
261
+ directory "#{mirah_parser_build_dir}/mirah-parser/mirahparser/impl"
262
+
263
+
264
+ file mirah_parser_jar => ["#{mirah_parser_build_dir}/mirahparser/lang/ast/Node.class",
265
+ "#{mirah_parser_build_dir}/mirahparser/impl/MirahParser.class",
266
+ "#{mirah_parser_build_dir}/mirahparser/impl/MirahLexer.class"] do
267
+ ant.jarjar 'jarfile' => mirah_parser_jar do
268
+ fileset 'dir' => mirah_parser_build_dir, 'includes' => 'mirahparser/impl/*.class'
269
+ fileset 'dir' => mirah_parser_build_dir, 'includes' => 'mirahparser/lang/ast/*.class'
270
+ fileset 'dir' => mirah_parser_build_dir, 'includes' => 'org/mirahparser/ast/*.class'
271
+ zipfileset 'src' => 'mirah-parser/javalib/mmeta-runtime.jar'
272
+ _element 'rule', 'pattern'=>'mmeta.**', 'result'=>'org.mirahparser.mmeta.@1'
273
+ manifest do
274
+ attribute 'name'=>"Main-Class", 'value'=>"mirahparser.impl.MirahParser"
275
+ end
276
+ end
277
+ end
278
+
279
+ number = new_jar.scan(/dist\/mirahc(\d+)?.jar/).first.first
280
+ dist_mirah_parser_jar = "dist/mirah-parser#{number}.jar"
281
+
282
+ file dist_mirah_parser_jar => mirah_parser_jar do
283
+ # Mirahc picks up the built in classes instead of our versions.
284
+ # So we compile in a different package and then jarjar them to the correct
285
+ # one.
286
+ ant.jarjar 'jarfile' => dist_mirah_parser_jar do
287
+ zipfileset 'src' => mirah_parser_jar
288
+ _element 'rule', 'pattern'=>'mirahparser.**', 'result'=>'mirah.@1'
289
+ _element 'rule', 'pattern'=>'org.mirahparser.**', 'result'=>'org.mirah.@1'
290
+ manifest do
291
+ attribute 'name'=>"Main-Class", 'value'=>"mirah.impl.MirahParser"
292
+ end
293
+ end
294
+ end
295
+
296
+ file "#{mirah_parser_build_dir}/mirahparser/impl/MirahParser.class" => [
297
+ prev_jar,
298
+ mirah_parser_gen_src,
299
+ parser_node_meta_class,
300
+ "#{mirah_parser_build_dir}/mirahparser/impl/MirahLexer.class",
301
+ #"#{mirah_parser_build_dir}/mirahparser/impl/Tokens.class",
302
+ ] do
303
+ compile_mirah_with_jar prev_jar,
304
+ mirah_parser_build_dir,
305
+ [mirah_parser_gen_src],
306
+ [mirah_parser_build_dir,
307
+ 'mirah-parser/javalib/mmeta-runtime.jar',
308
+ prev_jar],
309
+ clean=false
310
+ end
311
+
312
+ file parser_node_meta_class => parser_meta_src do
313
+ compile_mirah_with_jar prev_jar,
314
+ mirah_parser_build_dir,
315
+ [parser_meta_src],
316
+ [mirah_parser_build_dir, prev_jar],
317
+ clean=false
318
+ end
319
+ parser_ast_srcs = Dir['mirah-parser/src/mirah/lang/ast/*.mirah'].sort
320
+ file parser_node_class =>
321
+ [prev_jar, parser_node_meta_class] + parser_ast_srcs do
322
+ compile_mirah_with_jar prev_jar,
323
+ mirah_parser_build_dir,
324
+ parser_ast_srcs,
325
+ [mirah_parser_build_dir,
326
+ 'mirah-parser/javalib/mmeta-runtime.jar', prev_jar],
327
+ clean = false
328
+ end
329
+
330
+ parser_java_impl_src = Dir['mirah-parser/src/mirahparser/impl/*.java'].sort
331
+ parser_lexer_class = "#{mirah_parser_build_dir}/mirahparser/impl/MirahLexer.class"
332
+ file parser_lexer_class => parser_java_impl_src do
333
+ ant.javac 'srcDir' => 'mirah-parser/src',
334
+ 'destDir' => mirah_parser_build_dir,
335
+ 'source' => '1.6',
336
+ 'target' => '1.6',
337
+ 'debug' => true do
338
+ include 'name' => 'mirahparser/impl/Tokens.java'
339
+ include 'name' => 'mirahparser/impl/MirahLexer.java'
340
+ classpath 'path' => "#{mirah_parser_build_dir}:mirah-parser/javalib/mmeta-runtime.jar"
341
+ end
342
+ end
343
+
344
+ file mirah_parser_gen_src => 'mirah-parser/src/mirahparser/impl/Mirah.mmeta' do
345
+ ant.mkdir 'dir' => "#{mirah_parser_build_dir}-gen/mirahparser/impl"
346
+ runjava '-jar', 'mirah-parser/javalib/mmeta.jar',
347
+ '--tpl', 'node=mirah-parser/src/mirahparser/impl/node.xtm',
348
+ 'mirah-parser/src/mirahparser/impl/Mirah.mmeta',
349
+ mirah_parser_gen_src
350
+ end
351
+
250
352
  # Compile Java parts of the compiler.
251
353
  java_build_dir = "build/#{name}-java"
252
354
  java_jar = "#{java_build_dir}.jar"
@@ -276,8 +378,8 @@ def bootstrap_mirah_from(old_jar, new_jar)
276
378
  # org.mirah.MirahCommand depends on .tool., so remove from core
277
379
  ['src/org/mirah/mirah_command.mirah']
278
380
 
279
- file core_jar => core_mirah_srcs + [java_jar, old_jar, 'javalib/asm-5.jar', 'javalib/mirah-parser.jar'] do
280
- compile_mirah_with_jar old_jar, core_build_dir, core_mirah_srcs, [java_jar]
381
+ file core_jar => core_mirah_srcs + [java_jar, old_jar, 'javalib/asm-5.jar', dist_mirah_parser_jar] do
382
+ compile_mirah_with_jar old_jar, core_build_dir, core_mirah_srcs, [java_jar, dist_mirah_parser_jar, 'javalib/asm-5.jar']
281
383
  ant.jar 'jarfile' => core_jar do
282
384
  fileset 'dir' => core_build_dir
283
385
  end
@@ -288,8 +390,8 @@ def bootstrap_mirah_from(old_jar, new_jar)
288
390
  ['src/org/mirah/mirah_command.mirah'] # add it back in here.
289
391
  tool_build_dir = "build/#{name}-tool"
290
392
  tool_jar = "#{tool_build_dir}.jar"
291
- file tool_jar => tool_mirah_srcs + [core_jar, old_jar, 'javalib/asm-5.jar', 'javalib/mirah-parser.jar'] do
292
- compile_mirah_with_jar old_jar, tool_build_dir, tool_mirah_srcs, [core_jar, java_jar]
393
+ file tool_jar => tool_mirah_srcs + [core_jar, old_jar, 'javalib/asm-5.jar', dist_mirah_parser_jar] do
394
+ compile_mirah_with_jar old_jar, tool_build_dir, tool_mirah_srcs, [core_jar, java_jar, 'javalib/asm-5.jar', dist_mirah_parser_jar]
293
395
  ant.jar 'jarfile' => tool_jar do
294
396
  fileset 'dir' => tool_build_dir
295
397
  end
@@ -299,9 +401,9 @@ def bootstrap_mirah_from(old_jar, new_jar)
299
401
  ant_mirah_srcs = Dir['src/org/mirah/ant/*.mirah'].sort
300
402
  ant_build_dir = "build/#{name}-ant"
301
403
  ant_jar = "#{ant_build_dir}.jar"
302
- file ant_jar => ant_mirah_srcs + [core_jar, tool_jar, java_jar, old_jar, 'javalib/asm-5.jar', 'javalib/mirah-parser.jar'] do
404
+ file ant_jar => ant_mirah_srcs + [core_jar, tool_jar, java_jar, old_jar, 'javalib/asm-5.jar', dist_mirah_parser_jar] do
303
405
  ant_classpath = $CLASSPATH.grep(/ant/).map{|x| x.sub(/^file:/,'')}
304
- compile_mirah_with_jar old_jar, ant_build_dir, ant_mirah_srcs, [core_jar, tool_jar, java_jar] + ant_classpath
406
+ compile_mirah_with_jar old_jar, ant_build_dir, ant_mirah_srcs, [core_jar, tool_jar, java_jar, 'javalib/asm-5.jar', dist_mirah_parser_jar] + ant_classpath
305
407
  ant.jar 'jarfile' => ant_jar do
306
408
  fileset 'dir' => ant_build_dir
307
409
  end
@@ -313,10 +415,10 @@ def bootstrap_mirah_from(old_jar, new_jar)
313
415
  extensions_mirah_srcs = Dir['src/org/mirah/builtins/*.mirah'].sort
314
416
  extensions_build_dir = "build/#{name}-extensions"
315
417
  extensions_jar = "#{extensions_build_dir}.jar"
316
- file extensions_jar => extensions_mirah_srcs + [core_jar, tool_jar, java_jar, 'javalib/asm-5.jar', 'javalib/mirah-parser.jar'] do
418
+ file extensions_jar => extensions_mirah_srcs + [core_jar, tool_jar, java_jar, 'javalib/asm-5.jar', dist_mirah_parser_jar] do
317
419
 
318
420
  classpath = [core_jar, tool_jar, java_jar,
319
- "javalib/mirah-parser.jar",
421
+ dist_mirah_parser_jar,
320
422
  "javalib/asm-5.jar"].join(File::PATH_SEPARATOR)
321
423
 
322
424
  runjava('-Xmx512m',
@@ -336,12 +438,12 @@ def bootstrap_mirah_from(old_jar, new_jar)
336
438
  end
337
439
  jars = [java_jar, core_jar, tool_jar, ant_jar, extensions_jar]
338
440
  file new_jar => jars +
339
- [old_jar, 'javalib/asm-5.jar', 'javalib/mirah-parser.jar'] do
441
+ [old_jar, 'javalib/asm-5.jar', dist_mirah_parser_jar] do
340
442
  # TODO use ant.jarjarto shade asm-5 in the fat jar
341
443
  ant.jar 'jarfile' => new_jar do
342
444
  jars.each {|j| zipfileset 'src' => j }
343
445
  zipfileset 'src' => 'javalib/asm-5.jar', 'includes' => 'org/objectweb/**/*'
344
- zipfileset 'src' => 'javalib/mirah-parser.jar'
446
+ zipfileset 'src' => dist_mirah_parser_jar
345
447
  metainf 'dir' => File.dirname(__FILE__), 'includes' => 'LICENSE,COPYING,NOTICE'
346
448
  metainf 'dir' => File.dirname(__FILE__)+'/src/org/mirah/builtins',
347
449
  'includes' => 'services/*'
@@ -355,156 +457,37 @@ end
355
457
 
356
458
  # compiles to the build dir
357
459
  def compile_mirah_with_jar old_jar, build_dir, mirah_srcs, classpath=[], clean=true
358
- if clean
359
- puts "cleaning #{build_dir} before compile"
360
- rm_rf build_dir
361
- mkdir_p build_dir
362
- else
363
- puts "skipping cleaning #{build_dir}"
364
- end
365
-
366
- default_class_path = ["javalib/mirah-parser.jar", build_dir, "javalib/asm-5.jar", *classpath].join(File::PATH_SEPARATOR)
460
+ if clean
461
+ puts "cleaning #{build_dir} before compile"
462
+ rm_rf build_dir
463
+ mkdir_p build_dir
464
+ else
465
+ puts "skipping cleaning #{build_dir}"
466
+ end
367
467
 
368
- # Compile Mirah sources
369
- runjava('-Xmx512m',
370
- '-jar',
371
- old_jar,
372
- '-d', build_dir,
373
- '-classpath', default_class_path,
374
- '--jvm', build_version,
375
- *mirah_srcs)
468
+ default_class_path = classpath.join(File::PATH_SEPARATOR)
469
+
470
+ # Compile Mirah sources
471
+ runjava('-Xmx512m',
472
+ '-jar',
473
+ old_jar,
474
+ '-d', build_dir,
475
+ '-classpath', default_class_path,
476
+ '--jvm', build_version,
477
+ #'-V',
478
+ *mirah_srcs)
376
479
  end
377
480
 
378
481
  bootstrap_mirah_from('javalib/mirahc-prev.jar', 'dist/mirahc.jar')
379
482
  bootstrap_mirah_from('dist/mirahc.jar', 'dist/mirahc2.jar')
380
483
  bootstrap_mirah_from('dist/mirahc2.jar', 'dist/mirahc3.jar')
381
484
 
382
- # Parser tasks!
383
-
384
- # TODO maybe add these back at some point?
485
+ # TODO maybe add this back at some point?
486
+ # I think we need javadoc support for Mirah first.
385
487
  #task :doc => 'build/mirahparser/lang/ast/Node.java' do
386
488
  # ant.javadoc :sourcepath => 'build', :destdir => 'doc'
387
489
  #end
388
490
 
389
- mirah_parser_gen_src = 'build/mirah-parser-gen/mirahparser/impl/Mirah.mirah'
390
- mirah_parser_build_dir = "build/mirah-parser"
391
- parser_node_meta_class = "#{mirah_parser_build_dir}/org/mirahparser/ast/NodeMeta.class"
392
- parser_node_java_gen_src = "#{mirah_parser_build_dir}-gen/mirahparser/lang/ast/Node.java"
393
- parser_node_class = "#{mirah_parser_build_dir}/mirahparser/lang/ast/Node.class"
394
- parser_meta_src = 'mirah-parser/src/org/mirah/ast/meta.mirah'
395
- prev_jar = 'javalib/mirahc-prev.jar'
396
- directory "#{mirah_parser_build_dir}/mirah-parser/mirahparser/impl"
397
-
398
-
399
- file 'build/mirah-parser.jar' => ["#{mirah_parser_build_dir}/mirahparser/lang/ast/Node.class",
400
- "#{mirah_parser_build_dir}/mirahparser/impl/MirahParser.class",
401
- "#{mirah_parser_build_dir}/mirahparser/impl/MirahLexer.class"] do
402
- ant.jarjar 'jarfile' => 'build/mirah-parser.jar' do
403
- fileset 'dir' => mirah_parser_build_dir, 'includes' => 'mirahparser/impl/*.class'
404
- fileset 'dir' => mirah_parser_build_dir, 'includes' => 'mirahparser/lang/ast/*.class'
405
- fileset 'dir' => mirah_parser_build_dir, 'includes' => 'org/mirahparser/ast/*.class'
406
- zipfileset 'src' => 'mirah-parser/javalib/mmeta-runtime.jar'
407
- _element 'rule', 'pattern'=>'mmeta.**', 'result'=>'org.mirahparser.mmeta.@1'
408
- manifest do
409
- attribute 'name'=>"Main-Class", 'value'=>"mirahparser.impl.MirahParser"
410
- end
411
- end
412
- end
413
-
414
- file 'dist/mirah-parser.jar' => 'build/mirah-parser.jar' do
415
- # Mirahc picks up the built in classes instead of our versions.
416
- # So we compile in a different package and then jarjar them to the correct
417
- # one.
418
- ant.jarjar 'jarfile' => 'dist/mirah-parser.jar' do
419
- zipfileset 'src' => 'build/mirah-parser.jar'
420
- _element 'rule', 'pattern'=>'mirahparser.**', 'result'=>'mirah.@1'
421
- _element 'rule', 'pattern'=>'org.mirahparser.**', 'result'=>'org.mirah.@1'
422
- manifest do
423
- attribute 'name'=>"Main-Class", 'value'=>"mirah.impl.MirahParser"
424
- end
425
- end
426
- end
427
-
428
- file 'javalib/mirah-parser.jar' => 'dist/mirah-parser.jar' do
429
- cp 'dist/mirah-parser.jar', 'javalib/mirah-parser.jar'
430
- end
431
-
432
- file "#{mirah_parser_build_dir}/mirahparser/impl/MirahParser.class" => [
433
- prev_jar,
434
- mirah_parser_gen_src,
435
- parser_node_meta_class,
436
- "#{mirah_parser_build_dir}/mirahparser/impl/MirahLexer.class",
437
- #"#{mirah_parser_build_dir}/mirahparser/impl/Tokens.class",
438
- ] do
439
- compile_mirah_with_jar prev_jar,
440
- mirah_parser_build_dir,
441
- [mirah_parser_gen_src],
442
- [mirah_parser_build_dir,
443
- 'mirah-parser/javalib/mmeta-runtime.jar',
444
- prev_jar],
445
- clean=false
446
- end
447
-
448
- file parser_node_meta_class => parser_meta_src do
449
- compile_mirah_with_jar prev_jar,
450
- mirah_parser_build_dir,
451
- [parser_meta_src],
452
- [mirah_parser_build_dir, prev_jar],
453
- clean=false
454
- #mirahc(parser_meta_src,
455
- # :dest => mirah_parser_build_dir
456
- # #:options => ['-V']
457
- # )
458
- end
459
- parser_ast_srcs = Dir['mirah-parser/src/mirah/lang/ast/*.mirah'].sort
460
- file parser_node_class =>
461
- [prev_jar, parser_node_meta_class] + parser_ast_srcs do
462
- compile_mirah_with_jar prev_jar,
463
- mirah_parser_build_dir,
464
- parser_ast_srcs,
465
- [mirah_parser_build_dir,
466
- 'mirah-parser/javalib/mmeta-runtime.jar', prev_jar],
467
- clean = false
468
- end
469
-
470
- file parser_node_java_gen_src =>
471
- [parser_node_meta_class] + parser_ast_srcs do
472
- #TODO. --java is nolonger supported.
473
- # compile_mirah_with_jar prev_jar,
474
- # mirah_parser_build_dir,
475
- # parser_ast_srcs,
476
- # [mirah_parser_build_dir,
477
- # 'mirah-parser/javalib/mmeta-runtime.jar']
478
-
479
- mirahc('.',
480
- :dir => 'mirah-parser/src/mirah/lang/ast',
481
- :dest => 'build',
482
- :classpath => ['build'],
483
- :options => ['--java'])
484
- end
485
-
486
- parser_java_impl_src = Dir['mirah-parser/src/mirahparser/impl/*.java'].sort
487
- parser_lexer_class = "#{mirah_parser_build_dir}/mirahparser/impl/MirahLexer.class"
488
- file parser_lexer_class => parser_java_impl_src do
489
- ant.javac 'srcDir' => 'mirah-parser/src',
490
- 'destDir' => mirah_parser_build_dir,
491
- 'source' => '1.6',
492
- 'target' => '1.6',
493
- 'debug' => true do
494
- include 'name' => 'mirahparser/impl/Tokens.java'
495
- include 'name' => 'mirahparser/impl/MirahLexer.java'
496
- classpath 'path' => "#{mirah_parser_build_dir}:mirah-parser/javalib/mmeta-runtime.jar"
497
- end
498
- end
499
-
500
- file mirah_parser_gen_src => 'mirah-parser/src/mirahparser/impl/Mirah.mmeta' do
501
- ant.mkdir 'dir' => "#{mirah_parser_build_dir}-gen/mirahparser/impl"
502
- runjava '-jar', 'mirah-parser/javalib/mmeta.jar',
503
- '--tpl', 'node=mirah-parser/src/mirahparser/impl/node.xtm',
504
- 'mirah-parser/src/mirahparser/impl/Mirah.mmeta',
505
- mirah_parser_gen_src
506
- end
507
-
508
491
 
509
492
  def build_version
510
493
  # mirahc needs to be 1.7 or lower
@@ -517,8 +500,8 @@ def build_version
517
500
  end
518
501
 
519
502
  def runjava(*args)
520
- sh 'java',*args
503
+ sh 'java', *args
521
504
  unless $?.success?
522
- exit $?.exitstatus
505
+ raise "command: java #{args.join " "}\n failed with status #{ $?.exitstatus}"
523
506
  end
524
507
  end
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env jruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'bundler' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('bundler', 'bundler')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env jruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rake', 'rake')
Binary file
@@ -14,5 +14,5 @@
14
14
  # limitations under the License.
15
15
 
16
16
  module Mirah
17
- VERSION = "0.2.0"
17
+ VERSION = "0.2.1"
18
18
  end
@@ -20,4 +20,9 @@ class JarTest < Test::Unit::TestCase
20
20
  out = `java -jar dist/mirahc.jar run -e 'puts 1'`
21
21
  assert_equal "1\n", out
22
22
  end
23
+
24
+ def test_run_doesnt_exit_early
25
+ out = `java -jar dist/mirahc.jar run -e 'Thread.new {Thread.sleep(1); puts 1}.start'`
26
+ assert_equal "1\n", out
27
+ end
23
28
  end
@@ -20,7 +20,6 @@ class TypeFutureTest < Test::Unit::TestCase
20
20
  java_import 'org.mirah.typer.TypeFuture'
21
21
  java_import 'org.mirah.typer.AssignableTypeFuture'
22
22
  java_import 'org.mirah.typer.SimpleFuture'
23
- java_import 'org.mirah.typer.simple.SimpleScoper'
24
23
  java_import 'org.mirah.typer.simple.SimpleTypes'
25
24
  java_import 'org.mirah.typer.simple.SimpleType'
26
25
  java_import 'org.mirah.typer.ErrorType'
@@ -20,7 +20,6 @@ class ErrorTypeTest < Test::Unit::TestCase
20
20
  java_import 'org.mirah.typer.TypeFuture'
21
21
  java_import 'org.mirah.typer.AssignableTypeFuture'
22
22
  java_import 'org.mirah.typer.SimpleFuture'
23
- java_import 'org.mirah.typer.simple.SimpleScoper'
24
23
  java_import 'org.mirah.typer.simple.SimpleTypes'
25
24
  java_import 'org.mirah.typer.simple.SimpleType'
26
25
  java_import 'org.mirah.typer.ErrorType'
@@ -238,5 +238,94 @@ class ClosureTest < Test::Unit::TestCase
238
238
  })
239
239
  assert_run_output("3\n", cls)
240
240
  end
241
+
242
+ def test_closing_over_static_method
243
+ cls, = compile(%q{
244
+ def foo
245
+ puts 'yay foo'
246
+ end
247
+ lambda(Runnable) { foo }.run
248
+ })
249
+ assert_run_output("yay foo\n", cls)
250
+ end
251
+
252
+ def test_closing_over_instance_method
253
+ cls, = compile(%q{
254
+ class InstanceMethodCarrier
255
+ def foo
256
+ puts 'yay foo'
257
+ end
258
+ def bar
259
+ lambda(Runnable) { foo }.run
260
+ end
261
+ end
262
+ InstanceMethodCarrier.new.bar
263
+ })
264
+ assert_run_output("yay foo\n", cls)
265
+ end
266
+
267
+ def test_closing_over_field
268
+ cls, = compile(%q{
269
+ class Bar
270
+ def bar: void
271
+ @foo = 'yay foo'
272
+ lambda(Runnable) { puts @foo }.run
273
+ end
274
+ end
275
+ Bar.new.bar
276
+ })
277
+ assert_run_output("yay foo\n", cls)
278
+ end
279
+
280
+ def test_closing_over_self
281
+ cls, = compile(%q{
282
+ class SelfConscious
283
+ def bar
284
+ lambda(Runnable) { puts self }.run
285
+ end
286
+ def toString
287
+ "SelfConscious"
288
+ end
289
+ end
290
+ SelfConscious.new.bar
291
+ })
292
+
293
+ assert_run_output("SelfConscious\n", cls)
294
+ end
295
+
296
+ def test_closing_over_self_call
297
+ cls, = compile(%q{
298
+ class SelfConscious
299
+ def bar
300
+ lambda(Runnable) { puts self.toString }.run
301
+ end
302
+ def toString
303
+ "SelfConscious"
304
+ end
305
+ end
306
+ SelfConscious.new.bar
307
+ })
308
+
309
+ assert_run_output("SelfConscious\n", cls)
310
+ end
311
+
312
+ def test_close_over_super_types_method
313
+ cls, = compile(%q{
314
+ class SClass
315
+ def foo
316
+ puts 'yay foo'
317
+ end
318
+ end
319
+ class SubClass < SClass
320
+ def bar
321
+ lambda(Runnable) { foo }.run
322
+ end
323
+ end
324
+ SubClass.new.bar
325
+ })
326
+ assert_run_output("yay foo\n", cls)
327
+ end
328
+ # closure type method called
329
+ # closed over method shadows closure type method
241
330
  end
242
331
 
@@ -19,12 +19,29 @@ class ListExtensionsTest < Test::Unit::TestCase
19
19
  cls, = compile(<<-EOF)
20
20
  import java.util.ArrayList
21
21
  x = ArrayList.new
22
+ x.add "1"
22
23
  x[0]= "2"
24
+ x[0]= "3"
23
25
  puts x
24
26
  EOF
25
- assert_run_output("[2]\n", cls)
27
+ assert_run_output("[3]\n", cls)
26
28
  end
27
-
29
+
30
+ def test_bracket_out_of_range_exception_at_assign
31
+ java_import 'java.lang.IndexOutOfBoundsException'
32
+ cls, = compile(<<-EOF)
33
+ import java.util.ArrayList
34
+ x = ArrayList.new
35
+ x[0]= "2"
36
+ puts x
37
+ EOF
38
+ begin
39
+ assert_run_output("xxxx", cls)
40
+ fail "should rise IndexOutOfBoundsException"
41
+ rescue IndexOutOfBoundsException => ex
42
+ end
43
+ end
44
+
28
45
  def test_sort_with_block
29
46
  cls, = compile(<<-EOF)
30
47
  puts ([3,1,2].sort do |o0:Comparable,o1:Comparable|
@@ -1806,6 +1806,17 @@ class JVMCompilerTest < Test::Unit::TestCase
1806
1806
  assert_equal(entry, cls.foo(entry))
1807
1807
  end
1808
1808
 
1809
+ def test_colon2_constant_ref
1810
+ cls, = compile(<<-EOF)
1811
+ def foo
1812
+ Character::UnicodeBlock::ARROWS
1813
+ end
1814
+ EOF
1815
+
1816
+ subset = cls.foo
1817
+ assert_equal("java.lang.Character$UnicodeBlock", subset.java_class.name)
1818
+ end
1819
+
1809
1820
  def test_covariant_arrays
1810
1821
  cls, = compile(<<-EOF)
1811
1822
  puts java::util::Arrays.toString(String[5])
@@ -2042,17 +2053,15 @@ class JVMCompilerTest < Test::Unit::TestCase
2042
2053
  end
2043
2054
 
2044
2055
  def test_double_equals_with_arrays
2045
- pend "arrays are tricky" do
2046
- cls, = compile(<<-EOF)
2047
- a = Object[1]
2048
- b = Object[1]
2049
- puts a == a
2050
- puts a == b
2051
- puts a != b
2052
- puts a != a
2053
- EOF
2054
- assert_run_output("true\true\nfalse\nfalse\n", cls)
2055
- end
2056
+ cls, = compile(<<-EOF)
2057
+ a = Object[1]
2058
+ b = Object[1]
2059
+ puts a == a
2060
+ puts a == b
2061
+ puts a != b
2062
+ puts a != a
2063
+ EOF
2064
+ assert_run_output("true\ntrue\nfalse\nfalse\n", cls)
2056
2065
  end
2057
2066
 
2058
2067
  def test_field_setter_with_nil
@@ -56,7 +56,6 @@ module JVMCompiler
56
56
 
57
57
  args = ["-d", TEST_DEST,
58
58
  "--vmodule", "org.mirah.jvm.compiler.ClassCompiler=OFF",
59
- # "--verbose",
60
59
  "--classpath", Mirah::Env.encode_paths([FIXTURE_TEST_DEST, TEST_DEST]) ]
61
60
 
62
61
  java_version = options.fetch :java_version, JVMCompiler::JVM_VERSION
@@ -25,15 +25,12 @@ class StaticFieldsTest < Test::Unit::TestCase
25
25
  end
26
26
 
27
27
  def test_static_field_inheritance_lookup_with_double_colon
28
- return
29
- pend("double colon is treated special for lookup") {
30
28
  cls, = compile(<<-EOF)
31
29
  import java.util.GregorianCalendar
32
30
  puts GregorianCalendar::AM
33
31
  EOF
34
32
 
35
33
  assert_run_output("0\n", cls)
36
- }
37
34
  end
38
35
 
39
36
  def test_create_constant
@@ -43,6 +40,19 @@ class StaticFieldsTest < Test::Unit::TestCase
43
40
  EOF
44
41
  assert_run_output("1\n", cls)
45
42
  end
43
+
44
+ def test_constant_public
45
+ pend "other classes constants are not immediately referenceable" do
46
+ cls, = compile(<<-EOF)
47
+ class Bar
48
+ CONSTANT = 1
49
+ end
50
+
51
+ puts Bar::CONSTANT
52
+ EOF
53
+ assert_run_output("1\n", cls)
54
+ end
55
+ end
46
56
 
47
57
  def test_static_final_constant
48
58
  cls, = compile(<<-EOF)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mirah
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: java
6
6
  authors:
7
7
  - Charles Oliver Nutter
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-08-06 00:00:00.000000000 Z
13
+ date: 2016-09-25 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: |-
16
16
  Mirah is a customizable programming language featuring static types,
@@ -29,41 +29,110 @@ extra_rdoc_files:
29
29
  - History.txt
30
30
  - README.md
31
31
  files:
32
+ - CHANGELOG.md
33
+ - CODE_OF_CONDUCT.md
34
+ - History.txt
35
+ - README.md
36
+ - Rakefile
37
+ - TODO.md
38
+ - bin/bundler
32
39
  - bin/mirah
33
40
  - bin/mirah.cmd
34
41
  - bin/mirahc
35
42
  - bin/mirahc.cmd
43
+ - bin/rake
44
+ - dist/mirahc.jar
45
+ - examples/ant/README.md
46
+ - examples/ant/build/Fib.class
47
+ - examples/ant/example-build.xml
48
+ - examples/appengine/Rakefile
49
+ - examples/appengine/Readme
50
+ - examples/appengine/src/org/mirah/MirahApp.mirah
51
+ - examples/appengine/src/org/mirah/list.dhtml
52
+ - examples/appengine/war/WEB-INF/lib/dubydatastore.jar
53
+ - examples/bintrees.mirah
54
+ - examples/construction.mirah
55
+ - examples/fib.mirah
56
+ - examples/fields.mirah
57
+ - examples/fractal.mirah
58
+ - examples/fractal.rb
59
+ - examples/interfaces.mirah
60
+ - examples/java_thing.mirah
61
+ - examples/literals.mirah
62
+ - examples/macros/square.mirah
63
+ - examples/macros/square_int.mirah
64
+ - examples/macros/string_each_char.mirah
65
+ - examples/maven/README.txt
66
+ - examples/maven/pom.xml
67
+ - examples/maven/src/main/mirah/hello_mirah.mirah
68
+ - examples/plugins/appengine/Rakefile
69
+ - examples/plugins/appengine/src/com/google/appengine/ext/duby/db/MetaModel.mirah
70
+ - examples/plugins/appengine/src/com/google/appengine/ext/duby/db/Model.duby
71
+ - examples/plugins/appengine/test/com/google/appengine/ext/duby/db/ModelTest.duby
72
+ - examples/rosettacode/100-doors.mirah
73
+ - examples/rosettacode/99-bottles-of-beer.mirah
74
+ - examples/rosettacode/README.txt
75
+ - examples/rosettacode/arrays.mirah
76
+ - examples/rosettacode/boolean-values.mirah
77
+ - examples/rosettacode/comments.mirah
78
+ - examples/rosettacode/copy-a-string.mirah
79
+ - examples/rosettacode/count-occurrences-of-a-substring.mirah
80
+ - examples/rosettacode/create-a-file.mirah
81
+ - examples/rosettacode/empty-string.mirah
82
+ - examples/rosettacode/factorial.mirah
83
+ - examples/rosettacode/fibonacci.mirah
84
+ - examples/rosettacode/file-size.mirah
85
+ - examples/rosettacode/fizz-buzz.mirah
86
+ - examples/rosettacode/flatten-a-list.mirah
87
+ - examples/rosettacode/guess-the-number.mirah
88
+ - examples/rosettacode/hamming-numbers.mirah
89
+ - examples/rosettacode/host-introspection.mirah
90
+ - examples/rosettacode/hostname.mirah
91
+ - examples/rosettacode/is-string-numeric.mirah
92
+ - examples/rosettacode/palindrome.mirah
93
+ - examples/rosettacode/random-numbers.mirah
94
+ - examples/rosettacode/repeat-a-string.mirah
95
+ - examples/rosettacode/reverse-a-string.mirah
96
+ - examples/rosettacode/rot-13.mirah
97
+ - examples/rosettacode/secure-temporary-file.mirah
98
+ - examples/rosettacode/simple_character_math.mirah
99
+ - examples/rosettacode/sleep.mirah
100
+ - examples/rosettacode/sort-integer-array.mirah
101
+ - examples/rosettacode/string-case.mirah
102
+ - examples/rosettacode/string-length.mirah
103
+ - examples/rosettacode/user-input.mirah
104
+ - examples/simple_class.mirah
105
+ - examples/sort_closure.mirah
106
+ - examples/swing.mirah
107
+ - examples/tak.mirah
108
+ - extensions_and_macros.md
36
109
  - lib/duby.rb
37
110
  - lib/mirah.rb
38
- - lib/mirah_task.rb
39
111
  - lib/mirah/appengine_tasks.rb
40
112
  - lib/mirah/env.rb
41
113
  - lib/mirah/errors.rb
42
- - lib/mirah/transform.rb
43
- - lib/mirah/typer.rb
44
- - lib/mirah/version.rb
45
114
  - lib/mirah/plugin/edb.rb
115
+ - lib/mirah/transform.rb
46
116
  - lib/mirah/transform/ast_ext.rb
47
117
  - lib/mirah/transform/transformer.rb
118
+ - lib/mirah/typer.rb
48
119
  - lib/mirah/util/logging.rb
49
120
  - lib/mirah/util/process_errors.rb
121
+ - lib/mirah/version.rb
122
+ - lib/mirah_task.rb
50
123
  - test/A.class
51
- - test/newMirahClass$Closure2.class
52
- - test/newMirahClass.class
53
- - test/test_helper.rb
54
124
  - test/artifacts/jar_test.rb
55
125
  - test/artifacts/jruby_test.rb
56
126
  - test/core/env_test.rb
57
- - test/core/typer_test.rb
58
127
  - test/core/typer/assignable_type_future_test.rb
59
128
  - test/core/typer/error_type_test.rb
60
129
  - test/core/typer/simple_type_test.rb
130
+ - test/core/typer_test.rb
61
131
  - test/core/util/class_loader_test.rb
62
132
  - test/core/util/jvm_version_test.rb
63
133
  - test/core/util/mirah_arguments_test.rb
64
134
  - test/fixtures/cp1251_test.mirah
65
135
  - test/fixtures/my.properties
66
- - test/fixtures/utf8_test.mirah
67
136
  - test/fixtures/org/foo/A.class
68
137
  - test/fixtures/org/foo/AbstractExecutorJava8.java
69
138
  - test/fixtures/org/foo/ClassWithSelfReferencingTypeParameter.java
@@ -73,6 +142,7 @@ files:
73
142
  - test/fixtures/org/foo/IntAnno.java
74
143
  - test/fixtures/org/foo/LowerCaseInnerClass.java
75
144
  - test/fixtures/org/foo/TypeFixtureJava8.java
145
+ - test/fixtures/utf8_test.mirah
76
146
  - test/jvm/access_levels_test.rb
77
147
  - test/jvm/annotations_test.rb
78
148
  - test/jvm/blocks_test.rb
@@ -80,6 +150,17 @@ files:
80
150
  - test/jvm/closure_test.rb
81
151
  - test/jvm/constructors_test.rb
82
152
  - test/jvm/example_test.rb
153
+ - test/jvm/extensions/array_extensions_test.rb
154
+ - test/jvm/extensions/collection_extensions_test.rb
155
+ - test/jvm/extensions/enumerable_test.rb
156
+ - test/jvm/extensions/hash_extensions_test.rb
157
+ - test/jvm/extensions/list_extensions_test.rb
158
+ - test/jvm/extensions/lock_extensions_test.rb
159
+ - test/jvm/extensions/numeric_extensions_test.rb
160
+ - test/jvm/extensions/numeric_operators_test.rb
161
+ - test/jvm/extensions/object_extensions_test.rb
162
+ - test/jvm/extensions/string_builder_extensions_test.rb
163
+ - test/jvm/extensions/string_extensions_test.rb
83
164
  - test/jvm/generics_test.rb
84
165
  - test/jvm/hash_test.rb
85
166
  - test/jvm/import_test.rb
@@ -93,17 +174,6 @@ files:
93
174
  - test/jvm/static_fields_test.rb
94
175
  - test/jvm/string_test.rb
95
176
  - test/jvm/varargs_test.rb
96
- - test/jvm/extensions/array_extensions_test.rb
97
- - test/jvm/extensions/collection_extensions_test.rb
98
- - test/jvm/extensions/enumerable_test.rb
99
- - test/jvm/extensions/hash_extensions_test.rb
100
- - test/jvm/extensions/list_extensions_test.rb
101
- - test/jvm/extensions/lock_extensions_test.rb
102
- - test/jvm/extensions/numeric_extensions_test.rb
103
- - test/jvm/extensions/numeric_operators_test.rb
104
- - test/jvm/extensions/object_extensions_test.rb
105
- - test/jvm/extensions/string_builder_extensions_test.rb
106
- - test/jvm/extensions/string_extensions_test.rb
107
177
  - test/mirrors/base_type_test.rb
108
178
  - test/mirrors/bytecode_mirror_test.rb
109
179
  - test/mirrors/generics_test.rb
@@ -112,100 +182,32 @@ files:
112
182
  - test/mirrors/mirrors_test.rb
113
183
  - test/mirrors/simple_async_mirror_loader_test.rb
114
184
  - test/mirrors/simple_mirror_loader_test.rb
115
- - examples/bintrees.mirah
116
- - examples/construction.mirah
117
- - examples/fib.mirah
118
- - examples/fields.mirah
119
- - examples/fractal.mirah
120
- - examples/fractal.rb
121
- - examples/interfaces.mirah
122
- - examples/java_thing.mirah
123
- - examples/literals.mirah
124
- - examples/simple_class.mirah
125
- - examples/sort_closure.mirah
126
- - examples/swing.mirah
127
- - examples/tak.mirah
128
- - examples/ant/example-build.xml
129
- - examples/ant/README.md
130
- - examples/ant/build/Fib.class
131
- - examples/appengine/Rakefile
132
- - examples/appengine/Readme
133
- - examples/appengine/src/org/mirah/list.dhtml
134
- - examples/appengine/src/org/mirah/MirahApp.mirah
135
- - examples/appengine/war/WEB-INF/lib/dubydatastore.jar
136
- - examples/macros/square.mirah
137
- - examples/macros/square_int.mirah
138
- - examples/macros/string_each_char.mirah
139
- - examples/maven/pom.xml
140
- - examples/maven/README.txt
141
- - examples/maven/src/main/mirah/hello_mirah.mirah
142
- - examples/plugins/appengine/Rakefile
143
- - examples/plugins/appengine/src/com/google/appengine/ext/duby/db/MetaModel.mirah
144
- - examples/plugins/appengine/src/com/google/appengine/ext/duby/db/Model.duby
145
- - examples/plugins/appengine/test/com/google/appengine/ext/duby/db/ModelTest.duby
146
- - examples/rosettacode/100-doors.mirah
147
- - examples/rosettacode/99-bottles-of-beer.mirah
148
- - examples/rosettacode/arrays.mirah
149
- - examples/rosettacode/boolean-values.mirah
150
- - examples/rosettacode/comments.mirah
151
- - examples/rosettacode/copy-a-string.mirah
152
- - examples/rosettacode/count-occurrences-of-a-substring.mirah
153
- - examples/rosettacode/create-a-file.mirah
154
- - examples/rosettacode/empty-string.mirah
155
- - examples/rosettacode/factorial.mirah
156
- - examples/rosettacode/fibonacci.mirah
157
- - examples/rosettacode/file-size.mirah
158
- - examples/rosettacode/fizz-buzz.mirah
159
- - examples/rosettacode/flatten-a-list.mirah
160
- - examples/rosettacode/guess-the-number.mirah
161
- - examples/rosettacode/hamming-numbers.mirah
162
- - examples/rosettacode/host-introspection.mirah
163
- - examples/rosettacode/hostname.mirah
164
- - examples/rosettacode/is-string-numeric.mirah
165
- - examples/rosettacode/palindrome.mirah
166
- - examples/rosettacode/random-numbers.mirah
167
- - examples/rosettacode/README.txt
168
- - examples/rosettacode/repeat-a-string.mirah
169
- - examples/rosettacode/reverse-a-string.mirah
170
- - examples/rosettacode/rot-13.mirah
171
- - examples/rosettacode/secure-temporary-file.mirah
172
- - examples/rosettacode/simple_character_math.mirah
173
- - examples/rosettacode/sleep.mirah
174
- - examples/rosettacode/sort-integer-array.mirah
175
- - examples/rosettacode/string-case.mirah
176
- - examples/rosettacode/string-length.mirah
177
- - examples/rosettacode/user-input.mirah
178
- - dist/mirahc.jar
179
- - CHANGELOG.md
180
- - CODE_OF_CONDUCT.md
181
- - extensions_and_macros.md
182
- - README.md
183
- - TODO.md
184
- - History.txt
185
- - Rakefile
185
+ - test/newMirahClass$Closure2.class
186
+ - test/newMirahClass.class
187
+ - test/test_helper.rb
186
188
  homepage: http://www.mirah.org/
187
189
  licenses:
188
190
  - Apache-2.0
189
191
  metadata: {}
190
192
  post_install_message:
191
193
  rdoc_options:
192
- - --main
194
+ - "--main"
193
195
  - README.md
194
196
  require_paths:
195
197
  - lib
196
198
  required_ruby_version: !ruby/object:Gem::Requirement
197
199
  requirements:
198
- - - '>='
200
+ - - ">="
199
201
  - !ruby/object:Gem::Version
200
202
  version: '0'
201
203
  required_rubygems_version: !ruby/object:Gem::Requirement
202
204
  requirements:
203
- - - '>='
205
+ - - ">="
204
206
  - !ruby/object:Gem::Version
205
207
  version: '0'
206
208
  requirements: []
207
209
  rubyforge_project: mirah
208
- rubygems_version: 2.1.9
210
+ rubygems_version: 2.4.8
209
211
  signing_key:
210
212
  specification_version: 4
211
213
  summary: Mirah is a customizable programming language featuring static types, local type inference and a heavily Ruby-inspired syntax