
# fileIn("s8/library/scripting/S8Scripting.st")
smalltalk.bind(smalltalk.Compiler,"parse:",0
,smalltalk.__f__("""(self,smalltalkExpression):
	#Compiler>>#parse:
	return self.parseMethod_(smalltalk.object_comma_(smalltalk.object_comma_(smalltalk.object_comma_(smalltalk.String.doItSelector(),smalltalk.String(" ^[")),smalltalkExpression),smalltalk.String("] value"))) 
""","Compiler_parse_")
,"parsing","""parse: smalltalkExpression
	" Return the result of parsing a method to evaluate smalltalkExpression. "

	^self parseMethod: String doItSelector
		,' ^[', smalltalkExpression
		,'] value' """,nil)

smalltalk.bind(smalltalk.Compiler,"parse:onError:",0
,smalltalk.__f__("""(self,smalltalkExpression,aBlock):
	_s8Ret_=smalltalk.newContext()
	try:
		#Compiler>>#parse:onError:
		__0__=smalltalk.newContext()
		def __blk1__():
			def __blk2__():
				return self.error_(smalltalk.to_String(__0__.syntax)) 
			__0__.syntax=self.parse_(smalltalkExpression) 
			return smalltalk.if_true_false_(__0__.syntax.isParseFailure(),smalltalk.blk(__blk2__,0),nil) 
		def __blk3__(ex):
			return smalltalk.raise_result_(_s8Ret_,aBlock.evaluateWith_(ex)) 
		__0__.syntax=nil
		smalltalk.blk(__blk1__,0).on_do_(smalltalk.Error,smalltalk.blk(__blk3__,1)) 
		smalltalk.raise_result_(_s8Ret_,__0__.syntax) 
	except Exception as __ex:
		if smalltalk.exception_at(__ex,_s8Ret_):
			return smalltalk.exceptionResult_(__ex)
		raise __ex
	
""","Compiler_parse_onError_")
,"parsing","""parse: smalltalkExpression onError: aBlock
	" Return the result of parsing a method to evaluate smalltalkExpression. "

	| syntax |
	[ syntax := self parse: smalltalkExpression.
	  syntax isParseFailure ifTrue: [ self error: syntax toString ].
	] on: Error do: [:ex| ^aBlock evaluateWith: ex ].
	^syntax """,nil)

smalltalk.bind(smalltalk.CompilerNode,"evaluate",0
,smalltalk.__f__("""(self):
	#CompilerNode>>#evaluate
	return self.evaluate_(nil) 
""","CompilerNode_evaluate")
,"evaluating","""evaluate
	" Evaluate the receiver in an empty context. "

	^self evaluate: nil """,nil)

smalltalk.bind(smalltalk.CompilerNode,"evaluate:",0
,smalltalk.__f__("""(self,aReceiver):
	#CompilerNode>>#evaluate:
	return self.evaluateIn_(smalltalk.S8Context.for_(aReceiver)) 
""","CompilerNode_evaluate_")
,"evaluating","""evaluate: aReceiver
	" Returns the result of evaluating the receiver in a context bound to aReceiver. "

	^self evaluateIn: (S8Context for: aReceiver) """,nil)

smalltalk.bind(smalltalk.CompilerNode,"evaluateContentsIn:",0
,smalltalk.__f__("""(self,aContext):
	#CompilerNode>>#evaluateContentsIn:
	__0__=smalltalk.newContext()
	def __blk1__(each):
		__0__.result=each.evaluateIn_(aContext)
		return __0__.result 
	__0__.result=nil
	self.nodes().do_(smalltalk.blk(__blk1__,1)) 
	return __0__.result 
""","CompilerNode_evaluateContentsIn_")
,"evaluating","""evaluateContentsIn: aContext
	" Private - Returns the result of evaluating the nodes of receiver in aContext. "

	| result |
	self nodes do: [:each| result := each evaluateIn: aContext ].
	^result """,nil)

smalltalk.bind(smalltalk.CompilerNode,"evaluateIn:",0
,smalltalk.__f__("""(self,aContext):
	#CompilerNode>>#evaluateIn:
	return self.subclassResponsibility_(smalltalk.String("evaluateIn:")) 
""","CompilerNode_evaluateIn_")
,"evaluating","""evaluateIn: aContext
	" Returns the result of evaluating the receiver in aContext.
	This message must be implemented by the subclasses. "

	^self subclassResponsibility: #evaluateIn: """,nil)

smalltalk.bind(smalltalk.CompilerNode,"exitBlock:",0
,smalltalk.__f__("""(self,aBlock):
	#CompilerNode>>#exitBlock:
	if smalltalk.b(smalltalk.notNil_(getattr(self,"@nodes",nil))):
		def __blk1__(each):
			return each.exitBlock_(aBlock) 
		getattr(self,"@nodes",nil).do_(smalltalk.blk(__blk1__,1)) 
	 
	return self 
""","CompilerNode_exitBlock_")
,"evaluating","""exitBlock: aBlock
	" Set the exit block of the receiver.
	This block will be used to abort execution of the receiver.
	Propagate to nodes by default.
	This method can be refined by subclasses. "

	nodes notNil ifTrue: [
		nodes do: [:each| each exitBlock: aBlock ]
	] """,nil)

smalltalk.bind(smalltalk.CompilerNode,"isOO",0
,smalltalk.__f__("""(self):
	#CompilerNode>>#isOO
	return smalltalk.true 
""","CompilerNode_isOO")
,"query","""isOO
	" Returns true if the receiver refers to an object. "

	^true """,nil)

