Documentation ¶
Index ¶
- Constants
- func SetGlobaIndentor(i Indentor)
- type ArgumentListElement
- type ArrayExpression
- type ArrayExpressionElement
- type ArrayPattern
- type ArrayPatternElement
- type ArrowFunctionExpression
- type AssignmentExpression
- type AssignmentPattern
- type AwaitExpression
- type BinaryExpression
- type BindingIdentifierOrPattern
- type BindingPattern
- type BlockStatement
- type BreakStatement
- type CallExpression
- type CatchClause
- type ChainElement
- type ChainExpression
- type ClassBody
- type ClassDeclaration
- type ClassExpression
- type ClassProperty
- type ComputedMemberExpression
- type ConditionalExpression
- type ContinueStatement
- type DebuggerStatement
- type Declaration
- type Directive
- type DoWhileStatement
- type EmptyStatement
- type ExportAllDeclaration
- type ExportDeclaration
- type ExportDefaultDeclaration
- type ExportNamedDeclaration
- type ExportSpecifier
- type ExportableDefaultDeclaration
- type ExportableNamedDeclaration
- type Expression
- type ExpressionOrImport
- type ExpressionStatement
- type ForInStatement
- type ForOfStatement
- type ForStatement
- type FunctionDeclaration
- type FunctionExpression
- type FunctionParameter
- type FunctionType
- type Generator
- type Identifier
- type IfStatement
- type Import
- type ImportDeclaration
- type ImportDeclarationSpecifier
- type ImportDefaultSpecifier
- type ImportNamespaceSpecifier
- type ImportSpecifier
- type Indentor
- type JSElement
- type LabeledStatement
- type Literal
- type LiteralValueBigFloat
- type LiteralValueBool
- type LiteralValueNumber
- type LiteralValueString
- type LogicalExpression
- type MetaProperty
- type MethodDefinition
- type NamedImport
- type NewExpression
- type Node
- type ObjectExpression
- type ObjectExpressionProperty
- type ObjectPattern
- type ObjectPatternProperty
- type Position
- type Program
- type Property
- type PropertyDefinition
- type PropertyKey
- type PropertyPattern
- type PropertyValue
- type Range
- type RestElement
- type ReturnStatement
- type SequenceExpression
- type SourceLocation
- type Spaces
- type SpreadElement
- type Statement
- type StatementListItem
- type StaticMemberExpression
- type Super
- type SwitchCase
- type SwitchStatement
- type Tabs
- type TaggedTemplateExpression
- type TemplateElement
- type TemplateLiteral
- type ThrowStatement
- type TryStatement
- type UnaryExpression
- type UnaryOperatorType
- type UpdateExpression
- type VariableDeclaration
- type VariableDeclarationType
- type VariableDeclarator
- type WhileStatement
- type WithStatement
- type YieldExpression
Constants ¶
View Source
const ( AssignmentOperatorEq assignmentOperator = "=" AssignmentOperatorPlus assignmentOperator = "+=" AssignmentOperatorMinus assignmentOperator = "-=" AssignmentOperatorTimes assignmentOperator = "*=" AssignmentOperatorDivide assignmentOperator = "/=" AssignmentOperatorMod assignmentOperator = "%=" )
View Source
const ( BinaryOperatorADD binaryOperator = "+" BinaryOperatorMinus binaryOperator = "-" BinaryOperatorMultiply binaryOperator = "*" BinaryOperatorExponent binaryOperator = "*" BinaryOperatorDivide binaryOperator = "/" BinaryOperatorModulus binaryOperator = "%" BinaryOperatorAND binaryOperator = "&" BinaryOperatorOR binaryOperator = "|" BinaryOperatorXOR binaryOperator = "^" BinaryOperatorNOT binaryOperator = "~" BinaryOperatorSHIFTLEFT binaryOperator = "<<" BinaryOperatorSHIFTRIGHT binaryOperator = ">>" BinaryOperatorZEROFILLSHIFTRIGHT binaryOperator = ">>>" )
View Source
const ( LogicalOperatorOr logicalOperator = "||" LogicalOperatorAnd logicalOperator = "&&" LogicalOperatorNullishCoelescing logicalOperator = "??" )
Variables ¶
This section is empty.
Functions ¶
func SetGlobaIndentor ¶
func SetGlobaIndentor(i Indentor)
Types ¶
type ArgumentListElement ¶
type ArgumentListElement interface { JSElement // contains filtered or unexported methods }
type ArrayExpression ¶
type ArrayExpression struct { Elements []ArrayExpressionElement *Node }
Expressions
func (*ArrayExpression) String ¶
func (a *ArrayExpression) String() (s string)
type ArrayExpressionElement ¶
type ArrayExpressionElement interface { JSElement // contains filtered or unexported methods }
type ArrayPattern ¶
type ArrayPattern struct { Elements []ArrayPatternElement *Node }
func (*ArrayPattern) String ¶
func (a *ArrayPattern) String() (s string)
type ArrayPatternElement ¶
type ArrayPatternElement interface { JSElement // contains filtered or unexported methods }
type ArrowFunctionExpression ¶
type ArrowFunctionExpression struct { Params []FunctionParameter Body BlockStatement Async bool *Node }
func (*ArrowFunctionExpression) String ¶
func (a *ArrowFunctionExpression) String() (s string)
type AssignmentExpression ¶
type AssignmentExpression struct { Operator assignmentOperator Left Expression Right Expression *Node }
func (*AssignmentExpression) String ¶
func (a *AssignmentExpression) String() string
type AssignmentPattern ¶
type AssignmentPattern struct { Left BindingIdentifierOrPattern Right Expression }
func (*AssignmentPattern) String ¶
func (a *AssignmentPattern) String() string
type AwaitExpression ¶
type AwaitExpression struct { Arguement Expression *Node }
func (*AwaitExpression) String ¶
func (a *AwaitExpression) String() string
type BinaryExpression ¶
type BinaryExpression struct { Operator binaryOperator Left Expression Right Expression *Node }
func (*BinaryExpression) String ¶
func (b *BinaryExpression) String() string
type BindingIdentifierOrPattern ¶
type BindingIdentifierOrPattern interface { JSElement // contains filtered or unexported methods }
type BindingPattern ¶
type BindingPattern interface { JSElement ExportableDefaultDeclaration BindingIdentifierOrPattern FunctionParameter PropertyValue // contains filtered or unexported methods }
Deconstruction patterns eg. ({one, two}) => ...
type BlockStatement ¶
func (*BlockStatement) String ¶
func (b *BlockStatement) String() string
type BreakStatement ¶
type BreakStatement struct { Label *Identifier *Node }
Statements
func (*BreakStatement) String ¶
func (b *BreakStatement) String() (s string)
type CallExpression ¶
type CallExpression struct { Callee Expression Arguments []ArgumentListElement Optional bool *Node }
func (*CallExpression) String ¶
func (c *CallExpression) String() string
type CatchClause ¶
type CatchClause struct { BindingIdentifierOrPattern Body BlockStatement *Node }
func (CatchClause) String ¶
func (c CatchClause) String() string
type ChainElement ¶
type ChainElement interface { JSElement // contains filtered or unexported methods }
type ChainExpression ¶
type ChainExpression struct { Expression ChainElement *Node }
func (*ChainExpression) String ¶
func (c *ChainExpression) String() (s string)
type ClassBody ¶
type ClassBody struct { Properties []ClassProperty *Node }
type ClassDeclaration ¶
type ClassDeclaration struct { ID *Identifier SuperClass Expression Body *ClassBody *Node }
Declarations
func (*ClassDeclaration) String ¶
func (c *ClassDeclaration) String() (s string)
type ClassExpression ¶
type ClassExpression struct { ID *Identifier SuperClass *Identifier Body *ClassBody *Node }
func (*ClassExpression) String ¶
func (c *ClassExpression) String() (s string)
type ClassProperty ¶
type ClassProperty interface { JSElement // contains filtered or unexported methods }
type ComputedMemberExpression ¶
type ComputedMemberExpression struct { Object Expression Property Expression Optional bool *Node }
func (*ComputedMemberExpression) String ¶
func (c *ComputedMemberExpression) String() string
type ConditionalExpression ¶
type ConditionalExpression struct { Test Expression Consequent Expression Alternate Expression *Node }
func (*ConditionalExpression) String ¶
func (c *ConditionalExpression) String() string
type ContinueStatement ¶
type ContinueStatement struct { Label *Identifier *Node }
func (*ContinueStatement) String ¶
func (c *ContinueStatement) String() (s string)
type DebuggerStatement ¶
type DebuggerStatement struct {
*Node
}
func (*DebuggerStatement) String ¶
func (d *DebuggerStatement) String() string
type Declaration ¶
type Declaration interface { JSElement StatementListItem // contains filtered or unexported methods }
type Directive ¶
type Directive struct { Expression Directive string *Node }
type DoWhileStatement ¶
type DoWhileStatement struct { Body BlockStatement Test Expression *Node }
func (*DoWhileStatement) String ¶
func (d *DoWhileStatement) String() string
type EmptyStatement ¶
type EmptyStatement struct {
*Node
}
func (*EmptyStatement) String ¶
func (e *EmptyStatement) String() string
type ExportAllDeclaration ¶
func (*ExportAllDeclaration) String ¶
func (e *ExportAllDeclaration) String() string
type ExportDeclaration ¶
type ExportDeclaration interface { Declaration // contains filtered or unexported methods }
type ExportDefaultDeclaration ¶
type ExportDefaultDeclaration struct { Declaration ExportableDefaultDeclaration *Node }
func (*ExportDefaultDeclaration) String ¶
func (e *ExportDefaultDeclaration) String() string
type ExportNamedDeclaration ¶
type ExportNamedDeclaration struct { Declaration ExportableNamedDeclaration Specifiers []ExportSpecifier *Node }
func (*ExportNamedDeclaration) String ¶
func (e *ExportNamedDeclaration) String() (s string)
type ExportSpecifier ¶
type ExportSpecifier struct { Exported *Identifier Local *Identifier *Node }
func (ExportSpecifier) String ¶
func (e ExportSpecifier) String() (s string)
type ExportableDefaultDeclaration ¶
type ExportableDefaultDeclaration interface { JSElement // contains filtered or unexported methods }
type ExportableNamedDeclaration ¶
type ExportableNamedDeclaration interface { JSElement // contains filtered or unexported methods }
type Expression ¶
type Expression interface { JSElement ExportableDefaultDeclaration ArgumentListElement ArrayExpressionElement ExpressionOrImport // contains filtered or unexported methods }
type ExpressionOrImport ¶
type ExpressionOrImport interface { JSElement // contains filtered or unexported methods }
type ExpressionStatement ¶
type ExpressionStatement struct { Expression *Node }
func (*ExpressionStatement) String ¶
func (e *ExpressionStatement) String() string
type ForInStatement ¶
type ForInStatement struct { Left Expression Right Expression Body BlockStatement Each bool *Node }
func (*ForInStatement) String ¶
func (f *ForInStatement) String() string
type ForOfStatement ¶
type ForOfStatement struct { Await bool Left Expression Right Expression Body BlockStatement *Node }
func (*ForOfStatement) String ¶
func (f *ForOfStatement) String() (s string)
type ForStatement ¶
type ForStatement struct { Init Expression Test Expression Update Expression Body BlockStatement *Node }
func (*ForStatement) String ¶
func (f *ForStatement) String() string
type FunctionDeclaration ¶
type FunctionDeclaration struct { ID *Identifier Params []FunctionParameter Body BlockStatement FunctionType *Node }
func (*FunctionDeclaration) String ¶
func (f *FunctionDeclaration) String() (s string)
type FunctionExpression ¶
type FunctionExpression struct { ID *Identifier Params []FunctionParameter Body BlockStatement FunctionType *Node }
func (*FunctionExpression) String ¶
func (f *FunctionExpression) String() (s string)
type FunctionParameter ¶
type FunctionParameter interface { JSElement // contains filtered or unexported methods }
type FunctionType ¶
type FunctionType string
const ( FunctionTypeNormal FunctionType = "normal" FunctionTypeAsync FunctionType = "async" FunctionTypeGenerator FunctionType = "generator" )
type Generator ¶
type Generator struct { ModuleName string Statements []StatementListItem }
func NewGenerator ¶
func NewGenerator() *Generator
func (*Generator) AddStatement ¶
func (g *Generator) AddStatement(s StatementListItem) *Generator
func (*Generator) AddStatements ¶
func (g *Generator) AddStatements(ss ...StatementListItem) *Generator
type Identifier ¶
func (*Identifier) String ¶
func (i *Identifier) String() string
type IfStatement ¶
type IfStatement struct { Test Expression Consequent Statement Alternate Statement *Node }
func (*IfStatement) String ¶
func (f *IfStatement) String() (s string)
type ImportDeclaration ¶
type ImportDeclaration struct { Specifiers []ImportDeclarationSpecifier Source string *Node }
func (*ImportDeclaration) String ¶
func (i *ImportDeclaration) String() (s string)
type ImportDeclarationSpecifier ¶
type ImportDeclarationSpecifier interface { JSElement // contains filtered or unexported methods }
type ImportDefaultSpecifier ¶
type ImportDefaultSpecifier struct { Local *Identifier *Node }
Imports
func (*ImportDefaultSpecifier) String ¶
func (i *ImportDefaultSpecifier) String() string
type ImportNamespaceSpecifier ¶
type ImportNamespaceSpecifier struct { Local *Identifier *Node }
func (*ImportNamespaceSpecifier) String ¶
func (i *ImportNamespaceSpecifier) String() string
type ImportSpecifier ¶
type ImportSpecifier struct { NamedImports []NamedImport *Node }
func (ImportSpecifier) String ¶
func (i ImportSpecifier) String() (s string)
type LabeledStatement ¶
type LabeledStatement struct { Label Identifier Body Statement *Node }
type Literal ¶
type Literal interface { JSElement PropertyKey ArgumentListElement ArrayExpressionElement Expression ExpressionOrImport ExportableDefaultDeclaration // contains filtered or unexported methods }
var ( // LiteralValues LiteralValueUndefined Literal = &literalValueUndefined{} LiteralValueNull Literal = &literalValueNull{} )
Compiler checks
func NumberLiteral ¶
func NumberLiteral(n interface{}) Literal
type LiteralValueBigFloat ¶
func (*LiteralValueBigFloat) String ¶
func (l *LiteralValueBigFloat) String() string
type LiteralValueBool ¶
type LiteralValueBool bool
func BoolLiteral ¶
func BoolLiteral(b bool) *LiteralValueBool
func (*LiteralValueBool) String ¶
func (l *LiteralValueBool) String() string
type LiteralValueNumber ¶
type LiteralValueNumber float64
func (*LiteralValueNumber) String ¶
func (l *LiteralValueNumber) String() string
type LiteralValueString ¶
type LiteralValueString string
func StringLiteral ¶
func StringLiteral(s string) *LiteralValueString
func (*LiteralValueString) String ¶
func (l *LiteralValueString) String() string
type LogicalExpression ¶
type LogicalExpression struct { Operator logicalOperator Left Expression Right Expression *Node }
func (*LogicalExpression) String ¶
func (l *LogicalExpression) String() string
type MetaProperty ¶
type MetaProperty struct { Meta Identifier Property Identifier *Node }
type MethodDefinition ¶
type MethodDefinition struct { Static bool Key PropertyKey Value FunctionExpression *Node }
func (*MethodDefinition) String ¶
func (m *MethodDefinition) String() (s string)
type NamedImport ¶
type NamedImport struct { Local *Identifier Imported *Identifier *Node }
func (NamedImport) String ¶
func (n NamedImport) String() (s string)
type NewExpression ¶
type NewExpression struct { Callee Expression Arguments []ArgumentListElement *Node }
func (*NewExpression) String ¶
func (n *NewExpression) String() string
type Node ¶
type Node struct { Location *SourceLocation *Range }
type ObjectExpression ¶
type ObjectExpression struct { Properties []ObjectExpressionProperty *Node }
func (*ObjectExpression) String ¶
func (o *ObjectExpression) String() string
type ObjectExpressionProperty ¶
type ObjectExpressionProperty interface { JSElement // contains filtered or unexported methods }
type ObjectPattern ¶
type ObjectPattern struct { Properties []ObjectPatternProperty *Node }
func (*ObjectPattern) String ¶
func (o *ObjectPattern) String() (s string)
type ObjectPatternProperty ¶
type ObjectPatternProperty interface { JSElement // contains filtered or unexported methods }
type Program ¶
type Program struct { Name string Body []StatementListItem *Range }
type Property ¶
type Property struct { Key PropertyKey Value Expression Kind string Method bool ShortHand bool *Node }
type PropertyDefinition ¶
type PropertyDefinition struct { Static bool Key PropertyKey Value Expression *Node }
func (*PropertyDefinition) String ¶
func (p *PropertyDefinition) String() (s string)
type PropertyKey ¶
type PropertyKey interface { JSElement // contains filtered or unexported methods }
type PropertyPattern ¶
type PropertyPattern struct { Key PropertyKey Computed bool Value PropertyValue Kind string Method bool ShortHand bool *Node }
func (*PropertyPattern) String ¶
func (p *PropertyPattern) String() (s string)
type PropertyValue ¶
type PropertyValue interface { JSElement // contains filtered or unexported methods }
type RestElement ¶
type RestElement struct { Argument BindingIdentifierOrPattern *Node }
misc
func (*RestElement) String ¶
func (r *RestElement) String() string
type ReturnStatement ¶
type ReturnStatement struct { Argument Expression *Node }
func (*ReturnStatement) String ¶
func (r *ReturnStatement) String() (s string)
type SequenceExpression ¶
type SequenceExpression struct { Expressions []Expression *Node }
func (*SequenceExpression) String ¶
func (s *SequenceExpression) String() string
type SourceLocation ¶
type SpreadElement ¶
type SpreadElement struct { Argument Expression *Node }
func (*SpreadElement) String ¶
func (s *SpreadElement) String() string
type StatementListItem ¶
type StatementListItem interface { JSElement // contains filtered or unexported methods }
type StaticMemberExpression ¶
type StaticMemberExpression struct { Object Expression Property Expression *Node }
func (*StaticMemberExpression) String ¶
func (s *StaticMemberExpression) String() string
type SwitchCase ¶
type SwitchCase struct { Test Expression Consequent BlockStatement }
func (SwitchCase) String ¶
func (s SwitchCase) String() string
type SwitchStatement ¶
type SwitchStatement struct { Discriminant Expression Cases []SwitchCase *Node }
func (*SwitchStatement) String ¶
func (r *SwitchStatement) String() string
type TaggedTemplateExpression ¶
type TaggedTemplateExpression struct { Tag Expression Quasi TemplateLiteral *Node }
func (*TaggedTemplateExpression) String ¶
func (t *TaggedTemplateExpression) String() string
type TemplateElement ¶
type TemplateElement struct { }
type TemplateLiteral ¶
type TemplateLiteral struct { Quasis []TemplateElement Expressions []Expression *Node }
type ThrowStatement ¶
type ThrowStatement struct { Argument Expression *Node }
func (*ThrowStatement) String ¶
func (t *ThrowStatement) String() string
type TryStatement ¶
type TryStatement struct { Block BlockStatement Handler CatchClause Finalizer *BlockStatement *Node }
func (*TryStatement) String ¶
func (t *TryStatement) String() (s string)
type UnaryExpression ¶
type UnaryExpression struct { Operator UnaryOperatorType Argument Expression *Node }
func (*UnaryExpression) String ¶
func (u *UnaryExpression) String() string
type UnaryOperatorType ¶
type UnaryOperatorType string
const ( UnaryOperatorTypePlus UnaryOperatorType = "+%s" UnaryOperatorTypeMinus UnaryOperatorType = "-%s" UnaryOperatorTypeIncrementPrefix UnaryOperatorType = "++%s" UnaryOperatorTypeIncrementPostfix UnaryOperatorType = "%s++" UnaryOperatorTypeDecrementPrefix UnaryOperatorType = "--%s" UnaryOperatorTypeDecrementPostfix UnaryOperatorType = "%s--" )
type UpdateExpression ¶
type UpdateExpression struct { Argument Expression *Node }
func (*UpdateExpression) String ¶
func (u *UpdateExpression) String() string
type VariableDeclaration ¶
type VariableDeclaration struct { Declarations []VariableDeclarator Kind VariableDeclarationType *Node }
func (*VariableDeclaration) String ¶
func (v *VariableDeclaration) String() (s string)
type VariableDeclarationType ¶
type VariableDeclarationType string
const ( VariableDeclarationTypeConst VariableDeclarationType = "const" VariableDeclarationTypeLet VariableDeclarationType = "let" VariableDeclarationTypeVar VariableDeclarationType = "var" )
type VariableDeclarator ¶
type VariableDeclarator struct { ID BindingIdentifierOrPattern Init Expression }
type WhileStatement ¶
type WhileStatement struct { Test Expression Body Statement *Node }
func (*WhileStatement) String ¶
func (w *WhileStatement) String() string
type WithStatement ¶
type WithStatement struct { Object Expression Body Statement *Node }
func (*WithStatement) String ¶
func (w *WithStatement) String() string
type YieldExpression ¶
type YieldExpression struct { Argument Expression Delegate bool *Node }
func (*YieldExpression) String ¶
func (y *YieldExpression) String() (s string)
Click to show internal directories.
Click to hide internal directories.