• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wurstscript / WurstScript / 228

29 Nov 2023 05:00PM UTC coverage: 62.48% (-0.09%) from 62.574%
228

push

circleci

web-flow
Show dialog for choosing game path, cleanup (#1083)

* show dialog for choosing game path

* cleanup code

* remove logs and refactor

* remove confusing mpq error, make some mpq loads readonly

17295 of 27681 relevant lines covered (62.48%)

0.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.74
de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/interpreter/RunStatement.java
1
package de.peeeq.wurstscript.intermediatelang.interpreter;
2

3
import de.peeeq.wurstio.jassinterpreter.InterpreterException;
4
import de.peeeq.wurstio.jassinterpreter.VarargArray;
5
import de.peeeq.wurstscript.intermediatelang.ILaddress;
6
import de.peeeq.wurstscript.intermediatelang.ILconst;
7
import de.peeeq.wurstscript.intermediatelang.ILconstBool;
8
import de.peeeq.wurstscript.jassIm.*;
9
import de.peeeq.wurstscript.jassinterpreter.ExitwhenException;
10
import de.peeeq.wurstscript.jassinterpreter.ReturnException;
11

12
public class RunStatement {
×
13

14
    public static void run(ImExpr e, ProgramState globalState, LocalState localState) {
15
        e.evaluate(globalState, localState);
1✔
16
    }
1✔
17

18
    public static void run(ImExitwhen s, ProgramState globalState, LocalState localState) {
19
        ILconstBool c = (ILconstBool) s.getCondition().evaluate(globalState, localState);
1✔
20
        if (c.getVal()) {
1✔
21
            throw ExitwhenException.instance();
1✔
22
        }
23
    }
1✔
24

25
    public static void run(ImIf s, ProgramState globalState, LocalState localState) {
26
        ILconstBool c = (ILconstBool) s.getCondition().evaluate(globalState, localState);
1✔
27
        if (c.getVal()) {
1✔
28
            s.getThenBlock().runStatements(globalState, localState);
1✔
29
        } else {
30
            s.getElseBlock().runStatements(globalState, localState);
1✔
31
        }
32

33
    }
1✔
34

35
    public static void run(ImLoop s, ProgramState globalState, LocalState localState) {
36
        try {
37
            while (true) {
38
                if (Thread.currentThread().isInterrupted()) {
1✔
39
                    throw new InterpreterException(globalState, "Execution interrupted");
×
40
                }
41
                s.getBody().runStatements(globalState, localState);
1✔
42
            }
43
        } catch (ExitwhenException e) {
1✔
44
            // end of loop
45
        }
46

47
    }
1✔
48

49
    public static void run(ImReturn s, ProgramState globalState, LocalState localState) {
50
        ILconst r = null;
1✔
51
        if (s.getReturnValue() instanceof ImExpr) {
1✔
52
            ImExpr e = (ImExpr) s.getReturnValue();
1✔
53
            r = e.evaluate(globalState, localState);
1✔
54
        }
55
        throw new ReturnException(r);
1✔
56
    }
57

58
    public static void run(ImSet s, ProgramState globalState, LocalState localState) {
59
        ILaddress v = s.getLeft().evaluateLvalue(globalState, localState);
1✔
60
        ILconst right = s.getRight().evaluate(globalState, localState);
1✔
61
        v.set(right);
1✔
62
    }
1✔
63

64

65
    public static void run(ImStmts stmts, ProgramState globalState, LocalState localState) {
66
        for (ImStmt s : stmts) {
1✔
67
            globalState.setLastStatement(s);
1✔
68
            s.runStatement(globalState, localState);
1✔
69
        }
1✔
70
    }
1✔
71

72

73
    public static void run(ImVarargLoop loop, ProgramState globalState, LocalState localState) {
74
        ImFunction func = loop.getNearestFunc();
1✔
75
        ImVar varargParam = func.getParameters().get(func.getParameters().size() - 1);
1✔
76
        VarargArray val = (VarargArray) localState.getVal(varargParam);
1✔
77
        for (int i = 0; i < val.size(); i++) {
1✔
78
            localState.setVal(loop.getLoopVar(), val.get(i));
1✔
79
            loop.getBody().runStatements(globalState, localState);
1✔
80
        }
81
    }
1✔
82
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc