forked from Mirrors/openclonk
Script: Allow "new Foo {}" in constant expressions
parent
f6c2906660
commit
93bf8f4779
|
@ -1963,7 +1963,12 @@ C4Value C4AulParse::Parse_ConstPropList(C4PropListStatic * parent, C4String * Na
|
|||
p->Thaw();
|
||||
}
|
||||
Store_Const(parent, Name, v);
|
||||
Shift();
|
||||
if (TokenType == ATT_IDTF && SEqual(Idtf, C4AUL_New))
|
||||
{
|
||||
Shift();
|
||||
Parse_ConstExpression(p, &Strings.P[P_Prototype]);
|
||||
}
|
||||
Match(ATT_BLOPEN);
|
||||
while (TokenType != ATT_BLCLOSE)
|
||||
{
|
||||
C4String * pKey;
|
||||
|
|
|
@ -115,6 +115,7 @@ TEST_F(AulTest, Locals)
|
|||
EXPECT_EQ(C4VInt(42), RunCode("func Main() { local i = 42; return i; }", false));
|
||||
EXPECT_EQ(C4VInt(42), RunCode("local i = [42]; func Main() { return i[0]; }", false));
|
||||
EXPECT_EQ(C4VInt(42), RunCode("local p = { i = 42 }; func Main() { return p.i; }", false));
|
||||
EXPECT_EQ(C4VInt(42), RunCode("local p1 = { i = 42 }, p2 = new p1 {}; func Main() { return p2.i; }", false));
|
||||
}
|
||||
|
||||
TEST_F(AulTest, Eval)
|
||||
|
|
Loading…
Reference in New Issue