mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-29 00:10:02 -05:00
patterns: Allow function variables to be assigned immediately
This commit is contained in:
@@ -493,14 +493,23 @@ namespace hex::pl {
|
||||
if (isFunction) {
|
||||
statement = parseFunctionCall();
|
||||
}
|
||||
else
|
||||
else {
|
||||
statement = parseMemberVariable(parseType(true));
|
||||
}
|
||||
}
|
||||
else if (peek(KEYWORD_BE) || peek(KEYWORD_LE) || peek(VALUETYPE_ANY)) {
|
||||
auto type = parseType(true);
|
||||
|
||||
if (MATCHES(sequence(IDENTIFIER)))
|
||||
if (MATCHES(sequence(IDENTIFIER))) {
|
||||
auto identifier = getValue<Token::Identifier>(-1).get();
|
||||
statement = parseMemberVariable(type);
|
||||
|
||||
if (MATCHES(sequence(OPERATOR_ASSIGNMENT))) {
|
||||
auto expression = parseMathematicalExpression();
|
||||
|
||||
statement = new ASTNodeCompoundStatement({ statement, new ASTNodeAssignment(identifier, expression) });
|
||||
}
|
||||
}
|
||||
else
|
||||
throwParseError("invalid variable declaration");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user