smalltalk.bind(smalltalk.AssignmentNode,"exitBlock:",0
,smalltalk.__f__("""(self,aBlock):
	#AssignmentNode>>#exitBlock:
	smalltalk.superReceiver(smalltalk.AssignmentNode,self).exitBlock_(aBlock) 
	self.left().exitBlock_(aBlock) 
	self.right().exitBlock_(aBlock) 
	return self 
""","AssignmentNode_exitBlock_")
,"evaluating","""exitBlock: aBlock
	" Set the exit block of the receiver. "

	super exitBlock: aBlock.
	self left exitBlock: aBlock.
	self right exitBlock: aBlock """,nil)

smalltalk.bind(smalltalk.AssignmentNode,"evaluateIn:",0
,smalltalk.__f__("""(self,aContext):
	#AssignmentNode>>#evaluateIn:
	return self.left().bind_in_(self.right().evaluateIn_(aContext),aContext) 
""","AssignmentNode_evaluateIn_")
,"evaluating","""evaluateIn: aContext
	" Returns the result of evaluating the receiver in aContext. "

	^self left bind: (self right evaluateIn: aContext) in: aContext """,nil)

smalltalk.bind(smalltalk.BlockNode,"exitBlock:",0
,smalltalk.__f__("""(self,aBlock):
	#BlockNode>>#exitBlock:
	def __blk1__(each):
		return each.exitBlock_(aBlock) 
	smalltalk.superReceiver(smalltalk.BlockNode,self).exitBlock_(aBlock) 
	self.parameters().do_(smalltalk.blk(__blk1__,1)) 
	return self 
""","BlockNode_exitBlock_")
,"evaluating","""exitBlock: aBlock
	" Set the exit block of the receiver. "

	super exitBlock: aBlock.
	self parameters do: [:each| each exitBlock: aBlock ] """,nil)

smalltalk.bind(smalltalk.BlockNode,"evaluateIn:",0
,smalltalk.__f__("""(self,aContext):
	#BlockNode>>#evaluateIn:
	return smalltalk.S8Block.for_in_(self,aContext) 
""","BlockNode_evaluateIn_")
,"evaluating","""evaluateIn: aContext
	" Returns the result of evaluating the receiver in aContext. "

	^S8Block for: self in: aContext """,nil)

smalltalk.bind(smalltalk.BlockNode,"arguments",0
,smalltalk.__f__("""(self):
	#BlockNode>>#arguments
	return self.parameters() 
""","BlockNode_arguments")
,"accessing","""arguments
	" Return the arguments of the receiver. "

	^self parameters """,nil)

smalltalk.bind(smalltalk.BlockNode,"temporaries",0
,smalltalk.__f__("""(self):
	#BlockNode>>#temporaries
	return smalltalk.newArray([]) 
""","BlockNode_temporaries")
,"accessing","""temporaries
	" Return the temporaries of the receiver. "

	^#() """,nil)

smalltalk.bind(smalltalk.BlockNode,"statements",0
,smalltalk.__f__("""(self):
	#BlockNode>>#statements
	return self.nodes() 
""","BlockNode_statements")
,"accessing","""statements
	" Return the statements of the receiver. "

	^self nodes """,nil)

smalltalk.bind(smalltalk.CascadeNode,"exitBlock:",0
,smalltalk.__f__("""(self,aBlock):
	#CascadeNode>>#exitBlock:
	smalltalk.superReceiver(smalltalk.CascadeNode,self).exitBlock_(aBlock) 
	if smalltalk.b(smalltalk.notNil_(getattr(self,"@receiver",nil))):
		getattr(self,"@receiver",nil).exitBlock_(aBlock) 
	 
	return self 
""","CascadeNode_exitBlock_")
,"evaluating","""exitBlock: aBlock
	" Set the exit block of the receiver. "

	super exitBlock: aBlock.
	receiver notNil ifTrue: [ receiver exitBlock: aBlock ]. """,nil)

smalltalk.bind(smalltalk.MethodNode,"clearExitBlock",0
,smalltalk.__f__("""(self):
	#MethodNode>>#clearExitBlock
	self.exitBlock_(nil) 
	return self 
""","MethodNode_clearExitBlock")
,"evaluating","""clearExitBlock
	" Clear the exit block. "

	self exitBlock: nil """,nil)

smalltalk.bind(smalltalk.MethodNode,"evaluateIn:",0
,smalltalk.__f__("""(self,aContext):
	_s8Ret_=smalltalk.newContext()
	try:
		#MethodNode>>#evaluateIn:
		def __blk1__(result):
			self.clearExitBlock() 
			return smalltalk.raise_result_(_s8Ret_,result) 
		def __blk2__():
			return self.evaluateContentsIn_(aContext) 
		def __blk3__():
			return aContext.self() 
		self.exitBlock_(smalltalk.blk(__blk1__,1)) 
		smalltalk.raise_result_(_s8Ret_,smalltalk.if_true_false_(getattr(self,"@nodes",nil).size()._gt(smalltalk.Number(0)),smalltalk.blk(__blk2__,0),smalltalk.blk(__blk3__,0))) 
	except Exception as __ex:
		if smalltalk.exception_at(__ex,_s8Ret_):
			return smalltalk.exceptionResult_(__ex)
		raise __ex
	
""","MethodNode_evaluateIn_")
,"evaluating","""evaluateIn: aContext
	" Returns the result of evaluating the receiver in aContext. "

	self exitBlock: [:result| self clearExitBlock. ^result ].
	^nodes size > 0
		ifTrue: [ self evaluateContentsIn: aContext ]
		ifFalse: [ aContext self ] """,nil)

smalltalk.bind(smalltalk.ReturnNode,"exitBlock:",0
,smalltalk.__f__("""(self,aBlock):
	#ReturnNode>>#exitBlock:
	smalltalk.superReceiver(smalltalk.ReturnNode,self).exitBlock_(aBlock) 
	smalltalk.basic_at_put(self,"@exitBlock",aBlock) 
	return self 
""","ReturnNode_exitBlock_")
,"accessing","""exitBlock: aBlock
	" Set the receiver's exitBlock. "

	super exitBlock: aBlock.
	exitBlock := aBlock. """,nil)

smalltalk.bind(smalltalk.ReturnNode,"exitWith:",0
,smalltalk.__f__("""(self,anObject):
	#ReturnNode>>#exitWith:
	if smalltalk.b(smalltalk.isNil_(getattr(self,"@exitBlock",nil))):
		return self.error_(smalltalk.String("Invalid context.")) 
	 
	return getattr(self,"@exitBlock",nil).value_(anObject) 
""","ReturnNode_exitWith_")
,"evaluating","""exitWith: anObject
	" Exit the receiver with anObject as returned value. "

	exitBlock isNil ifTrue: [ ^self error: 'Invalid context.' ].
	^exitBlock value: anObject """,nil)

smalltalk.bind(smalltalk.ReturnNode,"evaluateIn:",0
,smalltalk.__f__("""(self,aContext):
	#ReturnNode>>#evaluateIn:
	return self.exitWith_(self.evaluateContentsIn_(aContext)) 
""","ReturnNode_evaluateIn_")
,"evaluating","""evaluateIn: aContext
	" Returns the result of evaluating the receiver in aContext. "

	^self exitWith: (self evaluateContentsIn: aContext) """,nil)

smalltalk.bind(smalltalk.SendNode.__class__,"actionToSend:ifAbsent:",0
,smalltalk.__f__("""(self,selector,aBlock):
	#SendNode class>>#actionToSend:ifAbsent:
	return smalltalk.S8Block.optimizations().at_ifAbsent_(selector,aBlock) 
""","SendNode_class_actionToSend_ifAbsent_")
,"actions","""actionToSend: selector ifAbsent: aBlock
	" Private - Returns the block to evaluate for sending message selector. "

	^S8Block optimizations at: selector ifAbsent: aBlock """,nil)

smalltalk.bind(smalltalk.SendNode,"exitBlock:",0
,smalltalk.__f__("""(self,aBlock):
	#SendNode>>#exitBlock:
	def __blk1__(each):
		return each.exitBlock_(aBlock) 
	smalltalk.superReceiver(smalltalk.SendNode,self).exitBlock_(aBlock) 
	if smalltalk.b(smalltalk.notNil_(getattr(self,"@receiver",nil))):
		getattr(self,"@receiver",nil).exitBlock_(aBlock) 
	 
	self.arguments().do_(smalltalk.blk(__blk1__,1)) 
	return self 
""","SendNode_exitBlock_")
,"evaluating","""exitBlock: aBlock
	" Set the exit block of the receiver. "

	super exitBlock: aBlock.
	receiver notNil ifTrue: [ receiver exitBlock: aBlock ].
	self arguments do: [:each| each exitBlock: aBlock ]. """,nil)

smalltalk.bind(smalltalk.SendNode,"evaluateIn:",0
,smalltalk.__f__("""(self,aContext):
	#SendNode>>#evaluateIn:
	__0__=smalltalk.newContext()
	__0__.value=nil
	__0__.value=self.receiver().evaluateIn_(aContext) 
	return self.evaluate_value_in_(self.receiver(),__0__.value,aContext) 
""","SendNode_evaluateIn_")
,"evaluating","""evaluateIn: aContext
	" Returns the result of evaluating the receiver in aContext. "

	| value |
	value := self receiver evaluateIn: aContext.
	^self evaluate: self receiver value: value in: aContext """,nil)

smalltalk.bind(smalltalk.SendNode,"evaluate:value:in:",0
,smalltalk.__f__("""(self,aReceiver,anObject,aContext):
	#SendNode>>#evaluate:value:in:
	__0__=smalltalk.newContext()
	def __blk1__(each):
		return each.evaluateIn_(aContext) 
	def __blk2__():
		return smalltalk.booleanNot_(aReceiver.isOO()) 
	__0__.values=nil
	__0__.values=self.arguments().collect_(smalltalk.blk(__blk1__,1)) 
	if smalltalk.b(smalltalk.boolean_or_(aReceiver.isSuper(),smalltalk.blk(__blk2__,0))):
		return aReceiver.send_to_withArguments_in_(self.selector(),anObject,__0__.values,aContext) 
	 
	return self.send_to_withArguments_in_(self.selector(),anObject,__0__.values,aContext) 
""","SendNode_evaluate_value_in_")
,"evaluating","""evaluate: aReceiver value: anObject in: aContext
	" Private - Returns the result of sending message to anObject in aContext. "

	| values |
	values := self arguments collect: [:each| each evaluateIn: aContext ].
	(aReceiver isSuper or: [ aReceiver isOO not ]) ifTrue: [
		^aReceiver send: self selector to: anObject withArguments: values in: aContext
	].
	^self send: self selector to: anObject withArguments: values in: aContext """,nil)

smalltalk.bind(smalltalk.SendNode.__class__,"selectorToSend:",0
,smalltalk.__f__("""(self,msg):
	#SendNode class>>#selectorToSend:
	def __blk1__():
		return msg.copyFrom_to_(smalltalk.Number(2),msg.size()).upTo_(smalltalk.String(":")) 
	def __blk2__():
		return msg 
	return smalltalk.if_true_false_(smalltalk.isObject_equalTo_(msg.first(),smalltalk.String("#")),smalltalk.blk(__blk1__,0),smalltalk.blk(__blk2__,0)) 
""","SendNode_class_selectorToSend_")
,"private","""selectorToSend: msg
	" Private - Returns the selector to use to lookup method for sending message msg. "

	^msg first = $# ifTrue: [
		(msg copyFrom: 2 to: msg size) upTo: $:
	] ifFalse: [ msg ]""",nil)

smalltalk.bind(smalltalk.SendNode,"send:to:withArguments:in:",0
,smalltalk.__f__("""(self,msg,anObject,values,aContext):
	#SendNode>>#send:to:withArguments:in:
	__0__=smalltalk.newContext()
	__0__.sel=nil
	__0__.sel=(self).__class__.selectorToSend_(msg) 
	if smalltalk.b(smalltalk.isNil_(getattr(self,"@action",nil))):
		smalltalk.basic_at_put(self,"@action",self.actionToSend_(__0__.sel)) 
	 
	return getattr(self,"@action",nil).value_value_value_value_(anObject,__0__.sel,values,aContext) 
""","SendNode_send_to_withArguments_in_")
,"evaluating","""send: msg to: anObject withArguments: values in: aContext
	" Private - Returns the result of sending message to anObject in aContext. "

	| sel |
	sel := self class selectorToSend: msg.
	action isNil ifTrue: [ action := self actionToSend: sel ].
	^action	value: anObject value: sel
		value: values value: aContext """,nil)

smalltalk.bind(smalltalk.SendNode,"actionToSend:",0
,smalltalk.__f__("""(self,aSymbol):
	#SendNode>>#actionToSend:
	def __blk1__():
		def __blk2__(receiver,msg,values,context):
			return receiver.perform_withArguments_(msg,values) 
		return smalltalk.blk(__blk2__,4) 
	return (self).__class__.actionToSend_ifAbsent_(aSymbol,smalltalk.blk(__blk1__,0)) 
""","SendNode_actionToSend_")
,"actions","""actionToSend: aSymbol
	" Private - Returns the block to evaluate for sending message aSymbol. "

	^self class actionToSend: aSymbol ifAbsent: [
		[:receiver :msg :values :context|
			receiver perform: msg withArguments: values
		]
	] """,nil)

smalltalk.bind(smalltalk.CascadeNode,"evaluateIn:",0
,smalltalk.__f__("""(self,aContext):
	#CascadeNode>>#evaluateIn:
	__0__=smalltalk.newContext()
	def __blk1__(each):
		__0__.result=each.evaluate_value_in_(self.receiver(),__0__.rec,aContext)
		return __0__.result 
	__0__.rec=nil
	__0__.result=nil
	__0__.rec=self.receiver().evaluateIn_(aContext) 
	getattr(self,"@nodes",nil).do_(smalltalk.blk(__blk1__,1)) 
	return __0__.result 
""","CascadeNode_evaluateIn_")
,"evaluating","""evaluateIn: aContext
	" Returns the result of evaluating the receiver in aContext. "

	| rec result |
	rec := self receiver evaluateIn: aContext.
	nodes do: [:each| result := each evaluate: self receiver value: rec in: aContext ].
	^result """,nil)

smalltalk.bind(smalltalk.InlineNode,"evaluateIn:",0
,smalltalk.__f__("""(self,aContext):
	#InlineNode>>#evaluateIn:
	__0__=smalltalk.newContext()
	def __blk1__():
		return self.error_(smalltalk.object_comma_(smalltalk.String("Invalid/missing native code - "),__0__.src)) 
	__0__.src=nil
	__0__.lang=nil
	__0__.lang=aContext.nativeLanguage() 
	if smalltalk.b(smalltalk.isNil_(__0__.lang)):
		__0__.lang=smalltalk.Smalltalk.nativeLanguage() 
	 
	__0__.src=self.sourceFor_(__0__.lang) 
	return smalltalk.Smalltalk.nativeObjectAt_ifAbsent_(__0__.src,smalltalk.blk(__blk1__,0)) 
""","InlineNode_evaluateIn_")
,"evaluating","""evaluateIn: aContext
	" Returns the result of evaluating the receiver in aContext. "

	| src lang |
	lang := aContext nativeLanguage.
	lang isNil ifTrue:  [ lang := Smalltalk nativeLanguage ].
	src := self sourceFor: lang.
	^Smalltalk
		nativeObjectAt: src
		ifAbsent: [ self error: 'Invalid/missing native code - ' ,src ] """,nil)

smalltalk.bind(smalltalk.SequenceNode,"exitBlock:",0
,smalltalk.__f__("""(self,aBlock):
	#SequenceNode>>#exitBlock:
	def __blk1__(each):
		return each.exitBlock_(aBlock) 
	smalltalk.superReceiver(smalltalk.SequenceNode,self).exitBlock_(aBlock) 
	self.temps().do_(smalltalk.blk(__blk1__,1)) 
	return self 
""","SequenceNode_exitBlock_")
,"evaluating","""exitBlock: aBlock
	" Set the exit block of the receiver. "

	super exitBlock: aBlock.
	self temps do: [:each| each exitBlock: aBlock ]. """,nil)

smalltalk.bind(smalltalk.SequenceNode,"evaluateIn:",0
,smalltalk.__f__("""(self,aContext):
	#SequenceNode>>#evaluateIn:
	def __blk1__(ctx):
		return self.evaluateContentsIn_(ctx) 
	return smalltalk.S8Context.in_clear_do_(aContext,self.temps(),smalltalk.blk(__blk1__,1)) 
""","SequenceNode_evaluateIn_")
,"evaluating","""evaluateIn: aContext
	" Returns the result of evaluating the receiver in aContext. "

	^S8Context
		in: aContext clear: self temps
		do: [:ctx| self evaluateContentsIn: ctx ] """,nil)

smalltalk.bind(smalltalk.ExtendedSequenceNode,"exitBlock:",0
,smalltalk.__f__("""(self,aBlock):
	#ExtendedSequenceNode>>#exitBlock:
	def __blk1__(each):
		return each.exitBlock_(aBlock) 
	smalltalk.superReceiver(smalltalk.ExtendedSequenceNode,self).exitBlock_(aBlock) 
	self.directives().do_(smalltalk.blk(__blk1__,1)) 
	return self 
""","ExtendedSequenceNode_exitBlock_")
,"evaluating","""exitBlock: aBlock
	" Set the exit block of the receiver. "

	super exitBlock: aBlock.
	self directives do: [:each| each exitBlock: aBlock ] """,nil)

