Decided that exempting "A=150" wasn't really getting anywhere. If that's

in a loop, that 150 should be pre-assigned to a "constant".
This commit is contained in:
Rob Greene 2018-07-15 18:03:13 -05:00
parent adc60b9d41
commit e20a9c03e0
1 changed files with 4 additions and 5 deletions

View File

@ -114,14 +114,13 @@ public class ExtractConstantValues extends BaseVisitor {
public Statement visit(Statement statement) {
try {
if (!statement.tokens.isEmpty()) {
int size = statement.tokens.size();
Token t = statement.tokens.get(0);
// Special logic for "A=5+1" while trying to skip constant forms of "A=1234" (don't replicate)
if (t.type == Token.Type.IDENT && size > 3) {
// Assignment
if (t.type == Token.Type.IDENT) {
this.consumer = this::numberToIdentTransformation;
}
// Special logic for "LET A=5+1" while trying to skip constant forms of "LET A=1234" (don't replicate)
if (t.type == Token.Type.KEYWORD && t.keyword == ApplesoftKeyword.LET && size > 4) {
// Assignment with LET
if (t.type == Token.Type.KEYWORD && t.keyword == ApplesoftKeyword.LET) {
this.consumer = this::numberToIdentTransformation;
}
}