jsast

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2019 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyString = CreateString("")
	True        = CreateBoolean(true)
	False       = CreateBoolean(false)
	Zero        = CreateInt(0)
	Null        = CreateNull()
)

Singletons.

Functions

func Assemble

func Assemble(p Program) (result string, err error)

Assemble JS from the AST

Types

type ArrayExpression

type ArrayExpression struct {
	Type     string        `json:"type,omitempty"`
	Elements []IExpression `json:"elements,omitempty"`
}

ArrayExpression struct

func CreateArrayExpression

func CreateArrayExpression(elements ...IExpression) ArrayExpression

CreateArrayExpression fn

func (ArrayExpression) Expression

func (n ArrayExpression) Expression() Expression

Expression fn

func (ArrayExpression) Node

func (n ArrayExpression) Node() Node

Node fn

func (ArrayExpression) String

func (n ArrayExpression) String() string

String fn

type AssignmentExpression

type AssignmentExpression struct {
	Type     string             `json:"type,omitempty"`
	Operator AssignmentOperator `json:"operator,omitempty"`
	Left     interface{}        `json:"left,omitempty"` // Pattern | Expression
	Right    IExpression        `json:"right,omitempty"`
}

AssignmentExpression struct

func CreateAssignmentExpression

func CreateAssignmentExpression(left interface{}, operator AssignmentOperator, right IExpression) AssignmentExpression

CreateAssignmentExpression fn

func (AssignmentExpression) Expression

func (n AssignmentExpression) Expression() Expression

Expression fn

func (AssignmentExpression) Node

func (n AssignmentExpression) Node() Node

Node fn

func (AssignmentExpression) String

func (n AssignmentExpression) String() string

String fn

type AssignmentOperator

type AssignmentOperator string

AssignmentOperator enum

"=" | "+=" | "-=" | "*=" | "/=" | "%="

| "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&="

type AwaitExpression

type AwaitExpression struct {
	Type     string      `json:"type,omitempty"`
	Argument IExpression `json:"argument,omitempty"`
}

AwaitExpression struct

func CreateAwaitExpression

func CreateAwaitExpression(argument IExpression) AwaitExpression

CreateAwaitExpression fn

func (AwaitExpression) Expression

func (n AwaitExpression) Expression() Expression

Expression fn

func (AwaitExpression) Node

func (n AwaitExpression) Node() Node

Node fn

func (AwaitExpression) String

func (n AwaitExpression) String() string

String fn

type BinaryExpression

type BinaryExpression struct {
	Type     string         `json:"type,omitempty"`
	Operator BinaryOperator `json:"operator,omitempty"`
	Left     IExpression    `json:"left,omitempty"`
	Right    IExpression    `json:"right,omitempty"`
}

BinaryExpression struct

func CreateBinaryExpression

func CreateBinaryExpression(l IExpression, op BinaryOperator, r IExpression) BinaryExpression

CreateBinaryExpression fn

func (BinaryExpression) Expression

func (n BinaryExpression) Expression() Expression

Expression fn

func (BinaryExpression) Node

func (n BinaryExpression) Node() Node

Node fn

func (BinaryExpression) String

func (n BinaryExpression) String() string

String fn

type BinaryOperator

type BinaryOperator string

BinaryOperator enum "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "in" | "instanceof"

func (BinaryOperator) String

func (n BinaryOperator) String() string

String fn

type BlockStatement

type BlockStatement struct {
	Type string `json:"type,omitempty"`

	// [ Directive | Statement ]
	//
	// TODO: this is non-standard, but it doesn't
	// make sense that a FunctionBody is a
	// BlockStatement but the FunctionBody
	// can contain a DirectiveType while
	// the BlockStatement cannot
	Body []interface{} `json:"body,omitempty"`
}

BlockStatement struct

func CreateBlockStatement

func CreateBlockStatement(body ...IStatement) BlockStatement

CreateBlockStatement fn

func (BlockStatement) BlockStatement

func (n BlockStatement) BlockStatement() BlockStatement

BlockStatement fn

func (BlockStatement) Node

func (n BlockStatement) Node() Node

Node fn

func (BlockStatement) Statement

func (n BlockStatement) Statement() Statement

Statement fn

func (BlockStatement) String

func (n BlockStatement) String() string

String fn

type BreakStatement

type BreakStatement struct {
	Type  string      `json:"type,omitempty"`
	Label *Identifier `json:"label,omitempty"`
}

BreakStatement struct

func CreateBreakStatement

func CreateBreakStatement(label *Identifier) BreakStatement

CreateBreakStatement fn

func (BreakStatement) Node

func (n BreakStatement) Node() Node

Node fn

func (BreakStatement) Statement

func (n BreakStatement) Statement() Statement

Statement fn

func (BreakStatement) String

func (n BreakStatement) String() string

String fn

type CallExpression

type CallExpression struct {
	Type      string        `json:"type,omitempty"`
	Callee    IExpression   `json:"callee,omitempty"`
	Arguments []IExpression `json:"arguments,omitempty"`
}

CallExpression struct

A function or method call expression.

func CreateCallExpression

func CreateCallExpression(callee IExpression, arguments []IExpression) CallExpression

CreateCallExpression fn

func (CallExpression) Expression

func (n CallExpression) Expression() Expression

Expression fn

func (CallExpression) Node

func (n CallExpression) Node() Node

Node fn

func (CallExpression) String

func (n CallExpression) String() string

String fn

type CatchClause

type CatchClause struct {
	Type  string          `json:"type,omitempty"`
	Param IPattern        `json:"param,omitempty"`
	Body  IBlockStatement `json:"body,omitempty"`
}

CatchClause struct

func (CatchClause) Node

func (n CatchClause) Node() Node

Node fn

type ConditionalExpression

type ConditionalExpression struct {
	Type       string      `json:"type,omitempty"`
	Test       IExpression `json:"test,omitempty"`
	Alternate  IExpression `json:"alternate,omitempty"`
	Consequent IExpression `json:"consequent,omitempty"`
}

ConditionalExpression struct

A conditional expression, i.e., a ternary ?/: expression.

func (ConditionalExpression) Expression

func (n ConditionalExpression) Expression() Expression

Expression fn

func (ConditionalExpression) Node

func (n ConditionalExpression) Node() Node

Node fn

type ContinueStatement

type ContinueStatement struct {
	Type  string      `json:"type,omitempty"`
	Label *Identifier `json:"label,omitempty"`
}

ContinueStatement struct

func (ContinueStatement) Node

func (n ContinueStatement) Node() Node

Node fn

func (ContinueStatement) Statement

func (n ContinueStatement) Statement() Statement

Statement fn

type DebuggerStatement

type DebuggerStatement struct {
	Type string `json:"type,omitempty"`
}

DebuggerStatement struct

func (DebuggerStatement) Node

func (n DebuggerStatement) Node() Node

Node fn

func (DebuggerStatement) Statement

func (n DebuggerStatement) Statement() Statement

Statement fn

type Declaration

type Declaration struct {
	Type string `json:"type,omitempty"`
}

Declaration struct

func (Declaration) Declaration

func (n Declaration) Declaration() Declaration

Declaration fn

func (Declaration) Node

func (n Declaration) Node() Node

Node fn

func (Declaration) Statement

func (n Declaration) Statement() Statement

Statement fn

type Directive

type Directive struct {
	Type       string      `json:"type,omitempty"`
	Expression IExpression `json:"expression,omitempty"`
	Directive  string      `json:"directive,omitempty"`
}

Directive struct

func (Directive) ExpressionStatement

func (n Directive) ExpressionStatement() ExpressionStatement

ExpressionStatement fn

func (Directive) Node

func (n Directive) Node() Node

Node fn

func (Directive) Statement

func (n Directive) Statement() Statement

Statement fn

type DoWhileStatement

type DoWhileStatement struct {
	Type string      `json:"type,omitempty"`
	Body IStatement  `json:"body,omitempty"`
	Test IExpression `json:"test,omitempty"`
}

DoWhileStatement struct

func (DoWhileStatement) Node

func (n DoWhileStatement) Node() Node

Node fn

func (DoWhileStatement) Statement

func (n DoWhileStatement) Statement() Statement

Statement fn

type EmptyStatement

type EmptyStatement struct {
	Type string `json:"type,omitempty"`
}

EmptyStatement struct

func CreateEmptyStatement

func CreateEmptyStatement() EmptyStatement

CreateEmptyStatement fn

func (EmptyStatement) Node

func (n EmptyStatement) Node() Node

Node fn

func (EmptyStatement) Statement

func (n EmptyStatement) Statement() Statement

Statement fn

func (EmptyStatement) String

func (n EmptyStatement) String() string

String fn

type Expression

type Expression struct {
	Type string
}

Expression struct

func (Expression) Expression

func (n Expression) Expression() Expression

Expression fn

func (Expression) Node

func (n Expression) Node() Node

Node fn

type ExpressionStatement

type ExpressionStatement struct {
	Type       string      `json:"type,omitempty"`
	Expression IExpression `json:"expression,omitempty"`
}

ExpressionStatement struct

func CreateExpressionStatement

func CreateExpressionStatement(expression IExpression) ExpressionStatement

CreateExpressionStatement fn

func (ExpressionStatement) ExpressionStatement

func (n ExpressionStatement) ExpressionStatement() ExpressionStatement

ExpressionStatement fn

func (ExpressionStatement) Node

func (n ExpressionStatement) Node() Node

Node fn

func (ExpressionStatement) Statement

func (n ExpressionStatement) Statement() Statement

Statement fn

func (ExpressionStatement) String

func (n ExpressionStatement) String() string

String fn

type ForInStatement

type ForInStatement struct {
	Type  string      `json:"type,omitempty"`
	Left  interface{} `json:"left,omitempty"` // VariableDeclaration |  Pattern
	Right IExpression `json:"right,omitempty"`
	Body  IStatement  `json:"body,omitempty"`
}

ForInStatement struct

func CreateForInStatement

func CreateForInStatement(left interface{}, right IExpression, body IStatement) ForInStatement

CreateForInStatement fn

func (ForInStatement) Node

func (n ForInStatement) Node() Node

Node fn

func (ForInStatement) Statement

func (n ForInStatement) Statement() Statement

Statement fn

func (ForInStatement) String

func (n ForInStatement) String() string

String fn

type ForStatement

type ForStatement struct {
	Type   string      `json:"type,omitempty"`
	Init   interface{} `json:"init,omitempty"` //  VariableDeclaration | Expression | null
	Test   IExpression `json:"test,omitempty"`
	Update IExpression `json:"update,omitempty"`
	Body   IStatement  `json:"body,omitempty"`
}

ForStatement struct

func CreateForStatement

func CreateForStatement(init interface{}, test IExpression, update IExpression, body IStatement) ForStatement

CreateForStatement fn

func (ForStatement) Node

func (n ForStatement) Node() Node

Node fn

func (ForStatement) Statement

func (n ForStatement) Statement() Statement

Statement fn

func (ForStatement) String

func (n ForStatement) String() string

String fn

type Function

type Function struct {
	Type   string
	ID     *Identifier  `json:"id,omitempty"`
	Params []IPattern   `json:"params,omitempty"`
	Body   FunctionBody `json:"body,omitempty"`
}

Function struct

func (Function) Function

func (n Function) Function() Function

Function fn

func (Function) Node

func (n Function) Node() Node

Node fn

type FunctionBody

type FunctionBody struct {
	Type string `json:"type,omitempty"`

	// [ Directive | Statement ]
	Body []interface{} `json:"body,omitempty"`
}

FunctionBody struct

func CreateFunctionBody

func CreateFunctionBody(body ...interface{}) FunctionBody

CreateFunctionBody fn

func (FunctionBody) BlockStatement

func (n FunctionBody) BlockStatement() BlockStatement

BlockStatement fn

func (FunctionBody) Node

func (n FunctionBody) Node() Node

Node fn

func (FunctionBody) Statement

