Package org.jruby.ir.builder
Class IRBuilderAST
java.lang.Object
org.jruby.ir.builder.IRBuilder<Node,DefNode,WhenNode,RescueBodyNode,Colon3Node,HashNode>
org.jruby.ir.builder.IRBuilderAST
public class IRBuilderAST
extends IRBuilder<Node,DefNode,WhenNode,RescueBodyNode,Colon3Node,HashNode>
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jruby.ir.builder.IRBuilder
IRBuilder.BinaryType, IRBuilder.CodeBlock, IRBuilder.Consume2<T,
U>, IRBuilder.RunIt, IRBuilder.VoidCodeBlock, IRBuilder.VoidCodeBlockOne -
Field Summary
Fields inherited from class org.jruby.ir.builder.IRBuilder
afterPrologueIndex, argumentDescriptions, coverageMode, encoding, evalType, executesOnce, flipVariableCount, instructions, parent, scope, underscoreVariableSeen, variableBuilder
-
Constructor Summary
ConstructorsConstructorDescriptionIRBuilderAST
(IRManager manager, IRScope scope, IRBuilder parent) IRBuilderAST
(IRManager manager, IRScope scope, IRBuilder parent, IRBuilder variableBuilder, org.jcodings.Encoding encoding) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
alwaysFalse
(Node node) protected boolean
alwaysTrue
(Node node) protected Node
bodyFor
(RescueBodyNode node) build
(ParseResult result) buildAlias
(AliasNode alias) buildArgsCat
(Variable result, ArgsCatNode argsCatNode) void
buildArgsMasgn
(Node node, Operand argsArray, boolean isMasgnRoot, int preArgsCount, int postArgsCount, int index, boolean isSplat) buildArgsPush
(Variable result, ArgsPushNode node) buildArray
(ArrayNode node, boolean operandOnly) protected void
buildAssignment
(List<Tuple<Node, ResultInstr>> assigns, Map<Node, Operand> reads) protected void
buildAssignment
(Node node, Operand rhsVal) protected void
buildAssocs
(Label testEnd, Operand original, Variable result, HashNode assocs, boolean inAlteration, boolean isSinglePattern, Variable errorString, boolean hasRest, Variable d) static Node
Deprecated.buildAttrAssignAssignment
(Node node, Operand value) protected Operand[]
buildAttrAssignCallArgs
(Node args, Operand[] outValue, boolean containsAssignment) buildBackref
(Variable result, BackRefNode node) buildBegin
(BeginNode beginNode) buildBignum
(BignumNode node) buildBlock
(BlockNode node) void
buildBlockArgsAssignment
(Node node, Operand argsArray, int argIndex, boolean isSplat) buildBreak
(BreakNode node) protected Operand[]
buildCallArgs
(Node args, int[] flags) protected Operand[]
buildCallArgsArray
(ListNode args, int[] flags) protected Operand
buildCallArgsArrayForSplat
(ListNode args, int[] flags) protected Operand
buildCallKeywordArguments
(HashNode keywords, int[] flags) buildClass
(ClassNode node) Build a new class and add it to the current scope (s).buildClassVar
(Variable result, ClassVarNode node) buildColon2
(Variable result, Colon2Node colon2) protected Operand
buildColon2ForConstAsgnDeclNode
(Node lhs, Variable valueResult, boolean constMissing) buildColon3
(Variable result, Colon3Node node) buildComplex
(ComplexNode node) buildConstDecl
(ConstDeclNode node) buildConstDeclAssignment
(ConstDeclNode constDeclNode, IRBuilder.CodeBlock valueBuilder) buildDAsgn
(DAsgnNode dasgnNode) buildDefn
(MethodDefNode node) buildDRegexp
(Variable result, DRegexpNode node) buildDSymbol
(Variable result, DSymbolNode node) buildDXStr
(Variable result, DXStrNode node) buildEncoding
(EncodingNode node) buildEnsureNode
(EnsureNode ensureNode) buildFCall
(Variable result, FCallNode node) buildFixnum
(FixnumNode node) buildFloat
(FloatNode node) buildGetArgumentDefinition
(Node node, String type) protected Operand
buildGetDefinition
(Node node) buildInstAsgn
(InstAsgnNode node) buildInstVar
(InstVarNode node) buildLambda
(LambdaNode node) protected Operand
buildLazyWithOrder
(CallNode node, Label lazyLabel, Label endLabel, boolean preserveOrder) buildLiteral
(LiteralNode literalNode) buildLocalAsgn
(LocalAsgnNode localAsgnNode) buildLocalVar
(LocalVarNode node) buildMatch
(Variable result, MatchNode matchNode) buildMatch2
(Variable result, Match2Node matchNode) buildMatch3
(Variable result, Match3Node matchNode) buildMultipleAsgn
(MultipleAsgnNode multipleAsgnNode) void
buildMultipleAssignment
(MultipleAsgnNode multipleAsgnNode, Operand values) void
buildMultipleAssignment2
(MultipleAsgnNode multipleAsgnNode, List<Tuple<Node, ResultInstr>> assigns, Map<Node, Operand> reads, Variable values) void
buildMultipleAssignmentArgs
(MultipleAsgnNode multipleAsgnNode, Operand argsArray) buildNil()
buildNthRef
(NthRefNode node) buildOpAsgn
(OpAsgnNode node) buildOpAsgnAnd
(OpAsgnAndNode node) buildOpAsgnOr
(OpAsgnOrNode orNode) protected Variable
buildPatternEach
(Label testEnd, Variable result, Operand original, Variable deconstructed, Operand value, Node exprNodes, boolean inAlternation, boolean isSinglePattern, Variable errorString) buildPostExe
(PostExeNode postExeNode) buildPreExe
(PreExeNode preExeNode) buildRational
(RationalNode node) buildRegexp
(RegexpNode reNode) buildRescue
(RescueNode node) buildRetry
(RetryNode node) buildReturn
(ReturnNode returnNode) buildSClass
(SClassNode node) buildSplat
(Variable result, SplatNode splatNode) buildStrRaw
(StrNode strNode) buildSuper
(Variable result, SuperNode node) buildSValue
(Variable result, SValueNode node) buildSymbol
(SymbolNode node) buildUndef
(UndefNode node) buildUntil
(UntilNode node) buildVAlias
(VAliasNode valiasNode) buildVCall
(Variable result, VCallNode node) protected void
buildWhenArgs
(WhenNode whenNode, Operand testValue, Label bodyLabel, Set<IRubyObject> seenLiterals, Map<IRubyObject, Integer> origLocs) buildWhile
(WhileNode node) buildYield
(Variable result, YieldNode node) buildZArray
(Variable result) buildZSuper
(Variable result, ZSuperNode node) protected boolean
canBeLazyMethod
(DefNode node) Combination of whether it is feasible for a method being processed to be lazy (e.g.protected boolean
protected void
createPrefixFromArgs
(ByteList prefix, Node args) protected int
dynamicPiece
(Operand[] pieces, int i, Node pieceNode, org.jcodings.Encoding _unused) protected Node[]
protected Operand
frozen_string
(Node node) protected LocalVariable
getArgVariable
(RubySymbol name, int depth) protected LocalVariable
getBlockArgVariable
(RubySymbol name, int depth) protected Operand
getContainerFromCPath
(Node cpath) protected Node
protected Node
getInExpression
(Node node) protected int
getLocalVariable
(RubySymbol name, int scopeDepth) protected IRubyObject
getWhenLiteral
(Node node) protected boolean
isBareStar
(Node node) protected boolean
isErrorInfoGlobal
(Node body) protected boolean
isLiteralString
(Node node) protected boolean
protected boolean
isSideEffectFree
(Node node) protected boolean
needsDefinitionCheck
(Node node) newIRBuilder
(IRManager manager, IRScope newScope) protected RescueBodyNode
optRescueFor
(RescueBodyNode node) protected Operand
putConstant
(Colon3Node colonNode, IRBuilder.CodeBlock valueBuilder) protected Operand
putConstant
(Colon3Node colonNode, Operand value) Deprecated.void
receiveArgs
(ArgsNode argsNode) Process all arguments specified for this scope.protected void
receiveBlockArg
(ArgsNode argsNode) Reify the implicit incoming block into a full Proc, for use as "block arg", but only if a block arg is specified in this scope's arguments.protected Variable
receiveBlockArg
(Variable v, Operand argsArray, int argIndex, boolean isSplat) protected void
receiveBlockArgs
(Node args) protected void
receiveForArgs
(Node node) void
receiveMethodArgs
(ArgsNode argsNode) void
receiveMethodArgs
(DefNode defNode) protected void
receiveNonBlockArgs
(ArgsNode argsNode, Variable keywords) void
receiveRequiredArg
(Node node, Variable keywords, int argIndex, Signature signature) protected Node
referenceFor
(RescueBodyNode node) protected Operand
setupCallClosure
(Node _unused, Node node) protected Node
Methods inherited from class org.jruby.ir.builder.IRBuilder
_call, addArg, addArgumentDescription, addInstr, addInstrAtBeginning, addRaiseError, addResultInstr, argumentResult, as_fixnum, binaryType, buildAlias, buildAnd, buildArrayPattern, buildAttrAssign, buildBreak, buildCase, buildClass, buildClassVar, buildClassVarAsgn, buildClassVarGetDefinition, buildConditional, buildConditionalLoop, buildConstantGetDefinition, buildDefinitionCheck, buildDefn, buildDefnCheckIfThenPaths, buildDefs, buildDRegex, buildDStr, buildDStr, buildDSymbol, buildDXStr, buildEncoding, buildEnsureInternal, buildEvalRoot, buildFindPattern, buildFlip, buildFor, buildForIter, buildGlobalAsgn, buildGlobalVar, buildGlobalVarGetDefinition, buildHashPattern, buildInstAsgn, buildInstVar, buildInstVarGetDefinition, buildIter, buildIterInner, buildLambda, buildLambdaInner, buildLocalVariableAssign, buildMatch, buildModule, buildModuleOrClassBody, buildNext, buildNthRef, buildOpAsgn, buildOpAsgnAnd, buildOpAsgnConstDecl, buildOpAsgnConstDecl, buildOpAsgnConstDeclAnd, buildOpAsgnConstDeclOr, buildOpAsgnOr, buildOpAsgnOrWithDefined, buildOpElementAsgnWith, buildOpElementAsgnWithMethod, buildOr, buildPatternCase, buildPatternEachHash, buildPatternEachIf, buildPatternLocal, buildPatternMatch, buildPatternOr, buildPatternSetEQQError, buildPatternSetGeneralError, buildPostExe, buildPreExe, buildRange, buildRational, buildRedo, buildRescueBodyInternal, buildRescueInternal, buildRetry, buildReturn, buildRoot, buildRootInner, buildSClass, buildSelf, buildSuper, buildUndef, buildVAlias, buildWhenValue, buildWhenValues, buildWithOrder, buildZSuper, buildZSuper, buildZSuperIfNest, call, call, canBacktraceBeRemoved, classVarContainer, classVarDefinitionContainer, computeScopeFlagsFrom, cond, cond, cond_ne_false, cond_ne_nil, cond_ne_true, copy, copy, createArgumentDescriptor, createBranch, createCall, createCurrentModuleVariable, deconstructHashPatternKeys, defineMethodInner, defineNewMethod, determineIfMaybeRefined, determineIfWeNeedLineNumber, determineSuperInstr, determineZSuperCallArgs, emitEnsureBlocks, extractCallOperands, fals, fcall, fcall, findContainerModule, fix, for_loop, getCurrentLoop, getCurrentModuleVariable, getEncoding, getFileName, getManager, getName, getNewLabel, getNewLabel, getNewLocalVariable, getValueInTemporaryVariable, getYieldClosureVariable, getZSuperCallOperands, hackPostExeSource, handleBreakAndReturnsInLambdas, handleNonlocalReturnInMethod, hasListener, if_else, if_not, initFlipStateVariable, isTopLevel, isTopScope, jump, label, literalWhenCheck, maybeGenerateIsNotEmptyErrorString, methodNameFor, nil, outputExceptionCheck, processEnsureRescueBlocks, protectCodeWithRescue, putConstant, putConstant, receiveBreakException, removeArg, searchConst, searchModuleForConst, searchModuleForConstNoFrills, setupCallArgs, symbol, symbol, tap, temp, throwSyntaxError, times, tru, type_error
-
Constructor Details
-
IRBuilderAST
-
IRBuilderAST
-
-
Method Details
-
buildAST
Deprecated. -
build
- Specified by:
build
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
newIRBuilder
-
build
- Specified by:
build
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
build
- Specified by:
build
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildLambda
-
buildEncoding
-
buildMultipleAsgn
-
buildAssignment
-
buildMultipleAssignment2
public void buildMultipleAssignment2(MultipleAsgnNode multipleAsgnNode, List<Tuple<Node, ResultInstr>> assigns, Map<Node, Operand> reads, Variable values) -
buildLazyWithOrder
-
buildAttrAssignCallArgs
protected Operand[] buildAttrAssignCallArgs(Node args, Operand[] outValue, boolean containsAssignment) - Specified by:
buildAttrAssignCallArgs
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildCallKeywordArguments
-
buildCallArgsArrayForSplat
-
buildCallArgsArray
-
buildCallArgs
- Specified by:
buildCallArgs
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildAssignment
- Specified by:
buildAssignment
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
getBlockArgVariable
-
receiveBlockArg
-
buildBlockArgsAssignment
-
buildAlias
-
buildAnd
-
buildArray
-
buildArgsCat
-
buildArgsPush
-
buildAttrAssignAssignment
-
buildBackref
-
buildBegin
-
buildBignum
-
buildBlock
-
buildBreak
-
buildCall
-
isNilRest
- Specified by:
isNilRest
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildAssocs
protected void buildAssocs(Label testEnd, Operand original, Variable result, HashNode assocs, boolean inAlteration, boolean isSinglePattern, Variable errorString, boolean hasRest, Variable d) - Specified by:
buildAssocs
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildPatternEach
protected Variable buildPatternEach(Label testEnd, Variable result, Operand original, Variable deconstructed, Operand value, Node exprNodes, boolean inAlternation, boolean isSinglePattern, Variable errorString) - Specified by:
buildPatternEach
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
getInExpression
- Specified by:
getInExpression
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
getInBody
- Specified by:
getInBody
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
isBareStar
- Specified by:
isBareStar
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildPatternCase
-
buildCase
-
whenBody
- Specified by:
whenBody
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
containsVariableAssignment
- Specified by:
containsVariableAssignment
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
frozen_string
- Specified by:
frozen_string
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
getLine
- Specified by:
getLine
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildWhenArgs
protected void buildWhenArgs(WhenNode whenNode, Operand testValue, Label bodyLabel, Set<IRubyObject> seenLiterals, Map<IRubyObject, Integer> origLocs) - Specified by:
buildWhenArgs
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
getWhenLiteral
- Specified by:
getWhenLiteral
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
isLiteralString
- Specified by:
isLiteralString
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildClass
Build a new class and add it to the current scope (s). -
buildSClass
-
buildClassVar
-
buildClassVarAsgn
-
buildConstDecl
-
buildConstDeclAssignment
public Operand buildConstDeclAssignment(ConstDeclNode constDeclNode, IRBuilder.CodeBlock valueBuilder) -
putConstant
- Specified by:
putConstant
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
putConstant
Deprecated.- Specified by:
putConstant
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildColon2
-
buildColon3
-
buildComplex
-
needsDefinitionCheck
- Specified by:
needsDefinitionCheck
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildGetDefinition
- Specified by:
buildGetDefinition
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildGetArgumentDefinition
-
buildDAsgn
-
canBeLazyMethod
Description copied from class:IRBuilder
Combination of whether it is feasible for a method being processed to be lazy (e.g. methods containing break/next cannot for syntax error purposes) or whether it is enabled as an option (feature does not exist yet).- Specified by:
canBeLazyMethod
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode> - Parameters:
node
- syntactical representation of the definition- Returns:
- true if can be lazy
-
receiveMethodArgs
- Specified by:
receiveMethodArgs
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildDefn
-
buildDefs
-
getArgVariable
-
receiveRequiredArg
-
receiveNonBlockArgs
-
receiveBlockArg
Reify the implicit incoming block into a full Proc, for use as "block arg", but only if a block arg is specified in this scope's arguments.- Parameters:
argsNode
- the arguments containing the block arg, if any
-
receiveArgs
Process all arguments specified for this scope. This includes pre args (required args at the beginning of the argument list), opt args (arguments with a default value), a rest arg (catch-all for argument list overflow), post args (required arguments after a rest arg) and a block arg (to reify an incoming block into a Proc object.- Parameters:
argsNode
- the args node containing the specification for the arguments
-
buildArgsMasgn
-
buildMultipleAssignment
-
buildMultipleAssignmentArgs
-
receiveMethodArgs
-
receiveForArgs
- Specified by:
receiveForArgs
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
receiveBlockArgs
- Specified by:
receiveBlockArgs
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildDot
-
dynamicPiece
- Specified by:
dynamicPiece
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildDRegexp
-
buildDStr
-
buildDSymbol
-
buildDVar
-
buildDXStr
-
buildEnsureNode
-
buildFCall
-
setupCallClosure
- Specified by:
setupCallClosure
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildFixnum
-
buildFlip
-
buildFloat
-
buildFor
-
buildGlobalAsgn
-
buildHash
-
buildIf
-
buildInstAsgn
-
buildInstVar
-
buildIter
-
buildLiteral
-
buildLocalAsgn
-
buildLocalVar
-
buildMatch
-
buildMatch2
-
buildMatch3
-
getContainerFromCPath
- Specified by:
getContainerFromCPath
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildNext
-
buildNthRef
-
buildNil
-
buildOpAsgn
-
buildColon2ForConstAsgnDeclNode
protected Operand buildColon2ForConstAsgnDeclNode(Node lhs, Variable valueResult, boolean constMissing) - Specified by:
buildColon2ForConstAsgnDeclNode
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildOpAsgnConstDeclNode
-
buildOpAsgnAnd
-
buildOpAsgnOr
-
buildOpElementAsgn
-
buildOr
-
buildPostExe
-
buildPreExe
-
buildRational
-
buildRedo
-
buildRegexp
-
buildRescue
-
isSideEffectFree
- Specified by:
isSideEffectFree
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
isErrorInfoGlobal
- Specified by:
isErrorInfoGlobal
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
exceptionNodesFor
- Specified by:
exceptionNodesFor
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
bodyFor
- Specified by:
bodyFor
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
optRescueFor
- Specified by:
optRescueFor
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
referenceFor
- Specified by:
referenceFor
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
buildRetry
-
buildReturn
-
buildSplat
-
buildStr
-
buildStrRaw
-
buildSuper
-
buildSValue
-
buildSymbol
-
buildUndef
-
buildUntil
-
buildVAlias
-
buildVCall
-
buildWhile
-
buildXStr
-
buildYield
-
buildZArray
-
buildZSuper
-
alwaysFalse
- Specified by:
alwaysFalse
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
alwaysTrue
- Specified by:
alwaysTrue
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
getLocalVariable
- Specified by:
getLocalVariable
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-
createPrefixFromArgs
- Overrides:
createPrefixFromArgs
in classIRBuilder<Node,
DefNode, WhenNode, RescueBodyNode, Colon3Node, HashNode>
-