# 语句与声明

# Grammar

  • 简单语句
  • 复合语句
  • 声明

# Runtime

  • Completion Record
  • Lexical Environment

# Completion Record

  • [[type]]:normal,break,continue,return or throw
  • [[value]]:Types
  • [[target]]:label

# 简单语句

  • ExpressionStatement
  • EmptyStatement
  • DebuggerStatement
  • ThrowStatement
  • ContinueStatement
  • BreakStatement
  • ReturnStatement 按顺序如下:
a = 1 + 2;
;
debugger;
throw a;
continue label1;
break label2;
return 1 + 2;

# 复合语句

  • BlockStatement
  • IfStatement
  • SwitchStatement
  • IterationStatement
  • WithStatement
  • LabelStatement
  • TryStatement
//BlockStatement
{
    const a = 2;
}
//IterationStatement
while()
do while()
for( ; ; )
for(let i in {a:2,b:3})
for(let i of [2,3])
//TryStatement
try{
// 非block
throw
}catch( ){

}finally{

}

# 声明

  • FunctionDeclaration
  • GeneratorDeclaration
  • AsyncFunctionDeclaration
  • AsyncGeneratorDeclaration
  • VariableStatement
  • classDeclaration
  • LexicalDeclaration
function foo(){}
let foo = function(){}

function* foo(){
    yield 1;
    yield 2;
}