|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Obtained from StatementContainer.newIf(String)
, an ASIfStatement
allows statements to be added to the 'then' and else' branches.
e.g. To simply add statements to the 'then' branch (executed when the condition holds true),
ASIfStatement ifStmt = method.newIf("test()"); isStmt.addStmt("trace('test succeeded')");
will result in ActionScript code like,
if (test()) { trace('test succeeded'); }
To add code to both 'then' and 'else' branches,
ASIfStatement ifStmt = method.newIf("test()"); isStmt.addStmt("trace('test succeeded')"); ifStmt.getElse().addStmt("trace('test failed')");
will result in ActionScript code like,
if (test()) { trace('test succeeded'); } else { trace('test failed'); }
Note that the first call to getElse() will cause the else-block to be created (even if no statements are subsequently added to it). Subsequent calls to getElse() will return references to the same else-block.
Method Summary | |
StatementContainer |
getElse()
Returns a reference to an object which can populate the else-clause of this ActionScript if-statement with new code. |
Methods inherited from interface uk.co.badgersinfoil.metaas.StatementContainer |
addComment, addStmt, newDoWhile, newFor, newForIn, newIf, newSwitch, newWhile |
Method Detail |
public StatementContainer getElse()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |