aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qmlls/utils/data/completions/suggestContinueAndBreak.qml
blob: 89855e158498a26e4f276a171896944e0f70611a (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick

Item {
    function f(x) {
        // sanity check: no break or continue allowed in function body

        for(let i = 0; i < 5; ++i) {
            // break and continue allowed in loop
        }

        switch(x) {
            // no break allowed here
        case 3:
            // break allowed in case
        default:
            // break allowed in default
        case f("helloWorld"):
            // break allowed in moreCase
        }

        helloLabel: {
            // break allowed in labelledstatement
        }

        // combinations:
        combiLabel: {
            // break allowed in labelledstatement
            for(let i = 0; i < 5; ++i) {
                // break and continue allowed in loop

                switch(x) {
                default:
                    // break allowed in default + continue for loop
                }
            }

            switch(x) {
            case 3:
            default:
            case f("helloWorld"):
                // no continue allowed here

                for(let i = 0; i < 5; ++i) {
                    // break and continue allowed in loop
                }
            }
        }

    }

}