MCPcopy Create free account
hub / github.com/dfranx/ShaderDebugger / ParseArrayLength

Method ParseArrayLength

libs/wgtcc/parser.cc:1633–1649  ·  view source on GitHub ↗

* Return: -1, length not specified */

Source from the content-addressed store, hash-verified

1631 * Return: -1, length not specified
1632 */
1633int Parser::ParseArrayLength() {
1634 auto hasStatic = ts_.Try(Token::STATIC);
1635 auto qual = ParseQual();
1636 if (0 != qual)
1637 hasStatic = ts_.Try(Token::STATIC);
1638
1639 if (!hasStatic && ts_.Test(']'))
1640 return -1;
1641
1642 auto expr = ParseAssignExpr();
1643 EnsureInteger(expr);
1644 auto ret = Evaluator<long>().Eval(expr);
1645 if (ret < 0) {
1646 Error(expr, "size of array is negative");
1647 }
1648 return ret;
1649}
1650
1651
1652/*

Callers

nothing calls this directly

Calls 4

ErrorFunction · 0.85
TryMethod · 0.45
TestMethod · 0.45
EvalMethod · 0.45

Tested by

no test coverage detected