smalltalk.bind(smalltalk.ExtendedSequenceNode,"evaluateIn:",0
,smalltalk.__f__("""(self,aContext):
	#ExtendedSequenceNode>>#evaluateIn:
	def __blk1__(each):
		return each.evaluateIn_(aContext) 
	self.directives().do_(smalltalk.blk(__blk1__,1)) 
	return smalltalk.superReceiver(smalltalk.ExtendedSequenceNode,self).evaluateIn_(aContext) 
""","ExtendedSequenceNode_evaluateIn_")
,"evaluating","""evaluateIn: aContext
	" Returns the result of evaluating the receiver in aContext. "

	self directives do: [:each| each evaluateIn: aContext ].
	^super evaluateIn: aContext """,nil)

smalltalk.bind(smalltalk.ValueNode.__class__,"literal:value:",0
,smalltalk.__f__("""(self,aName,aValue):
	#ValueNode class>>#literal:value:
	return self.new().literal_value_(aName,aValue) 
""","ValueNode_class_literal_value_")
,"instantiation","""literal: aName value: aValue
	" Return an instance of the receiver. "

	^self new literal: aName value: aValue""",nil)

smalltalk.bind(smalltalk.ValueNode,"literal:value:",0
,smalltalk.__f__("""(self,aName,aValue):
	#ValueNode>>#literal:value:
	smalltalk.basic_at_put(self,"@value",aName) 
	smalltalk.basic_at_put(self,"@binding",smalltalk.S8LiteralBinding.value_(aValue)) 
	return self 
""","ValueNode_literal_value_")
,"initialize","""literal: aName value: aValue
	" Private - Initialize the receiver as a literal constant with aValue. "

	value := aName.
	binding := S8LiteralBinding value: aValue """,nil)

smalltalk.bind(smalltalk.ValueNode,"evaluateIn:",0
,smalltalk.__f__("""(self,aContext):
	#ValueNode>>#evaluateIn:
	return self.index_in_(self.valueIn_(aContext),aContext) 
""","ValueNode_evaluateIn_")
,"evaluating","""evaluateIn: aContext
	" Returns the result of evaluating the receiver in aContext. "

	^self index: (self valueIn: aContext) in: aContext """,nil)

smalltalk.bind(smalltalk.ValueNode,"index:in:",0
,smalltalk.__f__("""(self,anObject,aContext):
	#ValueNode>>#index:in:
	return anObject 
""","ValueNode_index_in_")
,"indexing","""index: anObject in: aContext
	" Private - Returns the result of indexing anObject. "

	^anObject """,nil)

smalltalk.bind(smalltalk.ValueNode,"initializeBinding:",0
,smalltalk.__f__("""(self,aContext):
	#ValueNode>>#initializeBinding:
	smalltalk.basic_at_put(self,"@binding",smalltalk.String("constant")) 
	return self 
""","ValueNode_initializeBinding_")
,"initialize","""initializeBinding: aContext
	" Private - Initialize the binding of the receiver. "

	binding := #constant """,nil)

smalltalk.bind(smalltalk.ValueNode,"enter:",0
,smalltalk.__f__("""(self,aContext):
	#ValueNode>>#enter:
	if smalltalk.b(smalltalk.isNil_(getattr(self,"@binding",nil))):
		self.initializeBinding_(aContext) 
	 
	if smalltalk.b(smalltalk.isObject_equalTo_(getattr(self,"@binding",nil),smalltalk.String("constant"))):
		return smalltalk.false 
	 
	return smalltalk.notNil_(getattr(self,"@binding",nil)) 
""","ValueNode_enter_")
,"bindings","""enter: aContext
	" Private - Returns true if the receiver is bound to aContext. "

	binding isNil ifTrue: [ self initializeBinding: aContext ].
	binding = #constant ifTrue: [ ^false ].
	^binding notNil """,nil)

smalltalk.bind(smalltalk.ValueNode,"valueIn:",0
,smalltalk.__f__("""(self,aContext):
	#ValueNode>>#valueIn:
	if not smalltalk.b(self.enter_(aContext)):
		return getattr(self,"@value",nil).shallowCopy() 
	 
	return getattr(self,"@binding",nil).evaluateIn_(aContext) 
""","ValueNode_valueIn_")
,"value","""valueIn: aContext
	" Private - Returns the value of the receiver in aContext. "

	(self enter: aContext) ifFalse: [ ^value shallowCopy ].
	^binding evaluateIn: aContext """,nil)

smalltalk.bind(smalltalk.ValueNode,"clear:",0
,smalltalk.__f__("""(self,aContext):
	#ValueNode>>#clear:
	if not smalltalk.b(self.enter_(aContext)):
		return aContext.clear_(getattr(self,"@value",nil)._minus_gt(nil)) 
	 
	return aContext.clear_(getattr(self,"@binding",nil)) 
""","ValueNode_clear_")
,"evaluating","""clear: aContext
	" Clear the receiver's contents. "

	(self enter: aContext) ifFalse: [
		^aContext clear: value -> nil
	].
	^aContext clear: binding """,nil)

smalltalk.bind(smalltalk.ValueNode,"bind:in:",0
,smalltalk.__f__("""(self,aValue,aContext):
	#ValueNode>>#bind:in:
	return self.assignValue_in_(aValue,aContext) 
""","ValueNode_bind_in_")
,"binding","""bind: aValue in: aContext
	" Set the receiver's value to aValue in aContext.
	WARNING: The receiver MUST return the value set. "

	^self assignValue: aValue in: aContext """,nil)

smalltalk.bind(smalltalk.ValueNode,"followBlockIn:",0
,smalltalk.__f__("""(self,aContext):
	#ValueNode>>#followBlockIn:
	return nil 
""","ValueNode_followBlockIn_")
,"evaluating","""followBlockIn: aContext
	" Private - Returns the block to follow indices. "

	^nil """,nil)

smalltalk.bind(smalltalk.ValueNode,"assignValue:in:",0
,smalltalk.__f__("""(self,aValue,aContext):
	#ValueNode>>#assignValue:in:
	if not smalltalk.b(self.enter_(aContext)):
		return aContext.at_put_(getattr(self,"@value",nil),aValue) 
	 
	return getattr(self,"@binding",nil).assign_to_in_(self.followBlockIn_(aContext),aValue,aContext) 
""","ValueNode_assignValue_in_")
,"evaluating","""assignValue: aValue in: aContext
	" Private - Set the receiver's value to aValue.
	WARNING: The receiver MUST return the value set. "

	(self enter: aContext) ifFalse: [
		^aContext at: value put: aValue
	].
	^binding
		assign: (self followBlockIn: aContext)
		to: aValue in: aContext """,nil)

smalltalk.bind(smalltalk.VariableNode,"index:in:",0
,smalltalk.__f__("""(self,anObject,aContext):
	#VariableNode>>#index:in:
	def __blk1__(result,index):
		def __blk2__():
			nil 
		return smalltalk.basic_at_ifAbsent_(result,self.key_in_(index,aContext),smalltalk.blk(__blk2__,0)) 
	if smalltalk.b(smalltalk.isNil_(getattr(self,"@indices",nil))):
		return anObject 
	 
	return getattr(self,"@indices",nil).inject_into_(anObject,smalltalk.blk(__blk1__,2)) 
""","VariableNode_index_in_")
,"indexing","""index: anObject in: aContext
	" Private - Returns the result of indexing anObject. "

	indices isNil ifTrue: [ ^anObject ].
	^indices inject: anObject into: [:result :index|
		result	basicAt: (self key: index in: aContext)
			ifAbsent: [ ]
	]""",nil)

smalltalk.bind(smalltalk.VariableNode,"key:in:",0
,smalltalk.__f__("""(self,index,aContext):
	#VariableNode>>#key:in:
	def __blk1__():
		return index.evaluateIn_(aContext) 
	def __blk2__():
		return index 
	return smalltalk.if_true_false_(smalltalk.is_kindOf_(index,(smalltalk.CompilerNode)),smalltalk.blk(__blk1__,0),smalltalk.blk(__blk2__,0)) 
""","VariableNode_key_in_")
,"indexing","""key: index in: aContext
	" Private - Returns the key to index an object in aContext. "

	^(index isKindOf: CompilerNode)
		ifTrue: [ index evaluateIn: aContext ]
		ifFalse: [ index ]""",nil)

smalltalk.bind(smalltalk.VariableNode,"initializeBinding:",0
,smalltalk.__f__("""(self,aContext):
	#VariableNode>>#initializeBinding:
	if smalltalk.b(smalltalk.newArray(["self","super"]).includes_(getattr(self,"@value",nil))):
		smalltalk.basic_at_put(self,"@binding",smalltalk.S8Binding.key_(smalltalk.String("self")))
		return getattr(self,"@binding",nil) 
	 
	if smalltalk.b(smalltalk.isObject_equalTo_(getattr(self,"@value",nil),smalltalk.String("nil"))):
		smalltalk.basic_at_put(self,"@value",nil) 
		smalltalk.basic_at_put(self,"@binding",smalltalk.String("constant"))
		return getattr(self,"@binding",nil) 
	 
	if smalltalk.b(smalltalk.newArray(["true","false"]).includes_(getattr(self,"@value",nil))):
		smalltalk.basic_at_put(self,"@value",smalltalk.isObject_equalTo_(getattr(self,"@value",nil),smalltalk.String("true"))) 
		smalltalk.basic_at_put(self,"@binding",smalltalk.String("constant"))
		return getattr(self,"@binding",nil) 
	 
	if smalltalk.b((aContext.self()).__class__.allInstVarNames().includes_(self.value())):
		smalltalk.basic_at_put(self,"@binding",smalltalk.S8Binding.toInstanceVariable_(self.value()))
		return getattr(self,"@binding",nil) 
	 
	smalltalk.basic_at_put(self,"@binding",smalltalk.S8Binding.key_(getattr(self,"@value",nil))) 
	return self 
""","VariableNode_initializeBinding_")
,"initialize","""initializeBinding: aContext
	" Private - Initialize the binding of the receiver. "

	(#( #self #super ) includes: value) ifTrue: [
		^binding := S8Binding key: #self
	].
	value = #nil ifTrue: [
		value := nil.
		^binding := #constant
	].
	(#( #true #false ) includes: value) ifTrue: [
		value := value = #true.
		^binding := #constant
	].
	(aContext self class allInstVarNames includes: self value) ifTrue: [
		^binding := S8Binding toInstanceVariable: self value
	].

	binding := S8Binding key: value """,nil)

smalltalk.bind(smalltalk.VariableNode,"clear:",0
,smalltalk.__f__("""(self,aContext):
	#VariableNode>>#clear:
	self.enter_(aContext) 
	if smalltalk.b(smalltalk.isObject_equalTo_(getattr(self,"@binding",nil),smalltalk.String("constant"))):
		return self.error_(smalltalk.String("Should not be constant")) 
	 
	return smalltalk.superReceiver(smalltalk.VariableNode,self).clear_(aContext) 
""","VariableNode_clear_")
,"evaluating","""clear: aContext
	" Clear the receiver's contents. "

	self enter: aContext.
	binding = #constant ifTrue: [
		^self error: 'Should not be constant'
	].
	^super clear: aContext """,nil)

smalltalk.bind(smalltalk.VariableNode,"followBlockIn:",0
,smalltalk.__f__("""(self,aContext):
	#VariableNode>>#followBlockIn:
	def __blk1__():
		def __blk2__(root):
			return self.follow_in_(root,aContext) 
		return smalltalk.blk(__blk2__,1) 
	return smalltalk.if_true_false_(smalltalk.notNil_(getattr(self,"@indices",nil)),smalltalk.blk(__blk1__,0),nil) 
""","VariableNode_followBlockIn_")
,"evaluating","""followBlockIn: aContext
	" Private - Returns the block to follow indices. "

	^indices notNil ifTrue: [ [:root| self follow: root in: aContext ] ] """,nil)