func (n FunctionBody) Statement() Statement

Statement fn

func (FunctionBody) String

func (n FunctionBody) String() string

String fn

type FunctionDeclaration

type FunctionDeclaration struct {
	Type      string      `json:"type,omitempty"`
	ID        *Identifier `json:"id,omitempty"`
	Params    []IPattern
	Body      FunctionBody
	Generator bool
	Async     bool
}

FunctionDeclaration struct

func CreateAsyncFunction

func CreateAsyncFunction(id *Identifier, params []IPattern, body FunctionBody) FunctionDeclaration

CreateAsyncFunction fn

func CreateFunction

func CreateFunction(id *Identifier, params []IPattern, body FunctionBody) FunctionDeclaration

CreateFunction fn

func CreateGeneratorFunction

func CreateGeneratorFunction(id *Identifier, params []IPattern, body FunctionBody) FunctionDeclaration

CreateGeneratorFunction fn

func (FunctionDeclaration) Declaration

func (n FunctionDeclaration) Declaration() Declaration

Declaration fn

func (FunctionDeclaration) Function

func (n FunctionDeclaration) Function() Function

Function fn

func (FunctionDeclaration) Node

func (n FunctionDeclaration) Node() Node

Node fn

func (FunctionDeclaration) Statement

func (n FunctionDeclaration) Statement() Statement

Statement fn

func (FunctionDeclaration) String

func (n FunctionDeclaration) String() string

String fn

type FunctionExpression

type FunctionExpression struct {
	Type      string `json:"type,omitempty"`
	ID        *Identifier
	Params    []IPattern
	Body      FunctionBody
	Async     bool
	Generator bool
}

FunctionExpression struct

func CreateAsyncFunctionExpression

func CreateAsyncFunctionExpression(id *Identifier, params []IPattern, body FunctionBody) FunctionExpression

CreateAsyncFunctionExpression fn

func CreateFunctionExpression

func CreateFunctionExpression(id *Identifier, params []IPattern, body FunctionBody) FunctionExpression

CreateFunctionExpression fn

func CreateGeneratorFunctionExpression

func CreateGeneratorFunctionExpression(id *Identifier, params []IPattern, body FunctionBody) FunctionExpression

CreateGeneratorFunctionExpression fn

func (FunctionExpression) Expression

func (n FunctionExpression) Expression() Expression

Expression fn

func (FunctionExpression) Function

func (n FunctionExpression) Function() Function

Function fn

func (FunctionExpression) Node

func (n FunctionExpression) Node() Node

Node fn

func (FunctionExpression) String

func (n FunctionExpression) String() string

String fn

type IBlockStatement

type IBlockStatement interface {
	IStatement
	BlockStatement() BlockStatement
}

IBlockStatement interface

type IDeclaration

type IDeclaration interface {
	IStatement
	Declaration() Declaration
}

IDeclaration interface

type IExpression

type IExpression interface {
	INode
	Expression() Expression
}

IExpression interface

type IExpressionStatement

type IExpressionStatement interface {
	IStatement
	ExpressionStatement() ExpressionStatement
}

IExpressionStatement interface

type IFunction

type IFunction interface {
	INode
	Function() Function
}

IFunction interface

type ILiteral

type ILiteral interface {
	IExpression
	Literal() Literal
}

ILiteral interface

type INode

type INode interface {
	Node() Node
}

INode interface

type IPattern

type IPattern interface {
	INode
	Pattern() Pattern
}

IPattern interface

type IStatement

type IStatement interface {
	INode
	Statement() Statement
}

IStatement interface

func CreateMultiStatement

func CreateMultiStatement(statements ...IStatement) IStatement

CreateMultiStatement fn

type Identifier

type Identifier struct {
	Type string `json:"type,omitempty"`
	Name string `json:"name,omitempty"`
}

Identifier struct

func CreateIdentifier

func CreateIdentifier(name string) Identifier

CreateIdentifier fn

func (Identifier) Expression

func (n Identifier) Expression() Expression

Expression fn

func (Identifier) Node

