mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-19 01:04:20 +00:00
Another batch of ScopedPointer cleanups
This commit is contained in:
parent
5b13063162
commit
48a5fbd333
74 changed files with 311 additions and 292 deletions
|
|
@ -1149,10 +1149,10 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
{
|
||||
ScopedPointer<IfStatement> s (new IfStatement (location));
|
||||
match (TokenTypes::openParen);
|
||||
s->condition = parseExpression();
|
||||
s->condition.reset (parseExpression());
|
||||
match (TokenTypes::closeParen);
|
||||
s->trueBranch = parseStatement();
|
||||
s->falseBranch = matchIf (TokenTypes::else_) ? parseStatement() : new Statement (location);
|
||||
s->trueBranch.reset (parseStatement());
|
||||
s->falseBranch.reset (matchIf (TokenTypes::else_) ? parseStatement() : new Statement (location));
|
||||
return s.release();
|
||||
}
|
||||
|
||||
|
|
@ -1170,7 +1170,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
{
|
||||
ScopedPointer<VarStatement> s (new VarStatement (location));
|
||||
s->name = parseIdentifier();
|
||||
s->initialiser = matchIf (TokenTypes::assign) ? parseExpression() : new Expression (location);
|
||||
s->initialiser.reset (matchIf (TokenTypes::assign) ? parseExpression() : new Expression (location));
|
||||
|
||||
if (matchIf (TokenTypes::comma))
|
||||
{
|
||||
|
|
@ -1200,46 +1200,46 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
{
|
||||
ScopedPointer<LoopStatement> s (new LoopStatement (location, false));
|
||||
match (TokenTypes::openParen);
|
||||
s->initialiser = parseStatement();
|
||||
s->initialiser.reset (parseStatement());
|
||||
|
||||
if (matchIf (TokenTypes::semicolon))
|
||||
s->condition = new LiteralValue (location, true);
|
||||
s->condition.reset (new LiteralValue (location, true));
|
||||
else
|
||||
{
|
||||
s->condition = parseExpression();
|
||||
s->condition.reset (parseExpression());
|
||||
match (TokenTypes::semicolon);
|
||||
}
|
||||
|
||||
if (matchIf (TokenTypes::closeParen))
|
||||
s->iterator = new Statement (location);
|
||||
s->iterator.reset (new Statement (location));
|
||||
else
|
||||
{
|
||||
s->iterator = parseExpression();
|
||||
s->iterator.reset (parseExpression());
|
||||
match (TokenTypes::closeParen);
|
||||
}
|
||||
|
||||
s->body = parseStatement();
|
||||
s->body.reset (parseStatement());
|
||||
return s.release();
|
||||
}
|
||||
|
||||
Statement* parseDoOrWhileLoop (bool isDoLoop)
|
||||
{
|
||||
ScopedPointer<LoopStatement> s (new LoopStatement (location, isDoLoop));
|
||||
s->initialiser = new Statement (location);
|
||||
s->iterator = new Statement (location);
|
||||
s->initialiser.reset (new Statement (location));
|
||||
s->iterator.reset (new Statement (location));
|
||||
|
||||
if (isDoLoop)
|
||||
{
|
||||
s->body = parseBlock();
|
||||
s->body.reset (parseBlock());
|
||||
match (TokenTypes::while_);
|
||||
}
|
||||
|
||||
match (TokenTypes::openParen);
|
||||
s->condition = parseExpression();
|
||||
s->condition.reset (parseExpression());
|
||||
match (TokenTypes::closeParen);
|
||||
|
||||
if (! isDoLoop)
|
||||
s->body = parseStatement();
|
||||
s->body.reset (parseStatement());
|
||||
|
||||
return s.release();
|
||||
}
|
||||
|
|
@ -1297,7 +1297,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
{
|
||||
ScopedPointer<ArraySubscript> s (new ArraySubscript (location));
|
||||
s->object = input;
|
||||
s->index = parseExpression();
|
||||
s->index.reset (parseExpression());
|
||||
match (TokenTypes::closeBracket);
|
||||
return parseSuffixes (s.release());
|
||||
}
|
||||
|
|
@ -1377,7 +1377,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
ExpPtr name (new UnqualifiedName (location, parseIdentifier()));
|
||||
|
||||
while (matchIf (TokenTypes::dot))
|
||||
name = new DotOperator (location, name, parseIdentifier());
|
||||
name.reset (new DotOperator (location, name, parseIdentifier()));
|
||||
|
||||
return parseFunctionCall (new NewOperator (location), name);
|
||||
}
|
||||
|
|
@ -1405,7 +1405,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
Expression* parseTypeof()
|
||||
{
|
||||
ScopedPointer<FunctionCall> f (new FunctionCall (location));
|
||||
f->object = new UnqualifiedName (location, "typeof");
|
||||
f->object.reset (new UnqualifiedName (location, "typeof"));
|
||||
f->arguments.add (parseUnary());
|
||||
return f.release();
|
||||
}
|
||||
|
|
@ -1427,9 +1427,9 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
|
||||
for (;;)
|
||||
{
|
||||
if (matchIf (TokenTypes::times)) { ExpPtr b (parseUnary()); a = new MultiplyOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::divide)) { ExpPtr b (parseUnary()); a = new DivideOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::modulo)) { ExpPtr b (parseUnary()); a = new ModuloOp (location, a, b); }
|
||||
if (matchIf (TokenTypes::times)) { ExpPtr b (parseUnary()); a.reset (new MultiplyOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::divide)) { ExpPtr b (parseUnary()); a.reset (new DivideOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::modulo)) { ExpPtr b (parseUnary()); a.reset (new ModuloOp (location, a, b)); }
|
||||
else break;
|
||||
}
|
||||
|
||||
|
|
@ -1442,8 +1442,8 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
|
||||
for (;;)
|
||||
{
|
||||
if (matchIf (TokenTypes::plus)) { ExpPtr b (parseMultiplyDivide()); a = new AdditionOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::minus)) { ExpPtr b (parseMultiplyDivide()); a = new SubtractionOp (location, a, b); }
|
||||
if (matchIf (TokenTypes::plus)) { ExpPtr b (parseMultiplyDivide()); a.reset (new AdditionOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::minus)) { ExpPtr b (parseMultiplyDivide()); a.reset (new SubtractionOp (location, a, b)); }
|
||||
else break;
|
||||
}
|
||||
|
||||
|
|
@ -1456,9 +1456,9 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
|
||||
for (;;)
|
||||
{
|
||||
if (matchIf (TokenTypes::leftShift)) { ExpPtr b (parseExpression()); a = new LeftShiftOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::rightShift)) { ExpPtr b (parseExpression()); a = new RightShiftOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::rightShiftUnsigned)) { ExpPtr b (parseExpression()); a = new RightShiftUnsignedOp (location, a, b); }
|
||||
if (matchIf (TokenTypes::leftShift)) { ExpPtr b (parseExpression()); a.reset (new LeftShiftOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::rightShift)) { ExpPtr b (parseExpression()); a.reset (new RightShiftOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::rightShiftUnsigned)) { ExpPtr b (parseExpression()); a.reset (new RightShiftUnsignedOp (location, a, b)); }
|
||||
else break;
|
||||
}
|
||||
|
||||
|
|
@ -1471,14 +1471,14 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
|
||||
for (;;)
|
||||
{
|
||||
if (matchIf (TokenTypes::equals)) { ExpPtr b (parseShiftOperator()); a = new EqualsOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::notEquals)) { ExpPtr b (parseShiftOperator()); a = new NotEqualsOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::typeEquals)) { ExpPtr b (parseShiftOperator()); a = new TypeEqualsOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::typeNotEquals)) { ExpPtr b (parseShiftOperator()); a = new TypeNotEqualsOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::lessThan)) { ExpPtr b (parseShiftOperator()); a = new LessThanOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::lessThanOrEqual)) { ExpPtr b (parseShiftOperator()); a = new LessThanOrEqualOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::greaterThan)) { ExpPtr b (parseShiftOperator()); a = new GreaterThanOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::greaterThanOrEqual)) { ExpPtr b (parseShiftOperator()); a = new GreaterThanOrEqualOp (location, a, b); }
|
||||
if (matchIf (TokenTypes::equals)) { ExpPtr b (parseShiftOperator()); a.reset (new EqualsOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::notEquals)) { ExpPtr b (parseShiftOperator()); a.reset (new NotEqualsOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::typeEquals)) { ExpPtr b (parseShiftOperator()); a.reset (new TypeEqualsOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::typeNotEquals)) { ExpPtr b (parseShiftOperator()); a.reset (new TypeNotEqualsOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::lessThan)) { ExpPtr b (parseShiftOperator()); a.reset (new LessThanOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::lessThanOrEqual)) { ExpPtr b (parseShiftOperator()); a.reset (new LessThanOrEqualOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::greaterThan)) { ExpPtr b (parseShiftOperator()); a.reset (new GreaterThanOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::greaterThanOrEqual)) { ExpPtr b (parseShiftOperator()); a.reset (new GreaterThanOrEqualOp (location, a, b)); }
|
||||
else break;
|
||||
}
|
||||
|
||||
|
|
@ -1491,11 +1491,11 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
|
||||
for (;;)
|
||||
{
|
||||
if (matchIf (TokenTypes::logicalAnd)) { ExpPtr b (parseComparator()); a = new LogicalAndOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::logicalOr)) { ExpPtr b (parseComparator()); a = new LogicalOrOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::bitwiseAnd)) { ExpPtr b (parseComparator()); a = new BitwiseAndOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::bitwiseOr)) { ExpPtr b (parseComparator()); a = new BitwiseOrOp (location, a, b); }
|
||||
else if (matchIf (TokenTypes::bitwiseXor)) { ExpPtr b (parseComparator()); a = new BitwiseXorOp (location, a, b); }
|
||||
if (matchIf (TokenTypes::logicalAnd)) { ExpPtr b (parseComparator()); a.reset (new LogicalAndOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::logicalOr)) { ExpPtr b (parseComparator()); a.reset (new LogicalOrOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::bitwiseAnd)) { ExpPtr b (parseComparator()); a.reset (new BitwiseAndOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::bitwiseOr)) { ExpPtr b (parseComparator()); a.reset (new BitwiseOrOp (location, a, b)); }
|
||||
else if (matchIf (TokenTypes::bitwiseXor)) { ExpPtr b (parseComparator()); a.reset (new BitwiseXorOp (location, a, b)); }
|
||||
else break;
|
||||
}
|
||||
|
||||
|
|
@ -1506,9 +1506,9 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
{
|
||||
ScopedPointer<ConditionalOp> e (new ConditionalOp (location));
|
||||
e->condition = condition;
|
||||
e->trueBranch = parseExpression();
|
||||
e->trueBranch.reset (parseExpression());
|
||||
match (TokenTypes::colon);
|
||||
e->falseBranch = parseExpression();
|
||||
e->falseBranch.reset (parseExpression());
|
||||
return e.release();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue