Obfuscator class
A very simple obfuscator example. Visits every node and generates minified lua. Identifiers are remapped to the next smallest unique id composed of strictly lower-case alphanumeric chars.
Constructors
-
Obfuscator(AST ast, {List<
String> prelude = const []}) -
Constructor walks the AST,
generates a
preludeof remapped variables, and stores the result in content.
Properties
- content ↔ String
-
The output content to write to file.
getter/setter pair
- current ↔ Scope
-
Current scope.
getter/setter pair
- global ↔ Scope
-
Global scope.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- pscope ↔ Scope
-
Prelude scope. These entries will be first
written out before the final content.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createID(
String id) → String - Forwards call to current's Scope.createID. Exception: metamethods have their IDs preserved
-
getID(
String id) → String? - Forwards call to current's Scope.getID. Exception: metamethods have their IDs preserved
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
popScope(
) → void - Pops scope and restores current to the previous scope Scope.parent;
-
pushScope(
Scope prev) → void -
Create a new Scope with parent
prev. -
toString(
) → String -
A string representation of this object.
inherited
-
visitAssignMultiStmt(
AssignMultiStmt assignMultiStmt) → String -
override
-
visitAssignStmt(
AssignStmt assignStmt) → String -
override
-
visitAST(
AST ast) → String -
override
-
visitBinaryExpr(
BinaryExpr expr) → String -
override
-
visitBooleanLiteral(
BooleanLiteral boolean) → String -
override
-
visitBreakStmt(
BreakStmt stmt) → String -
override
-
visitDeclArg(
DeclArg declArg) → String -
override
-
visitDeclMultiVar(
DeclMultiVar declMultiVar) → String -
override
-
visitDeclVar(
DeclVar declVar) → String -
override
-
visitDoBlockStmt(
DoBlockStmt doBlockStmt) → String -
override
-
visitForIterLoopStmt(
ForIterLoopStmt forIterLoopStmt) → String -
override
-
visitForLoopStmt(
ForLoopStmt forLoopStmt) → String -
override
-
visitFuncExpr(
FuncExpr expr) → String -
override
-
visitGotoLabelStmt(
GotoLabelStmt gotoLabelStmt) → String -
override
-
visitGotoStmt(
GotoStmt gotoStmt) → String -
override
-
visitGroupExpr(
GroupExpr groupExpr) → String -
override
-
visitIfStmt(
IfStmt stmt) → String -
override
-
visitKeyValStmt(
KeyValStmt keyval) → String -
override
-
visitMemoryAccess(
MemoryAccess memoryAccess) → String -
override
-
visitNilLiteral(
NilLiteral nil) → String -
override
-
visitNotExpr(
NotExpr notExpr) → String -
override
-
visitNumberLiteral(
NumberLiteral number) → String -
override
-
visitRawExpr(
RawExpr rawExpr) → String -
override
-
visitRepeatUntilLoopStmt(
RepeatUntilLoopStmt repeatUntilLoopStmt) → String -
override
-
visitReturnStmt(
ReturnStmt expr) → String -
override
-
visitSelfExpr(
SelfExpr selfExpr) → String -
override
-
visitStringLiteral(
StringLiteral string) → String -
override
-
visitTableLiteral(
TableLiteral table) → String -
override
-
visitUnaryExpr(
UnaryExpr expr) → String -
override
-
visitWhileLoopStmt(
WhileLoopStmt whileLoopStmt) → String -
override
-
wrapScope(
Scope prev, {required dynamic block()}) → void -
Utility to wrap contents in
blockwith pushScope and popScope respectively. Preserves the parent scopeprev.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited