Class: SyntaxTree::YARV::Decompiler::BlockLabel

Inherits:
Object
  • Object
show all
Includes:
DSL
Defined in:
lib/syntax_tree/yarv/decompiler.rb

Overview

When we’re decompiling, we use a looped case statement to emulate jumping around in the same way the virtual machine would. This class provides convenience methods for generating the AST nodes that have to do with that label.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DSL

#ARef, #ARefField, #AliasNode, #ArgBlock, #ArgParen, #ArgStar, #Args, #ArgsForward, #ArrayLiteral, #AryPtn, #Assign, #Assoc, #AssocSplat, #BEGINBlock, #Backref, #Backtick, #BareAssocHash, #Begin, #Binary, #BlockArg, #BlockNode, #BlockVar, #BodyStmt, #Break, #CHAR, #CVar, #CallNode, #Case, #ClassDeclaration, #Comma, #Command, #CommandCall, #Comment, #Const, #ConstPathField, #ConstPathRef, #ConstRef, #DefNode, #Defined, #DynaSymbol, #ENDBlock, #Else, #Elsif, #EmbDoc, #EmbExprBeg, #EmbExprEnd, #EmbVar, #EndContent, #Ensure, #ExcessedComma, #Field, #FloatLiteral, #FndPtn, #For, #GVar, #HashLiteral, #Heredoc, #HeredocBeg, #HeredocEnd, #HshPtn, #IVar, #Ident, #IfNode, #IfOp, #Imaginary, #In, #Int, #Kw, #KwRestParam, #LBrace, #LBracket, #LParen, #Label, #LabelEnd, #Lambda, #LambdaVar, #MAssign, #MLHS, #MLHSParen, #MRHS, #MethodAddBlock, #ModuleDeclaration, #Next, #Not, #Op, #OpAssign, #Params, #Paren, #Period, #PinnedBegin, #PinnedVarRef, #Program, #QSymbols, #QSymbolsBeg, #QWords, #QWordsBeg, #RAssign, #RBrace, #RBracket, #RParen, #RangeNode, #RationalLiteral, #Redo, #RegexpBeg, #RegexpContent, #RegexpEnd, #RegexpLiteral, #Rescue, #RescueEx, #RescueMod, #RestParam, #Retry, #ReturnNode, #SClass, #Statements, #StringConcat, #StringContent, #StringDVar, #StringEmbExpr, #StringLiteral, #Super, #SymBeg, #SymbolContent, #SymbolLiteral, #Symbols, #SymbolsBeg, #TLamBeg, #TLambda, #TStringBeg, #TStringContent, #TStringEnd, #TopConstField, #TopConstRef, #Unary, #Undef, #UnlessNode, #UntilNode, #VCall, #VarField, #VarRef, #VoidStmt, #When, #WhileNode, #Word, #Words, #WordsBeg, #XString, #XStringLiteral, #YieldNode, #ZSuper

Constructor Details

#initialize(name) ⇒ BlockLabel

Returns a new instance of BlockLabel.



16
17
18
# File 'lib/syntax_tree/yarv/decompiler.rb', line 16

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/syntax_tree/yarv/decompiler.rb', line 14

def name
  @name
end

Instance Method Details

#fieldObject



20
21
22
# File 'lib/syntax_tree/yarv/decompiler.rb', line 20

def field
  VarField(Ident(name))
end

#refObject



24
25
26
# File 'lib/syntax_tree/yarv/decompiler.rb', line 24

def ref
  VarRef(Ident(name))
end