aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qmlls/utils/data/completions/variableDeclaration.qml
blob: 2a32c2ff44c9ec901a26f43a4ebe204400aa90a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import QtQuick

Item {
    function data() { return 42; }

    function f(x) {
        let letStatement = data();
        const constStatement = data();
        var varStatement = data(); // bad?
    }

    function objects(x) {
        let { deconstructed } = data();
        let { deconstructedAloneWithInitializer = 55 } = data();
        let { deconstructedWithInitializer1 = 55, deconstructedWithInitializer2 = 66 } = data(), { unused: deconstructedWithInitializer3 = 77, } = data() ;
    }

    function arrays(x) {
        let [ deconstructed ] = data();
        let [ deconstructedAloneWithInitializer = 55 ] = data();
        let [ deconstructedWithInitializer1 = 55, deconstructedWithInitializer2 = 66 ] = data(), [ deconstructedWithInitializer3 = 77, ] = data() ;
    }

    function oneArrayingToRuleThemAll(x) {
        let [ head, [headOfSecond = 44, secondOfSecond = 55], [_ = "useless", secondOfThird = g()], [ [ headOfHeadOfFourth = g() + 1] ] ] = data();
    }

    function needleInTheHarraystack(x) {
        let [ head, [headOfSecond = 44, secondOfSecond = 55], [_ = "useless", secondOfThird = g(), { needle = "x" }], [ [ headOfHeadOfFourth = g() + 1] ] ] = data();
    }

    function arrayInTheObject(x) {
        let { p: [first, second] } = { p: [1,2] };
    }

}