jtor 0.1.2-java → 0.1.3-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jtor/expressions.rb +4 -2
- data/lib/jtor/java_parser.rb +12 -1
- data/lib/jtor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fb2ea4b22753d0f86186c6dc9c7f3c44da8791e
|
4
|
+
data.tar.gz: 5ffeb038913f385c12c4b691485dde78a0b345d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5e7a66410fc3632eecbce201f5c1759004c41e0c184d5e3fa6c9e0def6ab0b346be01be5c9f193c23facf1511f74f4d6d539c800afefc2a4447437dce18021a
|
7
|
+
data.tar.gz: c54d04fcf98a188c2fbd9c6cfe9502651b14ae63d80cf51f43c120d30ed147879f02d65579e553c8ecf1e76d8eb7fa8b590f957b739ace5ec53decd342c8c1e6
|
data/lib/jtor/expressions.rb
CHANGED
@@ -79,11 +79,13 @@ module Jtor
|
|
79
79
|
"#{translate_expression(expr.name)}[#{translate_expression(expr.index)}]"
|
80
80
|
when ArrayCreationExpr
|
81
81
|
if expr.initializer
|
82
|
-
|
83
|
-
"[#{values.join(', ')}]"
|
82
|
+
translate_expression(expr.initializer)
|
84
83
|
else
|
85
84
|
"Array.new(#{expr.array_count})"
|
86
85
|
end
|
86
|
+
when ArrayInitializerExpr
|
87
|
+
values = expr.values.map { |value| translate_expression(value) }
|
88
|
+
"[#{values.join(', ')}]"
|
87
89
|
when UnaryExpr
|
88
90
|
op = expr.operator.to_s.to_sym
|
89
91
|
operator = UNARY_OPERATORS[op]
|
data/lib/jtor/java_parser.rb
CHANGED
@@ -202,6 +202,13 @@ module Jtor
|
|
202
202
|
end
|
203
203
|
end
|
204
204
|
|
205
|
+
def write_static_field(field)
|
206
|
+
field.variables.each do |var|
|
207
|
+
fputs "class << self; attr_accessor :#{var.id}; end"
|
208
|
+
fputs "@#{var.id} ||= #{translate_expression(var.init)}" if var.init
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
205
212
|
def translate_member(member)
|
206
213
|
case member
|
207
214
|
when MethodDeclaration
|
@@ -209,7 +216,11 @@ module Jtor
|
|
209
216
|
when ConstructorDeclaration
|
210
217
|
write_constructor(member)
|
211
218
|
when FieldDeclaration
|
212
|
-
|
219
|
+
if ModifierSet.static?(member.modifiers)
|
220
|
+
write_static_field(member)
|
221
|
+
else
|
222
|
+
write_field(member)
|
223
|
+
end
|
213
224
|
end
|
214
225
|
end
|
215
226
|
|
data/lib/jtor/version.rb
CHANGED