(decl *VariableDeclaration)
| 593 | } |
| 594 | |
| 595 | func (b *Bindings) VariableDeclaration(decl *VariableDeclaration) (*goja.Object, error) { |
| 596 | aliasFunc, err := b.f("variableDeclaration") |
| 597 | if err != nil { |
| 598 | return nil, err |
| 599 | } |
| 600 | |
| 601 | var declType goja.Value = goja.Undefined() |
| 602 | if decl.Type != nil { |
| 603 | declType, err = b.ToTypescriptNode(decl.Type) |
| 604 | if err != nil { |
| 605 | return nil, fmt.Errorf("alias type: %w", err) |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | var declInit goja.Value = goja.Undefined() |
| 610 | if decl.Initializer != nil { |
| 611 | declInit, err = b.ToTypescriptNode(decl.Initializer) |
| 612 | if err != nil { |
| 613 | return nil, fmt.Errorf("alias type: %w", err) |
| 614 | } |
| 615 | } |
| 616 | |
| 617 | res, err := aliasFunc( |
| 618 | goja.Undefined(), |
| 619 | b.vm.ToValue(decl.Name.Ref()), |
| 620 | b.vm.ToValue(decl.ExclamationMark), |
| 621 | declType, |
| 622 | declInit, |
| 623 | ) |
| 624 | if err != nil { |
| 625 | return nil, xerrors.Errorf("call variableDeclaration: %w", err) |
| 626 | } |
| 627 | |
| 628 | return res.ToObject(b.vm), nil |
| 629 | } |
| 630 | |
| 631 | func (b *Bindings) OperatorNode(value *OperatorNodeType) (*goja.Object, error) { |
| 632 | literalF, err := b.f("typeOperatorNode") |
no test coverage detected