Merge pull request #2964 from mrcarlberg/compiler_remove_unused

Fixed: Removed unused variables and statements in compiler
This commit is contained in:
cacaodev
2020-12-23 07:36:29 +01:00
committed by GitHub
2 changed files with 3 additions and 12 deletions
+1 -4
View File
@@ -719,7 +719,6 @@ var reservedIdentifiers = acorn.makePredicate("self _cmd undefined localStorage
var wordPrefixOperators = acorn.makePredicate("delete in instanceof new typeof void");
var isLogicalBinary = acorn.makePredicate("LogicalExpression BinaryExpression");
var isInInstanceof = acorn.makePredicate("in instanceof");
var warningUnusedButSetVariable = {name: "unused-but-set-variable"};
var warningShadowIvar = {name: "shadow-ivar"};
@@ -1330,7 +1329,6 @@ function compileWithFormat(node, state, visitor) {
function c(node, st, override) {
var compiler = st.compiler,
includeComments = compiler.includeComments,
parentNode = st.currentNode(),
localLastNode = lastNode,
sameNode = localLastNode === node;
//console.log(override || node.type);
@@ -2327,8 +2325,7 @@ UpdateExpression: function(node, st, c) {
},
BinaryExpression: function(node, st, c, format) {
var compiler = st.compiler,
generate = compiler.generate,
operatorType = isInInstanceof(node.operator);
generate = compiler.generate;
(generate && nodePrecedence(node, node.left) ? surroundExpression(c) : c)(node.left, st, "Expression");
if (generate) {
var buffer = compiler.jsBuffer;
+2 -8
View File
@@ -386,7 +386,7 @@
// These are used by the preprocess tokenizer.
var preTokPos, preTokType, preTokVal, preTokStart, preTokEnd;
var preTokType, preTokVal, preTokStart, preTokEnd;
var preLastStart, preLastEnd;
var preprocessStack;
var preprocessStackLastItem;
@@ -563,7 +563,7 @@
// Objective-J token types
var _at = {type: "@"}, _dotdotdot = {type: "..."}, _numberSign = {type: "#"};
var _dotdotdot = {type: "..."};
// Operators. These carry several kinds of properties to help the
// parser use them properly (the presence of these properties is
@@ -965,8 +965,6 @@
if (firstEndOfFile == null) firstEndOfFile = tokPos;
// If we are at the end of the input inside a macro continue at last position
var lastItem = preprocessStack.pop();
var saveInputForPrint = input;
var saveSourceFileForPrint = sourceFile;
tokPos = lastItem.end;
input = lastItem.input;
inputLen = lastItem.inputLen;
@@ -1531,7 +1529,6 @@
}
if (allowEndOfLineToken) {
var r;
if (code === 13 || code === 10 || code === 8232 || code === 8233) {
if (options.locations) {
++tokCurLine;
@@ -2239,7 +2236,6 @@
}
}
if (macro) {
var macroStart = tokStart;
var parameters;
var hasParameters = macro.parameters;
var nextIsParenL;
@@ -2259,8 +2255,6 @@
}
if (!hasParameters || nextIsParenL) {
// Now we know that we have a matching macro. Get parameters if needed
var macroString = macro.macro;
//var lastTokPos = tokPos;
if (nextIsParenL) {
var variadicName = macro.variadicName;
var first = true;