smalltalk.bind(smalltalk.VariableNode,"follow:in:",0
,smalltalk.__f__("""(self,anObject,aContext):
	#VariableNode>>#follow:in:
	__0__=smalltalk.newContext()
	def __blk1__(i):
		def __blk2__():
			nil 
		__0__.index=self.key_in_(getattr(self,"@indices",nil).at_(i),aContext) 
		__0__.target=smalltalk.basic_at_ifAbsent_(__0__.target,__0__.index,smalltalk.blk(__blk2__,0))
		return __0__.target 
	__0__.target=nil
	__0__.index=nil
	if smalltalk.b(smalltalk.isNil_(getattr(self,"@indices",nil))):
		return nil 
	 
	__0__.target=anObject 
	smalltalk.Number(1).to_do_(getattr(self,"@indices",nil).size()._minus(smalltalk.Number(1)),smalltalk.blk(__blk1__,1)) 
	__0__.index=self.key_in_(getattr(self,"@indices",nil).last(),aContext) 
	return smalltalk.Array.with_with_(__0__.target,__0__.index) 
""","VariableNode_follow_in_")
,"indexing","""follow: anObject in: aContext
	" Private - Returns the result of following the indices from anObject and last index to evaluate (or nil). "

	| target index |
	indices isNil ifTrue: [ ^nil ].
	target := anObject.
	1 to: indices size - 1 do: [:i|
		index := self key: (indices at: i) in: aContext.
		target := target basicAt: index ifAbsent: []
	].
	index := self key: indices last in: aContext.
	^Array with: target with: index """,nil)

smalltalk.bind(smalltalk.VariableNode,"send:to:withArguments:in:",0
,smalltalk.__f__("""(self,selector,anObject,anArray,aContext):
	#VariableNode>>#send:to:withArguments:in:
	__0__=smalltalk.newContext()
	__0__.anImplementor=nil
	__0__.anImplementor=(aContext.self()).__class__ 
	if smalltalk.b(smalltalk.isNil_(__0__.anImplementor)):
		__0__.anImplementor=(anObject).__class__ 
	 
	return self.apply_to_withArguments_in_(self.functionToCall_in_(selector,__0__.anImplementor),anObject,anArray,aContext) 
""","VariableNode_send_to_withArguments_in_")
,"evaluating","""send: selector to: anObject withArguments: anArray in: aContext
	" Private - Returns the result of sending message to anObject in aContext. "

	| anImplementor |
	anImplementor := aContext self class.
	anImplementor isNil ifTrue: [ anImplementor := anObject class ].
	^self	apply: (self functionToCall: selector in: anImplementor)
		to: anObject withArguments: anArray
		in: aContext """,nil)

smalltalk.bind(smalltalk.VariableNode,"functionToCall:in:",0
,smalltalk.__f__("""(self,selector,anImplementor):
	#VariableNode>>#functionToCall:in:
	return smalltalk.nativeCall(smalltalk.Smalltalk.current(),smalltalk.String("superImplementor"),anImplementor,selector) 
""","VariableNode_functionToCall_in_")
,"evaluating","""functionToCall: selector in: anImplementor
	" Private - Returns the native function to call for selector. "

	^Smalltalk current
		#superImplementor: anImplementor
		of: selector """,nil)

smalltalk.bind(smalltalk.VariableNode,"apply:to:withArguments:in:",0
,smalltalk.__f__("""(self,fn,anObject,anArray,aContext):
	#VariableNode>>#apply:to:withArguments:in:
	return fn(anObject,*smalltalk.objects_toCall_(anArray,fn)) 
""","VariableNode_apply_to_withArguments_in_")
,"evaluating","""apply: fn to: anObject withArguments: anArray in: aContext
	" Private - Returns the result of evaluating the native function in anObject @ aContext. "

	^{''
	js'fn.apply(anObject,anArray)'
	lua'fn(anObject,(table.unpack or unpack)(anArray))'
	py'fn(anObject,*smalltalk.objects_toCall_(anArray,fn))'}. """,nil)

smalltalk.bind(smalltalk.AlienNode,"initializeBinding:",0
,smalltalk.__f__("""(self,aContext):
	#AlienNode>>#initializeBinding:
	def __blk1__():
		return smalltalk.Smalltalk.nativeObjectAt_(getattr(self,"@value",nil)) 
	smalltalk.basic_at_put(self,"@binding",smalltalk.S8Binding.key_(smalltalk.blk(__blk1__,0))) 
	return self 
""","AlienNode_initializeBinding_")
,"initialize","""initializeBinding: aContext
	" Private - Initialize the binding of the receiver. "

	binding := S8Binding key: [ Smalltalk nativeObjectAt: value ] """,nil)

