jsinstrument 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/jsinstrument/instrumenter.rb +6 -3
- data/lib/jsinstrument/version.rb +1 -1
- metadata +1 -1
@@ -41,7 +41,6 @@ module JSInstrument
|
|
41
41
|
(inserting % bindings) + instrumented_src
|
42
42
|
end
|
43
43
|
|
44
|
-
private
|
45
44
|
def instrument_ast ast
|
46
45
|
# build parent attr for all nodes in ast
|
47
46
|
#
|
@@ -64,8 +63,11 @@ module JSInstrument
|
|
64
63
|
instrumented_lines.add line
|
65
64
|
parent.left = get_inserted_block node
|
66
65
|
end
|
67
|
-
|
68
|
-
|
66
|
+
# in RKelly, ConditionalNode extends IfNode
|
67
|
+
# which is so annoying
|
68
|
+
# I mean why they mix a expression and a statement?
|
69
|
+
elsif (IfNode === parent and not ConditionalNode === parent) or
|
70
|
+
WhileNode === parent or ForNode === parent or ForInNode === parent or WithNode === parent
|
69
71
|
if parent.value.eql? node
|
70
72
|
instrumented_lines.add line
|
71
73
|
parent.value = get_inserted_block node
|
@@ -96,6 +98,7 @@ module JSInstrument
|
|
96
98
|
[ast, instrumented_lines.sort]
|
97
99
|
end
|
98
100
|
|
101
|
+
private
|
99
102
|
def get_insert_func_call line
|
100
103
|
ExpressionStatementNode.new(
|
101
104
|
FunctionCallNode.new(
|
data/lib/jsinstrument/version.rb
CHANGED