func (n Identifier) Node() Node

Node fn

func (Identifier) Pattern

func (n Identifier) Pattern() Pattern

Pattern fn

func (Identifier) String

func (n Identifier) String() string

String fn

type IfStatement

type IfStatement struct {
	Type       string      `json:"type,omitempty"`
	Test       IExpression `json:"test,omitempty"`
	Consequent IStatement  `json:"consequent,omitempty"`
	Alternate  IStatement  `json:"alternate,omitempty"`
}

IfStatement struct

func CreateIfStatement

func CreateIfStatement(test IExpression, consequent IStatement, alternate IStatement) IfStatement

CreateIfStatement fn

func (IfStatement) Node

func (n IfStatement) Node() Node

Node fn

func (IfStatement) Statement

func (n IfStatement) Statement() Statement

Statement fn

func (IfStatement) String

func (n IfStatement) String() string

String fn

type LabeledStatement

type LabeledStatement struct {
	Type  string     `json:"type,omitempty"`
	Label Identifier `json:"label,omitempty"`
	Body  IStatement `json:"body,omitempty"`
}

LabeledStatement struct

func (LabeledStatement) Node

func (n LabeledStatement) Node() Node

Node fn

func (LabeledStatement) Statement

func (n LabeledStatement) Statement() Statement

Statement fn

type Literal

type Literal struct {
	Type  string      `json:"type,omitempty"`
	Value interface{} `json:"value,omitempty"` // string | boolean | null | number | RegExp;
}

Literal struct

func CreateBoolean

func CreateBoolean(value bool) Literal

CreateBoolean fn

func CreateFloat

func CreateFloat(n float32) Literal

CreateFloat fn

func CreateInt

func CreateInt(n int) Literal

CreateInt fn

func CreateLiteral

func CreateLiteral(value string) Literal

CreateLiteral fn

func CreateNull

func CreateNull() Literal

CreateNull fn

func CreateString

func CreateString(value string) Literal

CreateString fn

func (Literal) Expression

func (n Literal) Expression() Expression

Expression fn

func (Literal) Literal

func (n Literal) Literal() Literal

Literal fn

func (Literal) Node

func (n Literal) Node() Node

Node fn

func (Literal) String

func (n Literal) String() string

String fn

type LogicalExpression

type LogicalExpression struct {
	Type     string          `json:"type,omitempty"`
	Operator LogicalOperator `json:"operator,omitempty"`
	Left     IExpression     `json:"left,omitempty"`
	Right    IExpression     `json:"right,omitempty"`
}

LogicalExpression struct

func CreateLogicalExpression

func CreateLogicalExpression(left IExpression, operator LogicalOperator, right IExpression) LogicalExpression

CreateLogicalExpression fn

func (LogicalExpression) Expression

func (n LogicalExpression) Expression() Expression

Expression fn

func (LogicalExpression) Node

func (n LogicalExpression) Node() Node

Node fn

func (LogicalExpression) String

func (n LogicalExpression) String() string

String fn

type LogicalOperator

type LogicalOperator string

LogicalOperator struct "||" | "&&"

type MemberExpression

type MemberExpression struct {
	Type     string      `json:"type,omitempty"`
	Object   IExpression `json:"object,omitempty"`
	Property IExpression `json:"property,omitempty"`
	Computed bool        `json:"computed,omitempty"`
}

MemberExpression struct

A member expression. If computed is true, the node corresponds to a computed (a[b]) member expression and property is an Expression. If computed is false, the node corresponds to a static (a.b) member expression and property is an Identifier.

func CreateMemberExpression

func CreateMemberExpression(object IExpression, property IExpression, computed bool) MemberExpression

CreateMemberExpression fn

func (MemberExpression) Expression

func (n MemberExpression) Expression() Expression

Expression fn

func (MemberExpression) Node

func (n MemberExpression) Node() Node

Node fn

func (MemberExpression) Pattern

func (n MemberExpression) Pattern() Pattern

Pattern fn

func (MemberExpression) String

func (n MemberExpression) String() string

String fn

type MultiStatement

