Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
Brakeman
提交
b41459e5
B
Brakeman
项目概览
李少辉-开发者
/
Brakeman
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
Brakeman
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b41459e5
编写于
3月 06, 2013
作者:
J
Justin Collins
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use custom deep_clone for Sexp
slightly faster and probably uses less memory
上级
8313a32f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
15 deletion
+25
-15
lib/brakeman/processors/alias_processor.rb
lib/brakeman/processors/alias_processor.rb
+1
-15
lib/ruby_parser/bm_sexp.rb
lib/ruby_parser/bm_sexp.rb
+24
-0
未找到文件。
lib/brakeman/processors/alias_processor.rb
浏览文件 @
b41459e5
...
...
@@ -63,7 +63,7 @@ class Brakeman::AliasProcessor < Brakeman::SexpProcessor
#Generic replace
if
replacement
=
env
[
exp
]
and
not
duplicate?
replacement
result
=
set_line
replacement
.
deep_clone
,
exp
.
line
result
=
replacement
.
deep_clone
(
exp
.
line
)
else
result
=
exp
end
...
...
@@ -580,20 +580,6 @@ class Brakeman::AliasProcessor < Brakeman::SexpProcessor
meth_env
end
#Set line nunber for +exp+ and every Sexp it contains. Used when replacing
#expressions, so warnings indicate the correct line.
def
set_line
exp
,
line_number
if
sexp?
exp
exp
.
original_line
(
exp
.
original_line
||
exp
.
line
)
exp
.
line
line_number
exp
.
each
do
|
e
|
set_line
e
,
line_number
end
end
exp
end
#Finds the inner most call target which is not the target of a call to <<
def
find_push_target
exp
if
call?
exp
and
exp
.
method
==
:<<
...
...
lib/ruby_parser/bm_sexp.rb
浏览文件 @
b41459e5
...
...
@@ -14,6 +14,30 @@ class Sexp
raise
NoMethodError
.
new
(
"No method '
#{
name
}
' for Sexp"
,
name
,
args
)
end
#Create clone of Sexp and nested Sexps but not their non-Sexp contents.
#If a line number is provided, also sets line/original_line on all Sexps.
def
deep_clone
line
=
nil
s
=
Sexp
.
new
self
.
each
do
|
e
|
if
e
.
is_a?
Sexp
s
<<
e
.
deep_clone
(
line
)
else
s
<<
e
end
end
if
line
s
.
original_line
(
self
.
original_line
||
self
.
line
)
s
.
line
(
line
)
else
s
.
original_line
(
self
.
original_line
)
s
.
line
(
self
.
line
)
end
s
end
def
paren
@paren
||=
false
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录