(obj *types.Const)
| 764 | } |
| 765 | |
| 766 | func (ts *Typescript) constantDeclaration(obj *types.Const) (*bindings.VariableStatement, error) { |
| 767 | val, err := ts.constantValue(obj) |
| 768 | if err != nil { |
| 769 | return &bindings.VariableStatement{}, err |
| 770 | } |
| 771 | |
| 772 | return &bindings.VariableStatement{ |
| 773 | Modifiers: []bindings.Modifier{}, |
| 774 | Declarations: &bindings.VariableDeclarationList{ |
| 775 | Declarations: []*bindings.VariableDeclaration{ |
| 776 | { |
| 777 | Name: ts.parsed.Identifier(obj), |
| 778 | ExclamationMark: false, |
| 779 | Initializer: val, |
| 780 | }, |
| 781 | }, |
| 782 | Flags: bindings.NodeFlagsConstant, |
| 783 | }, |
| 784 | Source: ts.location(obj), |
| 785 | }, nil |
| 786 | } |
| 787 | |
| 788 | func (ts *Typescript) constantValue(obj *types.Const) (*bindings.LiteralType, error) { |
| 789 | var constValue bindings.LiteralType |
no test coverage detected