(decl *js.VarDecl, onlyDefines bool)
| 527 | } |
| 528 | |
| 529 | func (m *jsMinifier) minifyVarDecl(decl *js.VarDecl, onlyDefines bool) { |
| 530 | if len(decl.List) == 0 { |
| 531 | return |
| 532 | } else if decl.TokenType == js.ErrorToken { |
| 533 | // remove 'var' when hoisting variables |
| 534 | first := true |
| 535 | for _, item := range decl.List { |
| 536 | if item.Default != nil || !onlyDefines { |
| 537 | if !first { |
| 538 | m.write(commaBytes) |
| 539 | } |
| 540 | m.minifyBindingElement(item) |
| 541 | first = false |
| 542 | } |
| 543 | } |
| 544 | } else { |
| 545 | m.optimizeVarOrder(decl) |
| 546 | |
| 547 | m.write(decl.TokenType.Bytes()) |
| 548 | m.writeSpaceBeforeIdent() |
| 549 | for i, item := range decl.List { |
| 550 | if i != 0 { |
| 551 | m.write(commaBytes) |
| 552 | } |
| 553 | m.minifyBindingElement(item) |
| 554 | } |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | func (m *jsMinifier) minifyFuncDecl(decl *js.FuncDecl, inExpr bool) { |
| 559 | // TODO: rewrite to arrow function if doe snot refer to this? |
no test coverage detected