javascript - node.js 中的 inlineable 是什么?
问题描述
下面是来自 Node.js 源代码事件模块的代码,我不知道这条评论的意思是:这段代码是重复的,因为将其提取会使其不可内联。
if (typeof handler === 'function') {
const result = ReflectApply(handler, this, args);
// We check if result is undefined first because that
// is the most common case so we do not pay any perf
// penalty
if (result !== undefined && result !== null) {
addCatch(this, result, type, args);
}
} else {
const len = handler.length;
const listeners = arrayClone(handler, len);
for (let i = 0; i < len; ++i) {
const result = ReflectApply(listeners[i], this, args);
// We check if result is undefined first because that
// is the most common case so we do not pay any perf
// penalty.
// This code is duplicated because extracting it away
// would make it non-inlineable.
if (result !== undefined && result !== null) {
addCatch(this, result, type, args);
}
}
}
解决方案
推荐阅读
- .net - Docker 容器立即退出并出现错误 145
- ruby-on-rails - 使用 Kramdown 进行降价时,Rails ATOM 编码无效
- python - 在 PySimpleGUI 窗口中插入图像作为背景
- php - PDF 不使用半页 - TCPDF
- php - 我正在尝试使用 SQLite 和 PHP 以用户身份更新帖子,首先获取帖子 ID,然后更新帖子,但它不起作用
- c# - 从 .net 控制台应用程序运行 databrick 工作区
- python - re.findall 可能的变量名
- c++ - 我最近安装了代码块(Code :: Blocks IDE)但没有编译简单的测试程序
- spring-boot - 如何对文件是否从本地目录移动到 ActiveMQ 队列进行单元测试
- github - 如果推送另一个仓库,则触发 GitHub 操作