fastruby 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/Rakefile +1 -1
  2. data/lib/fastruby/builder.rb~ +5 -1
  3. data/lib/fastruby/corelib/fixnum.rb +1 -1
  4. data/lib/fastruby/corelib/fixnum.rb~ +0 -71
  5. data/lib/fastruby/corelib.rb~ +1 -1
  6. data/lib/fastruby/modules/inliner/call.rb~ +3 -1
  7. data/lib/fastruby/modules/translator/call.rb +1 -1
  8. data/lib/fastruby/modules/translator/call.rb~ +1 -1
  9. data/lib/fastruby/object.rb~ +0 -6
  10. data/lib/fastruby.rb +1 -1
  11. data/lib/fastruby.rb~ +1 -1
  12. data/spec/corelib/numeric/fixnum_spec.rb +1 -1
  13. data/spec/corelib/numeric/fixnum_spec.rb~ +7 -1
  14. metadata +12 -40
  15. data/lib/fastruby/builder/inference_updater.rb~ +0 -76
  16. data/lib/fastruby/builder/inliner.rb~ +0 -60
  17. data/lib/fastruby/builder/lvar_type.rb~ +0 -44
  18. data/lib/fastruby/builder/pipeline.rb~ +0 -43
  19. data/lib/fastruby/builder/reductor.rb~ +0 -42
  20. data/lib/fastruby/corelib/integer.rb~ +0 -96
  21. data/lib/fastruby/modules/inliner/defn.rb~ +0 -29
  22. data/lib/fastruby/modules/inliner/recursive.rb~ +0 -40
  23. data/lib/fastruby/modules/lvar_type/call.rb~ +0 -36
  24. data/lib/fastruby/modules/lvar_type/defn.rb~ +0 -42
  25. data/lib/fastruby/modules/lvar_type/lasgn.rb~ +0 -42
  26. data/lib/fastruby/modules/lvar_type/recursive.rb~ +0 -33
  27. data/lib/fastruby/modules/reductor/nontree.rb~ +0 -32
  28. data/lib/fastruby/modules/reductor/recursive.rb~ +0 -31
  29. data/lib/fastruby/modules/translator/defn.rb~ +0 -267
  30. data/lib/fastruby/modules/translator/directive.rb~ +0 -44
  31. data/lib/fastruby/modules/translator/exceptions.rb~ +0 -120
  32. data/lib/fastruby/modules/translator/iter.rb~ +0 -745
  33. data/lib/fastruby/modules/translator/literal.rb~ +0 -150
  34. data/lib/fastruby/modules/translator/nonlocal.rb~ +0 -298
  35. data/lib/fastruby/modules/translator/static.rb~ +0 -291
  36. data/lib/fastruby/modules/translator/variable.rb~ +0 -280
  37. data/lib/fastruby/set_tree.rb~ +0 -71
  38. data/lib/fastruby/sexp_extension.rb~ +0 -262
  39. data/lib/fastruby/translator/scope_mode_helper.rb~ +0 -138
  40. data/lib/fastruby/translator/translator.rb~ +0 -1600
  41. data/lib/fastruby/translator/translator_modules.rb~ +0 -53
  42. data/lib/fastruby_only/base.rb +0 -1
@@ -1,120 +0,0 @@
1
- =begin
2
-
3
- This file is part of the fastruby project, http://github.com/tario/fastruby
4
-
5
- Copyright (c) 2011 Roberto Dario Seminara <robertodarioseminara@gmail.com>
6
-
7
- fastruby is free software: you can redistribute it and/or modify
8
- it under the terms of the gnu general public license as published by
9
- the free software foundation, either version 3 of the license, or
10
- (at your option) any later version.
11
-
12
- fastruby is distributed in the hope that it will be useful,
13
- but without any warranty; without even the implied warranty of
14
- merchantability or fitness for a particular purpose. see the
15
- gnu general public license for more details.
16
-
17
- you should have received a copy of the gnu general public license
18
- along with fastruby. if not, see <http://www.gnu.org/licenses/>.
19
-
20
- =end
21
- module FastRuby
22
- class Context
23
-
24
- define_translator_for(:rescue, :method => :to_c_rescue, :arity => 1)
25
- def to_c_rescue(tree)
26
- catch_on_throw do
27
- if tree[1][0] == :resbody
28
- else_tree = tree[2]
29
-
30
- if else_tree
31
- to_c else_tree
32
- else
33
- "Qnil"
34
- end
35
- else
36
- resbody_tree = tree[2]
37
- else_tree = nil
38
- if tree[-1]
39
- if tree[-1][0] != :resbody
40
- else_tree = tree[-1]
41
- end
42
- end
43
-
44
- catch_condition_array = []
45
- lasgn_code = ""
46
- resbody_code = to_c(resbody_tree[2])
47
-
48
- rescue_code = ""
49
-
50
- tree[1..-1].each do |resbody_tree|
51
- next if resbody_tree[0] != :resbody
52
-
53
- if resbody_tree[1].size == 1
54
- resbody_tree[1][1] = s(:const, :Exception)
55
- end
56
-
57
- if resbody_tree[1].last[0] == :lasgn
58
- lasgn_code = to_c(resbody_tree[1].last)
59
- end
60
-
61
- resbody_tree[1][1..-1].each do |xtree|
62
- if xtree[0] != :lasgn
63
- trapcode = "rb_eException";
64
-
65
- if xtree
66
- trapcode = to_c(xtree)
67
- end
68
-
69
- catch_condition_array << "(rb_obj_is_kind_of(frame.thread_data->exception,#{trapcode}) == Qtrue)"
70
- end
71
- end
72
-
73
- rescue_code << "
74
- if (aux == FASTRUBY_TAG_RAISE) {
75
- if (#{catch_condition_array.join(" || ")})
76
- {
77
- // trap exception
78
- frame.targetted = 1;
79
-
80
- #{lasgn_code};
81
-
82
- #{resbody_code};
83
- }
84
- }
85
- "
86
- end
87
-
88
- frame_call(
89
- "ret = " + frame(to_c(tree[1])+";","
90
- #{rescue_code}
91
- ", else_tree ? to_c(else_tree) : nil, 1)
92
-
93
- )
94
- end
95
- end
96
- end
97
-
98
- define_translator_for(:ensure, :method => :to_c_ensure, :arity => 1)
99
- def to_c_ensure(tree)
100
- if tree.size == 2
101
- to_c tree[1]
102
- else
103
- ensured_code = to_c tree[2]
104
- inline_block {
105
- "#{frame(to_c(tree[1]),ensured_code,ensured_code,1)};"
106
- }
107
- end
108
- end
109
-
110
- define_translator_for(:call, :priority => 100){ |*x|
111
- tree, result_var = x
112
-
113
- # raise code
114
- args = tree[3]
115
- _raise(args[1],args[2])
116
- }.condition{|*x|
117
- tree = x.first; tree.node_type == :call && tree[2] == :raise
118
- }
119
- end
120
- end