이 페이지에서

선언 전에 사용된 함수

이 경고 카테고리의 철자는 [function-used-before-declaration] 입니다.

이 카테고리는 기본적으로 비활성화되어 있습니다.

선언 전에 사용된 함수

무슨 일이 있었나요?

함수가 선언되기 전에 함수를 호출하거나 함수의 이름을 사용했습니다.

이것이 왜 나쁜가요?

코드를 읽기 어렵게 만들고 혼동을 일으킬 수 있습니다.

호이스팅으로 인해 함수가 선언되기 전에 사용할 수 있게 됩니다.

예시

import QtQuick

Item {
    function f() {
        g(42)
        function g() { return 42; }
    }
}

이 경고를 수정하려면 선언을 사용 전에 옮기세요.

import QtQuick

Item {
    function f() {
        function g() { return 42; }
        g(42)
    }
}

© 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.