type MultiStatement struct {
	Type       string `json:"type,omitempty"`
	Statements []IStatement
}

MultiStatement struct

func (MultiStatement) Node

func (n MultiStatement) Node() Node

Node fn

func (MultiStatement) Statement

func (n MultiStatement) Statement() Statement

Statement fn

func (MultiStatement) String

func (n MultiStatement) String() string

String fn

type NewExpression

type NewExpression struct {
	Type      string        `json:"type,omitempty"`
	Callee    IExpression   `json:"callee,omitempty"`
	Arguments []IExpression `json:"arguments,omitempty"`
}

NewExpression struct

A `new` expression.

func CreateNewExpression

func CreateNewExpression(callee IExpression, arguments []IExpression) NewExpression

CreateNewExpression fn

func (NewExpression) Expression

func (n NewExpression) Expression() Expression

Expression fn

func (NewExpression) Node

func (n NewExpression) Node() Node

Node fn

func (NewExpression) String

func (n NewExpression) String() string

String fn

type Node

type Node struct {
	Type string          `json:"type,omitempty"`
	Loc  *SourceLocation `json:"loc,omitempty"`
}

Node struct

func (Node) Node

func (n Node) Node() Node

Node fn

type ObjectExpression

type ObjectExpression struct {
	Type       string     `json:"type,omitempty"`
	Properties []Property `json:"properties,omitempty"`
}

ObjectExpression struct

func CreateObjectExpression

func CreateObjectExpression(properties []Property) ObjectExpression

CreateObjectExpression fn

func (ObjectExpression) Expression

func (n ObjectExpression) Expression() Expression

Expression fn

func (ObjectExpression) Node

func (n ObjectExpression) Node() Node

Node fn

func (ObjectExpression) String

func (n ObjectExpression) String() string

String fn

type Pattern

type Pattern struct {
	Type string
}

Pattern struct

Destructuring binding and assignment are not part of ES5, but all binding positions accept Pattern to allow for destructuring in ES6. Nevertheless, for ES5, the only Pattern subtype is Identifier.

func (Pattern) Node

func (n Pattern) Node() Node

Node fn

func (Pattern) Pattern

func (n Pattern) Pattern() Pattern

Pattern fn

type Position

type Position struct {
	Line   uint `json:"line,omitempty"`
	Column uint `json:"column,omitempty"`
}

Position struct

type Program

type Program struct {
	Type string `json:"type,omitempty"`

	// [ Directive | Statement ]
	Body []interface{} `json:"body,omitempty"`
}

Program struct

func CreateProgram

func CreateProgram(body ...interface{}) Program

CreateProgram fn

func (Program) Node

func (n Program) Node() Node

Node fn

func (Program) String

func (n Program) String() string

String fn

type Property

type Property struct {
	Type  string      `json:"type,omitempty"`
	Key   interface{} `json:"key,omitempty"` // Literal | Identifier
	Value IExpression `json:"value,omitempty"`
	Kind  string      `json:"kind,omitempty"` // "init" | "get" | "set"
}

Property struct

func CreateProperty

func CreateProperty(key interface{}, value IExpression, kind string) Property

CreateProperty fn

func (Property) Node

func (n Property) Node() Node

Node fn

type Raw

type Raw struct {
	Type   string `json:"type,omitempty"`
	Source string
}

Raw extension for js strings

func CreateRaw

func CreateRaw(source string) Raw

CreateRaw fn

func (Raw) Expression

func (n Raw) Expression() Expression

Expression fn

func (Raw) Node

func (n Raw) Node() Node

Node fn

func (Raw) Statement

func (n Raw) Statement() Statement

Statement fn

func (Raw) String

func (n Raw) String() string

String fn

type RegExpLiteral

type RegExpLiteral struct {
	Type  string      `json:"type,omitempty"`
	Value interface{} `json:"value,omitempty"` // string | boolean | null | number | RegExp;
	Regex struct {
		Pattern string `json:"pattern,omitempty"`
		Flags   string `json:"flags,omitempty"`
	} `json:"regex,omitempty"`
}

