mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-18 23:28:13 +00:00
Fixed: #2515 AS1/2 Most of built-in global functions must be case in-sensitive
Fixed: AS1/2 ActionStringExtract incorrectly decompiled as String.substr instead of substring global function
This commit is contained in:
@@ -38,7 +38,7 @@ import java.util.Objects;
|
||||
public class MBStringExtractActionItem extends ActionItem {
|
||||
|
||||
/**
|
||||
* Index
|
||||
* Index - 1 based
|
||||
*/
|
||||
public GraphTargetItem index;
|
||||
|
||||
@@ -107,7 +107,7 @@ public class MBStringExtractActionItem extends ActionItem {
|
||||
public static String getResult(Object count, Object index, Object value) {
|
||||
String str = EcmaScript.toString(value);
|
||||
int idx = EcmaScript.toInt32(index);
|
||||
idx--; // index seems to be 1 based
|
||||
idx--; // index is 1 based
|
||||
|
||||
int cnt = EcmaScript.toInt32(count);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.util.Objects;
|
||||
public class StringExtractActionItem extends ActionItem {
|
||||
|
||||
/**
|
||||
* Index
|
||||
* Index - 1 based
|
||||
*/
|
||||
public GraphTargetItem index;
|
||||
|
||||
@@ -63,10 +63,11 @@ public class StringExtractActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
value.toString(writer, localData);
|
||||
writer.append(".substr");
|
||||
writer.append("substring");
|
||||
writer.spaceBeforeCallParenthesis(2);
|
||||
writer.append("(");
|
||||
value.toString(writer, localData);
|
||||
writer.append(",");
|
||||
index.toString(writer, localData);
|
||||
writer.append(",");
|
||||
count.toString(writer, localData);
|
||||
@@ -98,7 +99,7 @@ public class StringExtractActionItem extends ActionItem {
|
||||
public static String getResult(Object count, Object index, Object value) {
|
||||
String str = EcmaScript.toString(value);
|
||||
int idx = EcmaScript.toInt32(index);
|
||||
idx--; // index seems to be 1 based
|
||||
idx--; // index is 1 based
|
||||
|
||||
int cnt = EcmaScript.toInt32(count);
|
||||
|
||||
|
||||
@@ -943,7 +943,7 @@ public class ActionScript2Parser {
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new MBStringExtractActionItem(null, null, val1, index1, len1);
|
||||
break;
|
||||
case SUBSTR:
|
||||
case SUBSTRING:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem val2 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.COMMA);
|
||||
|
||||
@@ -343,7 +343,7 @@ public class ActionScript2SimpleParser implements SimpleParser {
|
||||
case MBCHR:
|
||||
case MBLENGTH:
|
||||
case MBSUBSTRING:
|
||||
case SUBSTR:
|
||||
case SUBSTRING:
|
||||
case LENGTH:
|
||||
case RANDOM:
|
||||
case INT:
|
||||
@@ -611,7 +611,7 @@ public class ActionScript2SimpleParser implements SimpleParser {
|
||||
expectedType(errors, SymbolType.PARENT_CLOSE);
|
||||
ret = true;
|
||||
break;
|
||||
case SUBSTR:
|
||||
case SUBSTRING:
|
||||
expectedType(errors, SymbolType.PARENT_OPEN);
|
||||
expression(errors, inFunction, inMethod, inTellTarget, true, variables, false, hasEval);
|
||||
expectedType(errors, SymbolType.COMMA);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -153,7 +153,7 @@ public enum SymbolType {
|
||||
RANDOM(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
REMOVEMOVIECLIP(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
STARTDRAG(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
SUBSTR(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
SUBSTRING(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
LENGTH(GraphTargetItem.PRECEDENCE_PRIMARY, false), //string.length
|
||||
INT(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
TARGETPATH(GraphTargetItem.PRECEDENCE_PRIMARY, false),
|
||||
|
||||
@@ -126,7 +126,7 @@ public class ActionGetURL extends Action {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GetUrl \"" + Helper.escapeActionScriptString(urlString) + "\", \"" + Helper.escapeActionScriptString(targetString) + "\"";
|
||||
return "GetURL \"" + Helper.escapeActionScriptString(urlString) + "\", \"" + Helper.escapeActionScriptString(targetString) + "\"";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user