mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-26 05:42:07 +00:00
maybe dont replace things when auto replace is disabled
This commit is contained in:
parent
42fa0903e7
commit
80ee915bfd
1 changed files with 3 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
# Copyright (c) 2021 bleck9999
|
# Copyright (c) 2021 bleck9999
|
||||||
# https://github.com/bleck9999/ts-minifier
|
# https://github.com/bleck9999/ts-minifier
|
||||||
# Version: c9aef4d4
|
# Version: b201eb4d
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import itertools
|
import itertools
|
||||||
|
@ -243,7 +243,7 @@ def minify(script: Code, userobjects, usages):
|
||||||
savings = uses*len(func) - (len(func)+len(minName)+2)
|
savings = uses*len(func) - (len(func)+len(minName)+2)
|
||||||
if (verbose and savings <= 0) or (not auto_replace and savings > 0):
|
if (verbose and savings <= 0) or (not auto_replace and savings > 0):
|
||||||
print(f"Not aliasing standard library function {func} (would save {savings} bytes)")
|
print(f"Not aliasing standard library function {func} (would save {savings} bytes)")
|
||||||
else:
|
elif auto_replace and savings > 0:
|
||||||
if verbose:
|
if verbose:
|
||||||
print(f"Aliasing standard library function {func} to {minName} (saving {savings} bytes)")
|
print(f"Aliasing standard library function {func} to {minName} (saving {savings} bytes)")
|
||||||
diff = len(func) - len(minName)
|
diff = len(func) - len(minName)
|
||||||
|
@ -277,7 +277,7 @@ def minify(script: Code, userobjects, usages):
|
||||||
savings = uses * len(string) - (len(string) + len(minName) + 2)
|
savings = uses * len(string) - (len(string) + len(minName) + 2)
|
||||||
if (verbose and savings <= 0) or (not auto_replace and savings > 0):
|
if (verbose and savings <= 0) or (not auto_replace and savings > 0):
|
||||||
print(f"Not introducing variable for string {string} reused {uses} times (would save {savings} bytes)")
|
print(f"Not introducing variable for string {string} reused {uses} times (would save {savings} bytes)")
|
||||||
else:
|
elif auto_replace and savings > 0:
|
||||||
# "duplicated code fragment" do i look like i give a shit
|
# "duplicated code fragment" do i look like i give a shit
|
||||||
if verbose:
|
if verbose:
|
||||||
print(f"Introducing variable {minName} with value {string} (saving {savings} bytes)")
|
print(f"Introducing variable {minName} with value {string} (saving {savings} bytes)")
|
||||||
|
|
Loading…
Reference in a new issue