선언 전에 사용된 함수
qmllint에서는 이 경고 범주를 ' [function-used-before-declaration] '라고 표기합니다.
이 범주는 기본적으로 비활성화되어 있습니다.
선언 전에 함수 사용
무슨 일이 발생했나요?
함수가 선언되기 전에 해당 함수를 호출하거나 이름을 사용했습니다.
왜 문제가 될까요?
코드의 가독성을 떨어뜨리고 혼란을 야기할 수 있습니다.
호이스팅(hoisting)으로 인해 함수는 선언되기 전에 이미 사용할 수 있게 된다는 점에 유의하십시오.
예시
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.