furnace-avm2 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,6 +53,11 @@ module Furnace::AVM2::ABC
53
53
  root.children << AST::Node.new(:interfaces, interfaces.map(&:to_astlet))
54
54
  end
55
55
 
56
+ if initializer
57
+ root.children << AST::Node.new(:initializer,
58
+ [ initializer.to_astlet(initializer_idx, name.to_astlet) ])
59
+ end
60
+
56
61
  if traits.any?
57
62
  root.children << AST::Node.new(:traits, traits.map(&:to_astlet))
58
63
  end
@@ -6,6 +6,10 @@ module Furnace::AVM2::ABC
6
6
 
7
7
  abc_array_of :trait, :nested, :class => TraitInfo
8
8
 
9
+ def instance
10
+ root.instances[root.klasses.index(self)]
11
+ end
12
+
9
13
  def initializer_body
10
14
  root.method_bodies.find { |body| body.method_idx == initializer_idx }
11
15
  end
@@ -13,6 +17,11 @@ module Furnace::AVM2::ABC
13
17
  def to_astlet
14
18
  root = AST::Node.new(:klass)
15
19
 
20
+ if initializer
21
+ root.children << AST::Node.new(:initializer,
22
+ [ initializer.to_astlet(initializer_idx, instance.name.to_astlet) ])
23
+ end
24
+
16
25
  if traits.any?
17
26
  root.children << AST::Node.new(:traits, traits.map(&:to_astlet))
18
27
  end
@@ -20,13 +20,16 @@ module Furnace::AVM2::ABC
20
20
  end
21
21
 
22
22
  def code_to_ast
23
- pipeline = Furnace::Transform::Pipeline.new([
24
- Furnace::AVM2::Transform::ASTBuild.new(validate: true),
25
- Furnace::AVM2::Transform::ASTNormalize.new
26
- ])
23
+ unless @ast
24
+ pipeline = Furnace::Transform::Pipeline.new([
25
+ Furnace::AVM2::Transform::ASTBuild.new(validate: true),
26
+ Furnace::AVM2::Transform::ASTNormalize.new
27
+ ])
27
28
 
28
- ast, = pipeline.run(code, self)
29
- ast
29
+ @ast, = pipeline.run(code, self)
30
+ end
31
+
32
+ @ast
30
33
  end
31
34
  end
32
35
  end
@@ -31,7 +31,7 @@ module Furnace::AVM2::ABC
31
31
  when :qname
32
32
  [ :q, (ns.name if ns), name ].compact
33
33
  when :multiname
34
- [ :m, [ ns.name ], name ]
34
+ [ :m, [ :set, ns.name ], name ]
35
35
  else
36
36
  raise "unknown astpat type #{type}"
37
37
  end
@@ -7,7 +7,7 @@ module Furnace::AVM2::ABC
7
7
  end
8
8
 
9
9
  def to_astlet
10
- ns.map(&:name).uniq
10
+ AST::Node.new(:set, ns.map(&:name).uniq)
11
11
  end
12
12
  end
13
13
  end
@@ -59,7 +59,7 @@ module Furnace::AVM2
59
59
  end
60
60
  end
61
61
 
62
- emit.(current)
62
+ expr.children << current
63
63
  produce.(expr)
64
64
  end
65
65
 
@@ -1,3 +1,3 @@
1
1
  module Furnace::AVM2
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: furnace-avm2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-15 00:00:00.000000000 Z
12
+ date: 2012-02-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: furnace
16
- requirement: &79381650 !ruby/object:Gem::Requirement
16
+ requirement: &74548650 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.0.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *79381650
24
+ version_requirements: *74548650
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: trollop
27
- requirement: &79380920 !ruby/object:Gem::Requirement
27
+ requirement: &74547750 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *79380920
35
+ version_requirements: *74547750
36
36
  description: furnace-avm2 allows one to load, modify and write back Flash ActionScript3
37
37
  bytecode. It can also decompile it.
38
38
  email: