Methods
constantFolding(code, debug) → {string}
A function that fold constants
Parameters:
Name | Type | Default | Description |
---|---|---|---|
code |
string | A string with the input code | |
debug |
bool | false | Activates debug mode (print AST) |
- Source:
Returns:
A string with the new code with constant folded
- Type
- string
popReplace(node)
Replaces an array by the last element
Parameters:
Name | Type | Description |
---|---|---|
node |
object | Node of AST |
- Source:
replaceByArray(node)
Replace concat member by the result array
Parameters:
Name | Type | Description |
---|---|---|
node |
object | Node of AST |
- Source:
replaceByLiteral(node)
A function that replace a binary expresion node to a literal node
Parameters:
Name | Type | Description |
---|---|---|
node |
object | Node of AST |
- Source:
replaceByNumber(node)
Replace a length member by the result number
Parameters:
Name | Type | Description |
---|---|---|
node |
object | Node of AST |
- Source: