faster syntax highlighting

This commit is contained in:
2015-09-16 14:12:13 +02:00
parent 5e42c5b57c
commit e8fb8e2f37
41 changed files with 2129 additions and 2175 deletions
@@ -268,7 +268,7 @@ public class ActionGraph extends Graph {
}
}
if (switchedObject == null) {
switchedObject = new DirectValueActionItem(null, -1, new Null(), null);
switchedObject = new DirectValueActionItem(null, -1, Null.INSTANCE, null);
}
HashMap<Integer, GraphTargetItem> caseValuesMap = new HashMap<>();
@@ -1065,10 +1065,10 @@ public class ActionListReader {
} else if (!(a instanceof GraphSourceItemContainer)) {
//return in for..in, TODO:Handle this better way
if (((a instanceof ActionEquals) || (a instanceof ActionEquals2)) && (stack.size() == 1) && (stack.peek() instanceof DirectValueActionItem)) {
stack.push(new DirectValueActionItem(null, 0, new Null(), new ArrayList<>()));
stack.push(new DirectValueActionItem(null, 0, Null.INSTANCE, new ArrayList<>()));
}
if ((a instanceof ActionStoreRegister) && stack.isEmpty()) {
stack.push(new DirectValueActionItem(null, 0, new Null(), new ArrayList<>()));
stack.push(new DirectValueActionItem(null, 0, Null.INSTANCE, new ArrayList<>()));
}
a.translate(localData, stack, output, Graph.SOP_USE_STATIC/*Graph.SOP_SKIP_STATIC*/, path);
}
@@ -94,7 +94,7 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue {
return (this.constants.get(((ConstantIndex) value).index));
}
if (value instanceof RegisterNumber) {
return new Undefined(); //has not computed value
return Undefined.INSTANCE; //has not computed value
}
return value;
}
@@ -97,7 +97,7 @@ public class GetVariableActionItem extends ActionItem {
@Override
public Object getResult() {
if (computedValue == null) {
return new Undefined();
return Undefined.INSTANCE;
}
return computedResult;
}
@@ -71,7 +71,7 @@ public class ReturnActionItem extends ActionItem implements ExitItem {
int forinlevel = asGenerator.getForInLevel(localData);
for (int i = 0; i < forinlevel; i++) { //Must POP all remaining values from enumerations (for..in)
List<Action> forinret = new ArrayList<>();
forinret.add(new ActionPush(new Null()));
forinret.add(new ActionPush(Null.INSTANCE));
forinret.add(new ActionEquals2());
forinret.add(new ActionNot());
ActionIf aforinif = new ActionIf(0);
@@ -80,7 +80,7 @@ public class ReturnActionItem extends ActionItem implements ExitItem {
ret.addAll(forinret);
}
if (value == null) {
ret.add(new ActionPush(new Undefined()));
ret.add(new ActionPush(Undefined.INSTANCE));
} else {
ret.addAll(value.toSource(localData, generator));
}
@@ -132,7 +132,7 @@ public class ForInActionItem extends LoopActionItem implements Block {
int exprReg = asGenerator.getTempRegister(localData);
loopExpr.add(new ActionStoreRegister(exprReg));
loopExpr.add(new ActionPush(new Null()));
loopExpr.add(new ActionPush(Null.INSTANCE));
loopExpr.add(new ActionEquals2());
ActionIf forInEndIf = new ActionIf(0);
loopExpr.add(forInEndIf);
File diff suppressed because it is too large Load Diff
@@ -947,7 +947,7 @@ public class ActionScript2Parser {
List<GraphTargetItem> args = call(inFunction, inMethod, variables);
VariableActionItem supItem = new VariableActionItem(s.value.toString(), null, false);
variables.add(supItem);
ret = new CallMethodActionItem(null, supItem, new DirectValueActionItem(null, 0, new Undefined(), constantPool), args);
ret = new CallMethodActionItem(null, supItem, new DirectValueActionItem(null, 0, Undefined.INSTANCE, constantPool), args);
} else {//no costructor call, but it could be calling parent methods... => handle in expression
lexer.pushback(ss2);
lexer.pushback(s);
@@ -1142,7 +1142,7 @@ public class ActionScript2Parser {
case RETURN:
GraphTargetItem retexpr = expression(inFunction, inMethod, true, variables);
if (retexpr == null) {
retexpr = new DirectValueActionItem(null, 0, new Undefined(), new ArrayList<>());
retexpr = new DirectValueActionItem(null, 0, Undefined.INSTANCE, new ArrayList<>());
}
ret = new ReturnActionItem(null, retexpr);
break;
@@ -1621,11 +1621,11 @@ public class ActionScript2Parser {
break;
case NULL:
ret = new DirectValueActionItem(null, 0, new Null(), new ArrayList<>());
ret = new DirectValueActionItem(null, 0, Null.INSTANCE, new ArrayList<>());
break;
case UNDEFINED:
ret = new DirectValueActionItem(null, 0, new Undefined(), new ArrayList<>());
ret = new DirectValueActionItem(null, 0, Undefined.INSTANCE, new ArrayList<>());
break;
case FALSE:
ret = new DirectValueActionItem(null, 0, Boolean.FALSE, new ArrayList<>());
@@ -27,7 +27,7 @@ import java.util.Stack;
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.6.0
* from the specification file
* <tt>C:/Dropbox/Programovani/JavaSE/FFDec/libsrc/ffdec_lib/lexers/actionscript_script.flex</tt>
* <tt>C:/FFDec/jpexs-decompiler/libsrc/ffdec_lib/lexers/actionscript_script.flex</tt>
*/
public final class ActionScriptLexer {
@@ -1268,7 +1268,7 @@ public final class ActionScriptLexer {
private int zzFinalHighSurrogate = 0;
/* user code: */
StringBuffer string = new StringBuffer();
StringBuilder string = new StringBuilder();
private static String xmlTagName = "";
@@ -723,7 +723,7 @@ public class ActionSourceGenerator implements SourceGenerator {
if (!isInterface) {
ifbody.add(new ActionPush((Long) 1L));
ifbody.add(new ActionPush(new Null()));
ifbody.add(new ActionPush(Null.INSTANCE));
ifbody.addAll(typeToActions(globalClassTypeStr, null));
ifbody.add(pushConst("prototype"));
ifbody.add(new ActionGetMember());
@@ -99,10 +99,10 @@ public class ActionPush extends Action {
values.add(sis.readFLOAT("float"));
break;
case 2:
values.add(new Null());
values.add(Null.INSTANCE);
break;
case 3:
values.add(new Undefined());
values.add(Undefined.INSTANCE);
break;
case 4:
values.add(new RegisterNumber(sis.readUI8("registerNumber")));