mirah 0.0.10-java → 0.0.11-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +44 -0
- data/README.txt +12 -7
- data/Rakefile +13 -12
- data/examples/SortClosure$__xform_tmp_1.class +0 -0
- data/examples/SortClosure$__xform_tmp_2.class +0 -0
- data/examples/SortClosure.class +0 -0
- data/examples/macros/StringEachChar$Extension1.class +0 -0
- data/javalib/mirah-bootstrap.jar +0 -0
- data/lib/mirah/appengine_tasks.rb +8 -6
- data/lib/mirah/ast/flow.rb +3 -3
- data/lib/mirah/ast/structure.rb +23 -2
- data/lib/mirah/commands/base.rb +5 -2
- data/lib/mirah/commands/base.rb~ +57 -0
- data/lib/mirah/commands/run.rb +15 -8
- data/lib/mirah/jvm/compiler/java_source.rb +15 -11
- data/lib/mirah/jvm/method_lookup.rb~ +247 -0
- data/lib/mirah/jvm/types/bitescript_ext.rb +41 -0
- data/lib/mirah/jvm/types/boolean.rb +33 -0
- data/lib/mirah/jvm/types/factory.rb +43 -3
- data/lib/mirah/jvm/types/integers.rb +1 -14
- data/lib/mirah/jvm/types/intrinsics.rb +1 -14
- data/lib/mirah/jvm/types/source_mirror.rb +6 -3
- data/lib/mirah/parser.rb +2 -6
- data/lib/mirah/transform/transformer.rb +2 -0
- data/lib/mirah/util/argument_processor.rb +33 -12
- data/lib/mirah/util/class_loader.rb +7 -2
- data/lib/mirah/util/compilation_state.rb +8 -0
- data/lib/mirah/version.rb +1 -1
- data/lib/mirah/version.rb~ +18 -0
- data/test/core/{test_ast.rb → ast_test.rb} +5 -1
- data/test/core/{test_commands.rb → commands_test.rb} +29 -2
- data/test/core/{test_compilation.rb → compilation_test.rb} +2 -2
- data/test/core/{test_env.rb → env_test.rb} +2 -2
- data/test/core/{test_macros.rb → macros_test.rb} +2 -2
- data/test/core/{test_typer.rb → typer_test.rb} +1 -1
- data/test/core/util/argument_processor_test.rb +64 -0
- data/test/core/util/class_loader_test.rb +31 -0
- data/test/fixtures/my.properties +0 -0
- data/test/fixtures/org/foo/A.class +0 -0
- data/test/jvm/{test_annotations.rb → annotations_test.rb} +2 -2
- data/test/jvm/blocks_test.rb +262 -0
- data/test/jvm/bytecode_test_helper.rb +1 -33
- data/test/jvm/constructors_test.rb +110 -0
- data/test/jvm/{test_enumerable.rb → enumerable_test.rb} +2 -2
- data/test/jvm/factory_test.rb +22 -0
- data/test/jvm/{test_java_typer.rb → java_typer_test.rb} +1 -1
- data/test/jvm/jvm_compiler_test.rb +2162 -0
- data/test/jvm/{test_jvm_compiler.rb → jvm_compiler_test.rb~} +43 -220
- data/test/jvm/{test_macros.rb → macros_test.rb} +2 -2
- data/test/jvm/{test_main_method.rb → main_method_test.rb} +2 -2
- data/test/jvm/{test_rescue.rb → rescue_test.rb} +33 -2
- data/test/plugins/{test_gwt.rb → gwt_test.rb} +2 -2
- data/test/test_helper.rb +40 -0
- metadata +33 -33
- data/test/jvm/test_blocks.rb +0 -62
data/History.txt
CHANGED
@@ -1,3 +1,47 @@
|
|
1
|
+
=== 0.0.11 Pre-Hackathon Edition / 2012-04-09
|
2
|
+
|
3
|
+
235e887 set version to 0.0.11
|
4
|
+
d11f694 actually use the bootclasspath in the bootstrap_loader
|
5
|
+
6f293d8 fix and test(barely) IsolatedResourceLoader
|
6
|
+
cff273c add tests for MirahClassLoader
|
7
|
+
98adac4 add some comments on class loaders
|
8
|
+
e1ddf6a reorg run a little, ensure fail has non-zero exit
|
9
|
+
6a7f2c4 add needed breaks in to args processor
|
10
|
+
72c0031 clean up arg processor interface a bit
|
11
|
+
886bc5f test that bootclasspath arg sets the bootclasspath
|
12
|
+
141aceb add small test for args processor
|
13
|
+
b981088 removing an accidental X from annotations test
|
14
|
+
4361a10 rename test classes to match their filenames
|
15
|
+
7312718 use git bitescript by default
|
16
|
+
2642a28 add tab to cli help for bootclasspath
|
17
|
+
97cee78 Support specifying --bootclasspath
|
18
|
+
6b05845 clean up build_string in java_source
|
19
|
+
ab5c6ac fixes #175. wrap string interp prior to calling method on it.
|
20
|
+
b5148ed Merge pull request #174 from nighthacker/master
|
21
|
+
5bb1d2a fixed mistaken command line flags in synopsis
|
22
|
+
96a9074 closures in closures fixes: 155
|
23
|
+
77f110f move block tests into block_test
|
24
|
+
6e6bfaf previous change was insufficiently argy.
|
25
|
+
98acfef complain if blocks don't have the right number of arguments
|
26
|
+
7076279 add zip install instructions
|
27
|
+
2930ff3 Update README.txt. Fixes #163
|
28
|
+
9a06b83 Merge pull request #166 from keithcelt/master
|
29
|
+
737c01c Silence ant runtime errors on systems building with ant 1.8
|
30
|
+
f8e3edf Fixes 162 by requiring java.lang.System as a string
|
31
|
+
f7c5bee rename tests so test is suffix instead of prefix
|
32
|
+
0caf3d0 pull bitescript exts out into their own file
|
33
|
+
d680a33 fixes #13. adding == & != on bools
|
34
|
+
1a3da9f if no args & -v specified, exit with status 0
|
35
|
+
a044d7b Remove conflicting "Exception" import and move "System" import to class body. Fixes #159.
|
36
|
+
0d0b350 move constructor tests into their own file
|
37
|
+
b351c13 don't raise errors on empty files
|
38
|
+
84c2a83 have Mirah::Parser use the same code path as tests do
|
39
|
+
56bee53 Tests. Fixes #157
|
40
|
+
2fddffe Treat the expression as resolved if the primary_type is nil, as in `return`. #157
|
41
|
+
1a5c40e Don't treat Ensure as an expression; it can never have a return type. #157
|
42
|
+
e04c70f bump versions to 0.0.11.dev
|
43
|
+
|
44
|
+
|
1
45
|
=== 0.0.10 / 2011-11-20
|
2
46
|
|
3
47
|
f6035d0 set version to 0.0.10
|
data/README.txt
CHANGED
@@ -23,8 +23,8 @@ mirah <script.mirah>
|
|
23
23
|
mirah -e "inline script"
|
24
24
|
mirahc <script.mirah>
|
25
25
|
mirahc -e "inline script" # produces DashE.class
|
26
|
-
mirahc
|
27
|
-
mirahc
|
26
|
+
mirahc --java <script.mirah>
|
27
|
+
mirahc --java -e "inline script" # produces DashE.java
|
28
28
|
|
29
29
|
== REQUIREMENTS:
|
30
30
|
|
@@ -33,10 +33,19 @@ mirahc -java -e "inline script" # produces DashE.java
|
|
33
33
|
|
34
34
|
== INSTALL:
|
35
35
|
|
36
|
+
=== RUBY:
|
36
37
|
If your gem and rake are not from from JRuby, prefix the commands with jruby -S
|
37
38
|
|
38
39
|
$ gem install mirah
|
39
40
|
|
41
|
+
=== ZIP:
|
42
|
+
|
43
|
+
You can also install Mirah from a zip file. Download the latest stable
|
44
|
+
release from https://github.com/mirah/mirah/downloads.
|
45
|
+
Extract it, and add `bin` to your `$PATH` to be able to use `mirah`, `mirahc`, etc.
|
46
|
+
|
47
|
+
=== SOURCE:
|
48
|
+
|
40
49
|
To build and install from source,
|
41
50
|
|
42
51
|
$ git clone http://github.com/mirah/mirah.git
|
@@ -47,8 +56,4 @@ $ gem install pkg/mirah-*.gem
|
|
47
56
|
|
48
57
|
== For Java tools:
|
49
58
|
|
50
|
-
To build the Mirah
|
51
|
-
bitescript in Mirah's parent directory. Run "ant jar-complete" in jruby, then in
|
52
|
-
the mirah directory "../jruby/bin/jruby -S rake jar" to build the Mirah jar. Use
|
53
|
-
"jar:complete" instead to produce a free-standing jar file with JRuby and the
|
54
|
-
JRubyParser libraries included.
|
59
|
+
To build the Mirah jar from source run "rake jar" in the mirah directory.
|
data/Rakefile
CHANGED
@@ -39,7 +39,7 @@ def run_tests tests
|
|
39
39
|
rescue Exception
|
40
40
|
end
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
tests.zip(results).each do |name, passed|
|
44
44
|
unless passed
|
45
45
|
puts "Errors in #{name}"
|
@@ -47,7 +47,7 @@ def run_tests tests
|
|
47
47
|
end
|
48
48
|
fail if results.any?{|passed|!passed}
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
desc "run full test suite"
|
52
52
|
task :test do
|
53
53
|
run_tests [ 'test:core', 'test:plugins', 'test:jvm' ]
|
@@ -57,14 +57,14 @@ namespace :test do
|
|
57
57
|
desc "run the core tests"
|
58
58
|
Rake::TestTask.new :core do |t|
|
59
59
|
t.libs << 'test'
|
60
|
-
t.test_files = FileList["test/core
|
60
|
+
t.test_files = FileList["test/core/**/*test.rb"]
|
61
61
|
java.lang.System.set_property("jruby.duby.enabled", "true")
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
desc "run tests for plugins"
|
65
65
|
Rake::TestTask.new :plugins do |t|
|
66
66
|
t.libs << 'test'
|
67
|
-
t.test_files = FileList["test/plugins
|
67
|
+
t.test_files = FileList["test/plugins/**/*test.rb"]
|
68
68
|
java.lang.System.set_property("jruby.duby.enabled", "true")
|
69
69
|
end
|
70
70
|
|
@@ -72,24 +72,24 @@ namespace :test do
|
|
72
72
|
task :jvm do
|
73
73
|
run_tests ["test:jvm:bytecode", "test:jvm:javac"]
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
namespace :jvm do
|
77
77
|
desc "run jvm tests compiling to bytecode"
|
78
78
|
Rake::TestTask.new :bytecode do |t|
|
79
79
|
t.libs << 'test' <<'test/jvm'
|
80
80
|
t.ruby_opts.concat ["-r", "bytecode_test_helper"]
|
81
|
-
t.test_files = FileList["test/jvm
|
81
|
+
t.test_files = FileList["test/jvm/**/*test.rb"]
|
82
82
|
java.lang.System.set_property("jruby.duby.enabled", "true")
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
desc "run jvm tests compiling to java source, then bytecode"
|
86
86
|
Rake::TestTask.new :javac do |t|
|
87
87
|
t.libs << 'test' <<'test/jvm'
|
88
88
|
t.ruby_opts.concat ["-r", "javac_test_helper"]
|
89
|
-
t.test_files = FileList["test/jvm
|
89
|
+
t.test_files = FileList["test/jvm/**/*test.rb"]
|
90
90
|
java.lang.System.set_property("jruby.duby.enabled", "true")
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
@@ -132,11 +132,12 @@ task :compile => :init do
|
|
132
132
|
'mirah'
|
133
133
|
)
|
134
134
|
end
|
135
|
-
|
135
|
+
|
136
136
|
# compile invokedynamic stuff
|
137
137
|
ant.javac :destdir => 'build', :srcdir => 'src',
|
138
138
|
:includes => 'org/mirah/DynalangBootstrap.java',
|
139
|
-
:classpath => 'javalib/dynalink-0.1.jar:javalib/jsr292-mock.jar'
|
139
|
+
:classpath => 'javalib/dynalink-0.1.jar:javalib/jsr292-mock.jar',
|
140
|
+
:includeantruntime => false
|
140
141
|
end
|
141
142
|
|
142
143
|
desc "build basic jar for distribution"
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/javalib/mirah-bootstrap.jar
CHANGED
Binary file
|
@@ -25,9 +25,10 @@ module AppEngine::Rake
|
|
25
25
|
APIS = AppEngine::SDK::API_JAR
|
26
26
|
TOOLS = AppEngine::SDK::TOOLS_JAR
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
CLASSPATH = []
|
29
|
+
CLASSPATH << SERVLET
|
30
|
+
CLASSPATH << APIS
|
31
|
+
CLASSPATH << TOOLS
|
31
32
|
|
32
33
|
class AppEngineTask < Rake::Task
|
33
34
|
def initialize(*args, &block)
|
@@ -38,14 +39,15 @@ module AppEngine::Rake
|
|
38
39
|
def init(src, war)
|
39
40
|
@src = src
|
40
41
|
@war = war
|
41
|
-
unless
|
42
|
-
|
42
|
+
unless CLASSPATH.include?(webinf_classes)
|
43
|
+
CLASSPATH << webinf_classes
|
43
44
|
end
|
44
45
|
webinf_lib_jars.each do |jar|
|
45
|
-
|
46
|
+
CLASSPATH << jar unless CLASSPATH.include?(jar)
|
46
47
|
end
|
47
48
|
Mirah.source_paths << src
|
48
49
|
Mirah.dest_paths << webinf_classes
|
50
|
+
Mirah.compiler_options = ['--classpath', Mirah::Env.encode_paths(CLASSPATH)]
|
49
51
|
directory(webinf_classes)
|
50
52
|
directory(webinf_lib)
|
51
53
|
|
data/lib/mirah/ast/flow.rb
CHANGED
@@ -344,7 +344,7 @@ module Mirah
|
|
344
344
|
if types.any? {|t| t.nil?}
|
345
345
|
typer.defer(self)
|
346
346
|
else
|
347
|
-
if !expression || clause_types.all?{ |t| primary_type.compatible? t}
|
347
|
+
if !expression || primary_type.nil? || clause_types.all?{ |t| primary_type.compatible? t}
|
348
348
|
resolved!
|
349
349
|
types.each do |type|
|
350
350
|
@inferred_type ||= type unless type.unreachable?
|
@@ -373,9 +373,9 @@ module Mirah
|
|
373
373
|
def infer(typer, expression)
|
374
374
|
resolve_if(typer) do
|
375
375
|
typer.infer(clause, false)
|
376
|
-
typer.infer(body,
|
376
|
+
typer.infer(body, false)
|
377
377
|
end
|
378
378
|
end
|
379
379
|
end
|
380
380
|
end
|
381
|
-
end
|
381
|
+
end
|
data/lib/mirah/ast/structure.rb
CHANGED
@@ -145,7 +145,7 @@ module Mirah::AST
|
|
145
145
|
mirah = typer.transformer
|
146
146
|
interface = method.argument_types[-1]
|
147
147
|
outer_class = scope.defining_class
|
148
|
-
|
148
|
+
|
149
149
|
binding = scope.binding_type(mirah)
|
150
150
|
|
151
151
|
name = "#{outer_class.name}$#{mirah.tmp}"
|
@@ -157,6 +157,8 @@ module Mirah::AST
|
|
157
157
|
mirah.eval("@binding = binding", '-', c, 'binding')
|
158
158
|
end
|
159
159
|
|
160
|
+
@defining_class = klass.static_scope.self_type
|
161
|
+
|
160
162
|
# TODO We need a special scope here that allows access to the
|
161
163
|
# outer class.
|
162
164
|
static_scope.self_type = typer.infer(klass, true)
|
@@ -174,6 +176,15 @@ module Mirah::AST
|
|
174
176
|
typer.infer(instance, true)
|
175
177
|
end
|
176
178
|
|
179
|
+
def defining_class
|
180
|
+
@defining_class
|
181
|
+
end
|
182
|
+
|
183
|
+
# TODO extract this & matching methods into a module
|
184
|
+
def binding_type(mirah=nil)
|
185
|
+
static_scope.binding_type(defining_class, mirah)
|
186
|
+
end
|
187
|
+
|
177
188
|
def add_methods(klass, binding, typer)
|
178
189
|
method_definitions = body.select{ |node| node.kind_of? MethodDefinition }
|
179
190
|
|
@@ -183,8 +194,10 @@ module Mirah::AST
|
|
183
194
|
# TODO warn if there are non method definition nodes
|
184
195
|
# they won't be used at all currently--so it'd be nice to note that.
|
185
196
|
method_definitions.each do |node|
|
197
|
+
|
186
198
|
node.static_scope = static_scope
|
187
199
|
node.binding_type = binding
|
200
|
+
# node.children.each {|child| child.instance_variable_set '@scope', nil }
|
188
201
|
klass.append_node(node)
|
189
202
|
end
|
190
203
|
end
|
@@ -206,8 +219,16 @@ module Mirah::AST
|
|
206
219
|
next false
|
207
220
|
end
|
208
221
|
|
209
|
-
|
222
|
+
# It could also just define all the methods w/ the block as the implementation, assuming the args check out
|
223
|
+
# instead of it being an error.
|
224
|
+
if impl_methods.size > 1
|
225
|
+
raise Mirah::NodeError.new("Multiple abstract methods found within interface #{klass.interfaces.map(&:name).inspect} [#{impl_methods.map(&:name).join(', ')}]; cannot use block", self)
|
226
|
+
end
|
227
|
+
|
210
228
|
impl_methods.each do |method|
|
229
|
+
if args.args.length != method.argument_types.length
|
230
|
+
raise Mirah::NodeError.new("Block can't implement #{method.name}: wrong number of arguments. Expected #{method.argument_types.length}, but was #{args.args.length}", self)
|
231
|
+
end
|
211
232
|
mdef = klass.define_method(position,
|
212
233
|
method.name,
|
213
234
|
method.return_type,
|
data/lib/mirah/commands/base.rb
CHANGED
@@ -32,12 +32,15 @@ module Mirah
|
|
32
32
|
attr_accessor :state, :args, :argument_processor
|
33
33
|
|
34
34
|
def execute_base
|
35
|
+
argument_processor.process
|
36
|
+
if argument_processor.exit?
|
37
|
+
exit argument_processor.exit_status_code
|
38
|
+
end
|
35
39
|
# because MirahCommand is a JRuby Java class, SystemExit bubbles through and makes noise
|
36
40
|
# so we use a catch/throw to early exit instead
|
37
41
|
# see util/process_errors.rb
|
38
42
|
status = catch(:exit) do
|
39
43
|
begin
|
40
|
-
argument_processor.process
|
41
44
|
yield
|
42
45
|
rescue Mirah::InternalCompilerError => ice
|
43
46
|
Mirah.print_error(ice.message, ice.position) if ice.node
|
@@ -55,4 +58,4 @@ module Mirah
|
|
55
58
|
end
|
56
59
|
end
|
57
60
|
end
|
58
|
-
end
|
61
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Copyright (c) 2010 The Mirah project authors. All Rights Reserved.
|
2
|
+
# All contributing project authors may be found in the NOTICE file.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require 'mirah/jvm/types'
|
17
|
+
require 'mirah/util/compilation_state'
|
18
|
+
require 'mirah/util/argument_processor'
|
19
|
+
require 'mirah/errors'
|
20
|
+
|
21
|
+
module Mirah
|
22
|
+
module Commands
|
23
|
+
class Base
|
24
|
+
def initialize(args)
|
25
|
+
Mirah::AST.type_factory = Mirah::JVM::Types::TypeFactory.new
|
26
|
+
@state = Mirah::Util::CompilationState.new
|
27
|
+
@state.command = command_name
|
28
|
+
@args = args
|
29
|
+
@argument_processor = Mirah::Util::ArgumentProcessor.new(@state, @args)
|
30
|
+
end
|
31
|
+
|
32
|
+
attr_accessor :state, :args, :argument_processor
|
33
|
+
|
34
|
+
def execute_base
|
35
|
+
# because MirahCommand is a JRuby Java class, SystemExit bubbles through and makes noise
|
36
|
+
# so we use a catch/throw to early exit instead
|
37
|
+
# see util/process_errors.rb
|
38
|
+
status = catch(:exit) do
|
39
|
+
begin
|
40
|
+
argument_processor.process
|
41
|
+
yield
|
42
|
+
rescue Mirah::InternalCompilerError => ice
|
43
|
+
Mirah.print_error(ice.message, ice.position) if ice.node
|
44
|
+
raise ice.cause if (ice.cause && state.verbose)
|
45
|
+
raise ice
|
46
|
+
rescue Mirah::MirahError => ex
|
47
|
+
Mirah.print_error(ex.message, ex.position)
|
48
|
+
puts ex.backtrace if state.verbose
|
49
|
+
throw :exit, 1
|
50
|
+
end
|
51
|
+
0
|
52
|
+
end
|
53
|
+
exit status if status > 0
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/mirah/commands/run.rb
CHANGED
@@ -22,14 +22,10 @@ module Mirah
|
|
22
22
|
def execute
|
23
23
|
execute_base do
|
24
24
|
main = nil
|
25
|
-
|
25
|
+
|
26
26
|
|
27
27
|
# generate all bytes for all classes
|
28
|
-
|
29
|
-
|
30
|
-
generator.generate(args).each do |result|
|
31
|
-
class_map[result.classname.gsub(/\//, '.')] = Mirah::Util::ClassLoader.binary_string result.bytes
|
32
|
-
end
|
28
|
+
class_map = generate_class_map
|
33
29
|
|
34
30
|
# load all classes
|
35
31
|
main = load_classes_and_find_main(class_map)
|
@@ -44,6 +40,16 @@ module Mirah
|
|
44
40
|
end
|
45
41
|
|
46
42
|
private
|
43
|
+
|
44
|
+
def generate_class_map
|
45
|
+
generator = Mirah::Generator.new(@state, @state.compiler_class, false, @state.verbose)
|
46
|
+
|
47
|
+
class_map = {}
|
48
|
+
generator.generate(args).each do |result|
|
49
|
+
class_map[result.classname.gsub(/\//, '.')] = Mirah::Util::ClassLoader.binary_string result.bytes
|
50
|
+
end
|
51
|
+
class_map
|
52
|
+
end
|
47
53
|
|
48
54
|
def load_classes_and_find_main(class_map)
|
49
55
|
main = nil
|
@@ -65,9 +71,10 @@ module Mirah
|
|
65
71
|
raise e
|
66
72
|
end
|
67
73
|
else
|
68
|
-
puts "No main found"
|
74
|
+
$stderr.puts "No main found"
|
75
|
+
exit 1
|
69
76
|
end
|
70
77
|
end
|
71
78
|
end
|
72
79
|
end
|
73
|
-
end
|
80
|
+
end
|
@@ -609,7 +609,9 @@ module Mirah
|
|
609
609
|
method.call(self, call, expression)
|
610
610
|
return
|
611
611
|
else
|
612
|
+
@method.print "(" if Mirah::AST::StringConcat === target
|
612
613
|
target.compile(self, true)
|
614
|
+
@method.print ")" if Mirah::AST::StringConcat === target
|
613
615
|
@method.print ".#{method.name}("
|
614
616
|
end
|
615
617
|
|
@@ -700,20 +702,22 @@ module Mirah
|
|
700
702
|
if expression
|
701
703
|
nodes = precompile_nodes(orig_nodes)
|
702
704
|
simple = nodes.equal?(orig_nodes)
|
703
|
-
|
705
|
+
|
706
|
+
unless simple
|
704
707
|
@method.print(lvalue)
|
705
708
|
end
|
706
|
-
|
707
|
-
unless nodes
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
nodes.each do |node|
|
712
|
-
@method.print ' + '
|
713
|
-
first = false
|
709
|
+
|
710
|
+
@method.print '"" + ' unless nodes.first.kind_of?(Mirah::AST::String)
|
711
|
+
|
712
|
+
nodes.first.compile(self, true)
|
713
|
+
|
714
|
+
nodes[1..-1].each do |node|
|
715
|
+
@method.print ' + '
|
714
716
|
node.compile(self, true)
|
715
717
|
end
|
716
|
-
|
718
|
+
unless simple
|
719
|
+
@method.puts ';'
|
720
|
+
end
|
717
721
|
else
|
718
722
|
orig_nodes.each {|n| n.compile(self, false)}
|
719
723
|
end
|
@@ -776,4 +780,4 @@ module Mirah
|
|
776
780
|
end
|
777
781
|
end
|
778
782
|
end
|
779
|
-
end
|
783
|
+
end
|