smalltalk.bind(smalltalk.GlobalReferenceNode,"bindingIn:",0
,smalltalk.__f__("""(self,aContext):
	_s8Ret_=smalltalk.newContext()
	try:
		#GlobalReferenceNode>>#bindingIn:
		__0__=smalltalk.newContext()
		def __blk1__():
			return __0__.cls.instanceClass() 
		def __blk2__():
			return (nil).__class__ 
		def __blk3__(each):
			__1__=smalltalk.newContext()
			def __blk4__():
				return __1__.vars.includesKey_(__0__.aName) 
			def __blk5__():
				return smalltalk.raise_result_(_s8Ret_,smalltalk.S8Binding.key_in_(__0__.aName,__1__.vars)) 
			__1__.vars=nil
			__1__.vars=each.classVariables() 
			return smalltalk.if_true_false_(smalltalk.boolean_and_(smalltalk.notNil_(__1__.vars),smalltalk.blk(__blk4__,0)),smalltalk.blk(__blk5__,0),nil) 
		def __blk6__(poolName,pool):
			def __blk7__():
				return smalltalk.raise_result_(_s8Ret_,smalltalk.S8Binding.key_in_(__0__.aName,__0__.st.at_(poolName))) 
			return smalltalk.if_true_false_(pool.includesKey_(__0__.aName),smalltalk.blk(__blk7__,0),nil) 
		__0__.st=nil
		__0__.cls=nil
		__0__.aName=nil
		__0__.aName=self.value() 
		__0__.cls=(aContext.self()).__class__ 
		__0__.cls=smalltalk.if_true_false_(smalltalk.notNil_(__0__.cls),smalltalk.blk(__blk1__,0),smalltalk.blk(__blk2__,0)) 
		__0__.st=aContext.self().smalltalk() 
		__0__.cls.withAllSuperclassesDo_(smalltalk.blk(__blk3__,1)) 
		__0__.cls.sharedPoolsAndNamesDo_(smalltalk.blk(__blk6__,2)) 
		smalltalk.raise_result_(_s8Ret_,smalltalk.S8Binding.key_in_(__0__.aName,__0__.st)) 
	except Exception as __ex:
		if smalltalk.exception_at(__ex,_s8Ret_):
			return smalltalk.exceptionResult_(__ex)
		raise __ex
	
""","GlobalReferenceNode_bindingIn_")
,"visiting","""bindingIn: aContext
	" Private - Returns the binding of the receiver. "

	| st cls aName |
	aName := self value.
	cls := aContext self class.
	cls := cls notNil
		ifTrue: [ cls instanceClass ]
		ifFalse: [ nil class ].
	st := aContext self smalltalk.
	cls withAllSuperclassesDo: [:each| | vars |
		vars := each classVariables.
		(vars notNil and: [ vars includesKey: aName ]) ifTrue: [
			^S8Binding key: aName in: vars
		]
	].
	cls sharedPoolsAndNamesDo: [:poolName :pool|
		(pool includesKey: aName) ifTrue: [
			^S8Binding
				key: aName
				in: (st at: poolName)
		]
	].
	^S8Binding key: aName in: st """,nil)

smalltalk.bind(smalltalk.GlobalReferenceNode,"initializeBinding:",0
,smalltalk.__f__("""(self,aContext):
	#GlobalReferenceNode>>#initializeBinding:
	smalltalk.basic_at_put(self,"@binding",self.bindingIn_(aContext)) 
	return self 
""","GlobalReferenceNode_initializeBinding_")
,"visiting","""initializeBinding: aContext
	" Private - Initialize the binding of the receiver. "

	binding := self bindingIn: aContext """,nil)

smalltalk.bind(smalltalk.NoReceiverNode,"isOO",0
,smalltalk.__f__("""(self):
	#NoReceiverNode>>#isOO
	return smalltalk.false 
""","NoReceiverNode_isOO")
,"query","""isOO
	" Returns true if the receiver refers to an object. "

	^false """,nil)

smalltalk.bind(smalltalk.NoReceiverNode,"send:to:withArguments:in:",0
,smalltalk.__f__("""(self,msg,anObject,anArray,aContext):
	_s8Ret_=smalltalk.newContext()
	try:
		#NoReceiverNode>>#send:to:withArguments:in:
		__0__=smalltalk.newContext()
		def __blk1__():
			return smalltalk.raise_result_(_s8Ret_,self.error_(smalltalk.object_comma_(smalltalk.String("Missing native function "),__0__.selector.asLiteral()))) 
		__0__.fn=nil
		__0__.selector=nil
		__0__.selector=smalltalk.SendNode.selectorToSend_(msg) 
		if smalltalk.b(smalltalk.isObject_equalTo_(__0__.selector,smalltalk.String("self"))):
			self.note_(smalltalk.object_comma_((self).__class__.name(),smalltalk.String(">>#send:to:... need testing"))) 
			smalltalk.raise_result_(_s8Ret_,aContext.self().evaluateWithArguments_(anArray)) 
		 
		__0__.fn=smalltalk.Smalltalk.nativeObjectAt_ifAbsent_(__0__.selector,smalltalk.blk(__blk1__,0)) 
		smalltalk.raise_result_(_s8Ret_,fn(anObject,*smalltalk.objects_toCall_(anArray,fn))) 
	except Exception as __ex:
		if smalltalk.exception_at(__ex,_s8Ret_):
			return smalltalk.exceptionResult_(__ex)
		raise __ex
	
""","NoReceiverNode_send_to_withArguments_in_")
,"evaluating","""send: msg to: anObject withArguments: anArray in: aContext
	" Private - Returns the result of sending message to anObject in aContext. "

	| fn selector |
	selector := SendNode selectorToSend: msg.
	selector = #self ifTrue: [
		self note: self class name,'>>#send:to:... need testing'.
		^aContext self evaluateWithArguments: anArray
	].
	fn := Smalltalk nativeObjectAt: selector ifAbsent: [
		^self error: 'Missing native function ' ,selector asLiteral
	].
	^{''
	js'fn.apply(anObject,anArray)'
	lua'fn(anObject,(table.unpack or unpack)(anArray))'
	py'fn(anObject,*smalltalk.objects_toCall_(anArray,fn))'}. """,nil)

smalltalk.bind(smalltalk.JSDirectiveNode,"evaluateIn:",0
,smalltalk.__f__("""(self,aContext):
	#JSDirectiveNode>>#evaluateIn:
	return self.error_(smalltalk.String("Directive support missing")) 
""","JSDirectiveNode_evaluateIn_")
,"evaluating","""evaluateIn: aContext
	" Returns the result of evaluating the receiver in aContext. "

	^self error: 'Directive support missing' """,nil)