RegExpLiteral struct

func CreateRegex

func CreateRegex(pattern string, flags []string) RegExpLiteral

CreateRegex fn

func (RegExpLiteral) Expression

func (n RegExpLiteral) Expression() Expression

Expression fn

func (RegExpLiteral) Literal

func (n RegExpLiteral) Literal() Literal

Literal fn

func (RegExpLiteral) Node

func (n RegExpLiteral) Node() Node

Node fn

func (RegExpLiteral) String

func (n RegExpLiteral) String() string

String fn

type ReturnStatement

type ReturnStatement struct {
	Type     string      `json:"type,omitempty"`
	Argument IExpression `json:"argument,omitempty"`
}

ReturnStatement struct

func CreateReturnStatement

func CreateReturnStatement(argument IExpression) ReturnStatement

CreateReturnStatement fn

func (ReturnStatement) Node

func (n ReturnStatement) Node() Node

Node fn

func (ReturnStatement) Statement

func (n ReturnStatement) Statement() Statement

Statement fn

func (ReturnStatement) String

func (n ReturnStatement) String() string

String fn

type SequenceExpression

type SequenceExpression struct {
	Type        string        `json:"type,omitempty"`
	Expressions []IExpression `json:"expressions,omitempty"`
}

SequenceExpression struct

A sequence expression, i.e., a comma-separated sequence of expressions.

func CreateSequenceExpression

func CreateSequenceExpression(expressions ...IExpression) SequenceExpression

CreateSequenceExpression fn

func (SequenceExpression) Expression

func (n SequenceExpression) Expression() Expression

Expression fn

func (SequenceExpression) Node

func (n SequenceExpression) Node() Node

Node fn

func (SequenceExpression) String

func (n SequenceExpression) String() string

String fn

type SourceLocation

type SourceLocation struct {
	Source *string  `json:"source,omitempty"`
	Start  Position `json:"start,omitempty"`
	End    Position `json:"end,omitempty"`
}

SourceLocation struct

type Statement

type Statement struct {
	Type string
}

Statement struct

func (Statement) Node

func (n Statement) Node() Node

Node fn

func (Statement) Statement

func (n Statement) Statement() Statement

Statement fn

type SwitchCase

type SwitchCase struct {
	Type       string       `json:"type,omitempty"`
	Test       IExpression  `json:"test,omitempty"`
	Consequent []IStatement `json:"consequent,omitempty"`
}

SwitchCase struct

func (SwitchCase) Node

func (n SwitchCase) Node() Node

Node fn

type SwitchStatement

type SwitchStatement struct {
	Type         string       `json:"type,omitempty"`
	Discriminant IExpression  `json:"discriminant,omitempty"`
	Cases        []SwitchCase `json:"cases,omitempty"`
}

SwitchStatement struct

func (SwitchStatement) Node

func (n SwitchStatement) Node() Node

Node fn

func (SwitchStatement) Statement

func (n SwitchStatement) Statement() Statement

Statement fn

type ThisExpression

type ThisExpression struct {
	Type string `json:"type,omitempty"`
}

ThisExpression struct

func CreateThisExpression

func CreateThisExpression() ThisExpression

CreateThisExpression fn

func (ThisExpression) Expression

func (n ThisExpression) Expression() Expression

Expression fn

func (ThisExpression) Node

func (n ThisExpression) Node() Node

Node fn

func (ThisExpression) String

func (n ThisExpression) String() string

String fn

type ThrowStatement

type ThrowStatement struct {
	Type     string      `json:"type,omitempty"`
	Argument IExpression `json:"argument,omitempty"`
}

ThrowStatement struct

func CreateThrowStatement

func CreateThrowStatement(argument IExpression) ThrowStatement

CreateThrowStatement fn

func (ThrowStatement) Node

func (n ThrowStatement) Node() Node

Node fn

func (ThrowStatement) Statement

func (n ThrowStatement) Statement() Statement

Statement fn

func (ThrowStatement) String

func (n ThrowStatement) String() string

String fn

type TryStatement

