このページでは

評価

この警告カテゴリのスペルは[eval] です。

eval を使用しないでください。

何が起こったのですか?

あなたのコードでeval

なぜ悪いのですか?

eval メソッドは遅く、潜在的に危険です。eval は引数をそれ自身の JavaScript スクリプトであるかのように実行し、実行に若干のオーバーヘッドを追加します。eval に渡される引数は、リモート・コード実行攻撃のベクターになる可能性があります。

import QtQuick

Item {
    function f() {
        let myString = "x",
        myObject = {
            x: 10
        },
        value = eval("myObject." + myString);
    }
}

この警告を修正するには、eval 呼び出しを含まないようにコードを書き換えてください。

import QtQuick

Item {
    function f() {
        let myString = "x",
        myObject = {
            x: 10
        },
        value = myObject[myString];
    }
}

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.