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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb0a35641aa58e399585b02e4bd5f0107ade213b
4
- data.tar.gz: a513aa40d6a8f46a72d6131a2f19c6398feb52e6
3
+ metadata.gz: 1fb2ea4b22753d0f86186c6dc9c7f3c44da8791e
4
+ data.tar.gz: 5ffeb038913f385c12c4b691485dde78a0b345d8
5
5
  SHA512:
6
- metadata.gz: 83bbc5dd9b936d8e3d0635c650179b57e82ad54e70ea49230fe51bf3ab64c2e42e67d3b590df51c8dabd2486e549cfc441984217f6db72678eee93ff2b4f0436
7
- data.tar.gz: 8e3eddf4b2b7f05974b3741cc8c301dc62c23cbcaef62b373163f75c19369d4d1669579dbd5321e836b4637455e7350194c85a9d9c6c02efc08750f81a7e91be
6
+ metadata.gz: f5e7a66410fc3632eecbce201f5c1759004c41e0c184d5e3fa6c9e0def6ab0b346be01be5c9f193c23facf1511f74f4d6d539c800afefc2a4447437dce18021a
7
+ data.tar.gz: c54d04fcf98a188c2fbd9c6cfe9502651b14ae63d80cf51f43c120d30ed147879f02d65579e553c8ecf1e76d8eb7fa8b590f957b739ace5ec53decd342c8c1e6
@@ -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
- values = expr.initializer.values.map { |value| translate_expression(value) }
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]
@@ -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
- write_field(member)
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
 
@@ -1,4 +1,4 @@
1
1
  module Jtor
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  JTOR_STDLIB_VERSION = '0.1.5'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jtor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: java
6
6
  authors:
7
7
  - Alejandro Rodríguez