jsinstrument 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/jsinstrument/instrumenter.rb +9 -9
- data/lib/jsinstrument/version.rb +1 -1
- metadata +1 -1
@@ -54,10 +54,10 @@ module JSInstrument
|
|
54
54
|
# instrument only if we can get the line no. and we haven't instrumented it
|
55
55
|
#
|
56
56
|
if line and not instrumented_lines.member? line
|
57
|
-
if
|
58
|
-
|
57
|
+
if ['ExpressionStatement', 'EmptyStatement', 'DoWhile', 'While', 'For', 'ForIn', 'Continue',
|
58
|
+
'VarDecl', 'Switch', 'Break', 'Throw', 'Return', 'If', 'VarStatement'].index node_classname
|
59
59
|
|
60
|
-
if
|
60
|
+
if 'DoWhile' == parent_classname
|
61
61
|
if parent.left.eql? node
|
62
62
|
instrumented_lines.add line
|
63
63
|
parent.left = get_inserted_block node
|
@@ -65,7 +65,7 @@ module JSInstrument
|
|
65
65
|
# in RKelly, ConditionalNode extends IfNode
|
66
66
|
# which is so annoying
|
67
67
|
# I mean why they mix a expression and a statement?
|
68
|
-
elsif
|
68
|
+
elsif ['If', 'While', 'For', 'ForIn', 'With'].index parent_classname
|
69
69
|
if parent.value.eql? node
|
70
70
|
instrumented_lines.add line
|
71
71
|
parent.value = get_inserted_block node
|
@@ -73,20 +73,20 @@ module JSInstrument
|
|
73
73
|
instrumented_lines.add line
|
74
74
|
parent.else = get_inserted_block node
|
75
75
|
end
|
76
|
-
elsif
|
76
|
+
elsif ['CaseBlock', 'Label'].index parent_classname
|
77
77
|
# do nothing here
|
78
|
-
elsif
|
78
|
+
elsif 'SourceElements' == parent_classname
|
79
79
|
if insert_func_before node
|
80
80
|
instrumented_lines.add line
|
81
81
|
end
|
82
82
|
end
|
83
|
-
elsif
|
84
|
-
if
|
83
|
+
elsif ['With', 'Try'].index node_classname
|
84
|
+
if 'SourceElements' == parent_classname
|
85
85
|
if insert_func_before node
|
86
86
|
instrumented_lines.add line
|
87
87
|
end
|
88
88
|
end
|
89
|
-
elsif
|
89
|
+
elsif ['FunctionDecl', 'FunctionExpr'].index node_classname
|
90
90
|
if insert_func_before node
|
91
91
|
instrumented_lines.add line
|
92
92
|
end
|
data/lib/jsinstrument/version.rb
CHANGED