type TryStatement struct {
	Type      string          `json:"type,omitempty"`
	Block     IBlockStatement `json:"block,omitempty"`
	Handler   *CatchClause    `json:"handler,omitempty"`
	Finalizer IBlockStatement `json:"finalizer,omitempty"`
}

TryStatement struct

func (TryStatement) Node

func (n TryStatement) Node() Node

Node fn

func (TryStatement) Statement

func (n TryStatement) Statement() Statement

Statement fn

type UnaryExpression

type UnaryExpression struct {
	Type     string        `json:"type,omitempty"`
	Operator UnaryOperator `json:"operator,omitempty"`
	Prefix   bool          `json:"prefix,omitempty"`
	Argument IExpression   `json:"argument,omitempty"`
}

UnaryExpression struct

func (UnaryExpression) Expression

func (n UnaryExpression) Expression() Expression

Expression fn

func (UnaryExpression) Node

func (n UnaryExpression) Node() Node

Node fn

type UnaryOperator

type UnaryOperator string

UnaryOperator enum "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"

type UpdateExpression

type UpdateExpression struct {
	Type     string         `json:"type,omitempty"`
	Operator UpdateOperator `json:"operator,omitempty"`
	Argument IExpression    `json:"argument,omitempty"`
	Prefix   bool           `json:"prefix,omitempty"`
}

UpdateExpression struct

func CreateUpdateExpression

func CreateUpdateExpression(argument IExpression, operator UpdateOperator, prefix bool) UpdateExpression

CreateUpdateExpression fn

func (UpdateExpression) Expression

func (n UpdateExpression) Expression() Expression

Expression fn

func (UpdateExpression) Node

func (n UpdateExpression) Node() Node

Node fn

func (UpdateExpression) String

func (n UpdateExpression) String() string

String fn

type UpdateOperator

type UpdateOperator string

UpdateOperator enum "++" | "--"

type VariableDeclaration

type VariableDeclaration struct {
	Type         string               `json:"type,omitempty"`
	Declarations []VariableDeclarator `json:"declarations,omitempty"`
	Kind         string               `json:"kind,omitempty"` // "var"
}

VariableDeclaration struct

func CreateVariableDeclaration

func CreateVariableDeclaration(kind string, decls ...VariableDeclarator) VariableDeclaration

CreateVariableDeclaration fn

func (VariableDeclaration) Declaration

func (n VariableDeclaration) Declaration() Declaration

Declaration fn

func (VariableDeclaration) Node

func (n VariableDeclaration) Node() Node

Node fn

func (VariableDeclaration) Statement

func (n VariableDeclaration) Statement() Statement

Statement fn

func (VariableDeclaration) String

func (n VariableDeclaration) String() string

String fn

type VariableDeclarator

type VariableDeclarator struct {
	Type string      `json:"type,omitempty"`
	ID   IPattern    `json:"id,omitempty"`
	Init IExpression `json:"init,omitempty"`
}

VariableDeclarator struct

func CreateVariableDeclarator

func CreateVariableDeclarator(id IPattern, init IExpression) VariableDeclarator

CreateVariableDeclarator fn

func (VariableDeclarator) Node

func (n VariableDeclarator) Node() Node

Node fn

func (VariableDeclarator) String

func (n VariableDeclarator) String() string

String fn

type WhileStatement

type WhileStatement struct {
	Type string      `json:"type,omitempty"`
	Test IExpression `json:"test,omitempty"`
	Body IStatement  `json:"body,omitempty"`
}

WhileStatement struct

func (WhileStatement) Node

func (n WhileStatement) Node() Node

Node fn

func (WhileStatement) Statement

func (n WhileStatement) Statement() Statement

Statement fn

type WithStatement

type WithStatement struct {
	Type   string      `json:"type,omitempty"`
	Object IExpression `json:"object,omitempty"`
	Body   IStatement  `json:"body,omitempty"`
}

WithStatement struct

func (WithStatement) Node

func (n WithStatement) Node() Node

Node fn

func (WithStatement) Statement

func (n WithStatement) Statement() Statement

Statement fn

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL