
# fileIn("s8/library/scripting/Bindings.st")
smalltalk.addClass("S8BindingObject",smalltalk.Object,nil,"Bindings")

smalltalk.addClass("S8Binding",smalltalk.S8BindingObject,["key","source"],"Bindings")

smalltalk.addClass("S8LiteralBinding",smalltalk.S8Binding,nil,"Bindings")

smalltalk.addClass("S8CopyBinding",smalltalk.S8LiteralBinding,nil,"Bindings")

smalltalk.addClass("S8Context",smalltalk.S8BindingObject,["parent","locals","home"],"Bindings")

smalltalk.addClass("S8Block",smalltalk.S8BindingObject,["node","context"],"Bindings")
setattr(smalltalk.S8Block,"$classVariableNames","Optimizations")

smalltalk.bind(smalltalk.S8Context.__class__,"in:",0
,smalltalk.__f__("""(self,aContext):
	#S8Context class>>#in:
	return self.basicNew().initialize_with_(aContext,smalltalk.PoolDictionary.new()) 
""","S8Context_class_in_")
,"instantiation","""in: aContext
	" Returns an instance of the receiver. "

	^self basicNew
		initialize: aContext
		with: PoolDictionary new""",nil)

smalltalk.bind(smalltalk.S8Context.__class__,"in:clear:do:",0
,smalltalk.__f__("""(self,aContext,array,aBlock):
	#S8Context class>>#in:clear:do:
	__0__=smalltalk.newContext()
	def __blk1__(each):
		return each.clear_(__0__.ctx) 
	__0__.ctx=nil
	__0__.ctx=self.in_(aContext) 
	array.do_(smalltalk.blk(__blk1__,1)) 
	return aBlock.value_(__0__.ctx) 
""","S8Context_class_in_clear_do_")
,"activation","""in: aContext clear: array do: aBlock
	" Activates a new context in aContext and evaluate aBlock clearing temporaries array. "

	| ctx |
	ctx := self in: aContext.
	array do: [:each| each clear: ctx ].
	^aBlock value: ctx """,nil)

smalltalk.bind(smalltalk.S8Context.__class__,"for:",0
,smalltalk.__f__("""(self,aReceiver):
	#S8Context class>>#for:
	def __blk1__(_s8_rec):
		_s8_rec.self_(aReceiver) 
		return _s8_rec.yourself() 
	return __blk1__(self.in_(nil)) 
""","S8Context_class_for_")
,"instantiation","""for: aReceiver
	" Returns an instance of the receiver. "

	^(self in: nil)
		self: aReceiver;
		yourself""",nil)

smalltalk.bind(smalltalk.S8Context,"initialize:with:",0
,smalltalk.__f__("""(self,aContext,aPoolDictionary):
	#S8Context>>#initialize:with:
	smalltalk.basic_at_put(self,"@parent",aContext) 
	smalltalk.basic_at_put(self,"@locals",aPoolDictionary) 
	return self 
""","S8Context_initialize_with_")
,"initialize","""initialize: aContext with: aPoolDictionary
	" Private - Initialize the receiver. "

	parent := aContext.
	locals := aPoolDictionary.""",nil)

smalltalk.bind(smalltalk.S8Context,"clear:",0
,smalltalk.__f__("""(self,aBinding):
	#S8Context>>#clear:
	return getattr(self,"@locals",nil).at_put_(aBinding.key(),nil) 
""","S8Context_clear_")
,"setup","""clear: aBinding
	" Clear the local value for aBinding. "

	^locals at: aBinding key put: nil """,nil)

smalltalk.bind(smalltalk.S8Context,"home",0
,smalltalk.__f__("""(self):
	#S8Context>>#home
	def __blk1__():
		return getattr(self,"@parent",nil).home() 
	if smalltalk.b(smalltalk.notNil_(getattr(self,"@home",nil))):
		return getattr(self,"@home",nil) 
	 
	return smalltalk.if_true_false_(smalltalk.notNil_(getattr(self,"@parent",nil)),smalltalk.blk(__blk1__,0),nil) 
""","S8Context_home")
,"accessing","""home
	" Returns the home context of the receiver (or nil). "

	home notNil ifTrue: [ ^home ].
	^parent notNil ifTrue: [ parent  home ] """,nil)

smalltalk.bind(smalltalk.S8Context,"home:",0
,smalltalk.__f__("""(self,anObject):
	#S8Context>>#home:
	smalltalk.basic_at_put(self,"@home",anObject) 
	return self 
""","S8Context_home_")
,"accessing","""home: anObject
	" Set the home context of the receiver. "

	home := anObject """,nil)

smalltalk.bind(smalltalk.S8Context,"at:",0
,smalltalk.__f__("""(self,aKey):
	#S8Context>>#at:
	def __blk1__():
		def __blk2__():
			return getattr(self,"@parent",nil).at_(aKey) 
		return smalltalk.if_true_false_(smalltalk.notNil_(getattr(self,"@parent",nil)),smalltalk.blk(__blk2__,0),nil) 
	return getattr(self,"@locals",nil).at_ifAbsent_(aKey,smalltalk.blk(__blk1__,0)) 
""","S8Context_at_")
,"accessing","""at: aKey
	" Returns the value for aKey in the receiver (or nil). "

	^locals at: aKey ifAbsent: [
		parent notNil ifTrue: [
			parent at: aKey
		]
	]""",nil)

smalltalk.bind(smalltalk.S8Context,"set:to:",0
,smalltalk.__f__("""(self,aKey,aValue):
	#S8Context>>#set:to:
	def __blk1__():
		return getattr(self,"@parent",nil).set_to_(aKey,aValue) 
	if smalltalk.b(getattr(self,"@locals",nil).includesKey_(aKey)):
		getattr(self,"@locals",nil).at_put_(aKey,aValue) 
		return smalltalk.true 
	 
	return smalltalk.boolean_and_(smalltalk.notNil_(getattr(self,"@parent",nil)),smalltalk.blk(__blk1__,0)) 
""","S8Context_set_to_")
,"private","""set: aKey to: aValue
	" Private - Returns true if the receiver change the value for aKey to aValue. "

	(locals includesKey: aKey) ifTrue: [
		locals at: aKey put: aValue.
		^true
	].
	^parent notNil and: [ parent set: aKey to: aValue ] """,nil)

smalltalk.bind(smalltalk.S8Context,"at:put:",0
,smalltalk.__f__("""(self,aKey,aValue):
	_s8Ret_=smalltalk.newContext()
	try:
		#S8Context>>#at:put:
		if not smalltalk.b(getattr(self,"@locals",nil).includesKey_(aKey)):
			def __blk1__():
				return getattr(self,"@parent",nil).set_to_(aKey,aValue) 
			def __blk2__():
				return smalltalk.raise_result_(_s8Ret_,aValue) 
			smalltalk.if_true_false_(smalltalk.boolean_and_(smalltalk.notNil_(getattr(self,"@parent",nil)),smalltalk.blk(__blk1__,0)),smalltalk.blk(__blk2__,0),nil) 
		 
		smalltalk.raise_result_(_s8Ret_,getattr(self,"@locals",nil).at_put_(aKey,aValue)) 
	except Exception as __ex:
		if smalltalk.exception_at(__ex,_s8Ret_):
			return smalltalk.exceptionResult_(__ex)
		raise __ex
	
""","S8Context_at_put_")
,"accessing","""at: aKey put: aValue
	" Set the value for aKey in the receiver to aValue. "

	(locals includesKey: aKey) ifFalse: [
		(parent notNil and: [ parent set: aKey to: aValue ])
		ifTrue: [ ^aValue ].
	].
	^locals at: aKey put: aValue """,nil)

smalltalk.bind(smalltalk.S8Context,"self:",0
,smalltalk.__f__("""(self,anObject):
	#S8Context>>#self:
	return self.at_put_(smalltalk.String("self"),anObject) 
""","S8Context_self_")
,"accessing","""self: anObject
	" Set the object bound to self in the receiver. "

	^self at: #self put: anObject """,nil)

smalltalk.bind(smalltalk.S8Context,"self",0
,smalltalk.__f__("""(self):
	#S8Context>>#self
	return self.at_(smalltalk.String("self")) 
""","S8Context_self")
,"accessing","""self
	" Returns the object bound to self in the receiver. "

	^self at: #self """,nil)

smalltalk.bind(smalltalk.S8Context,"associationsDo:",0
,smalltalk.__f__("""(self,aBlock):
	#S8Context>>#associationsDo:
	if smalltalk.b(smalltalk.notNil_(getattr(self,"@parent",nil))):
		getattr(self,"@parent",nil).associationsDo_(aBlock) 
	 
	if smalltalk.b(smalltalk.notNil_(getattr(self,"@locals",nil))):
		getattr(self,"@locals",nil).associationsDo_(aBlock) 
	 
	return self 
""","S8Context_associationsDo_")
,"accessing","""associationsDo: aBlock
	" Evaluates aBlock on each association in the receiver. "

	parent notNil ifTrue: [
		parent associationsDo: aBlock
	].
	locals notNil ifTrue: [
		locals associationsDo: aBlock
	].""",nil)

smalltalk.bind(smalltalk.S8Binding.__class__,"key:",0
,smalltalk.__f__("""(self,aKey):
	#S8Binding class>>#key:
	return self.basicNew().initialize_source_(aKey,nil) 
""","S8Binding_class_key_")
,"instantiating","""key: aKey
	" Return an instance of the receiver. "

	^self basicNew initialize: aKey source: nil """,nil)

smalltalk.bind(smalltalk.S8Binding.__class__,"key:in:",0
,smalltalk.__f__("""(self,aKey,aDictionary):
	#S8Binding class>>#key:in:
	return self.basicNew().initialize_source_(aKey,aDictionary) 
""","S8Binding_class_key_in_")
,"instantiating","""key: aKey in: aDictionary
	" Return an instance of the receiver. "

	^self basicNew initialize: aKey source: aDictionary """,nil)

smalltalk.bind(smalltalk.S8Binding.__class__,"key:evaluate:assign:",0
,smalltalk.__f__("""(self,aKey,oneArgumentBlock,threeArgumentBlock):
	#S8Binding class>>#key:evaluate:assign:
	__0__=smalltalk.newContext()
	def __blk1__(_s8_rec):
		def __blk2__():
			return aKey 
		_s8_rec.at_put_(smalltalk.String("key"),smalltalk.blk(__blk2__,0)) 
		_s8_rec.at_put_(smalltalk.String("evaluateIn:"),oneArgumentBlock) 
		_s8_rec.at_put_(smalltalk.String("assign:to:in:"),threeArgumentBlock) 
		return _s8_rec.yourself() 
	def __blk3__(what,arg1,arg2,arg3):
		return __0__.pool.at_(what).evaluateWithArguments_(smalltalk.Array.with_with_with_(arg1,arg2,arg3)) 
	__0__.aBlock=nil
	__0__.pool=nil
	__0__.pool=smalltalk.PoolDictionary.new() 
	__blk1__(__0__.pool) 
	__0__.aBlock=smalltalk.blk(__blk3__,4) 
	return self.basicNew().initialize_source_(__0__.aBlock,nil) 
""","S8Binding_class_key_evaluate_assign_")
,"instantiating","""key: aKey evaluate: oneArgumentBlock assign: threeArgumentBlock
	" Return an instance of the receiver. "

	| aBlock pool |
	pool := PoolDictionary new.
	pool	at: #key put: [ aKey ];
		at: #evaluateIn: put: oneArgumentBlock;
		at: #assign:to:in: put: threeArgumentBlock;
		yourself.
	aBlock := [:what :arg1 :arg2 :arg3 |
		(pool at: what) evaluateWithArguments: (Array with: arg1 with: arg2 with: arg3)
	].
	^self basicNew initialize: aBlock source: nil """,nil)

smalltalk.bind(smalltalk.S8Binding.__class__,"toInstanceVariable:",0
,smalltalk.__f__("""(self,key):
	#S8Binding class>>#toInstanceVariable:
	__0__=smalltalk.newContext()
	def __blk1__(ctx):
		return ctx.self().instVarAt_(key) 
	def __blk2__(ndx,value,ctx):
		def __blk3__():
			return ctx.self().instVarAt_put_(key,value) 
		def __blk4__():
			__2__=smalltalk.newContext()
			__2__.target=nil
			__2__.target=ndx.value_(__0__.getter.value_(ctx)) 
			return smalltalk.basic_at_put_(__2__.target.first(),__2__.target.last(),value) 
		return smalltalk.if_true_false_(smalltalk.isNil_(ndx),smalltalk.blk(__blk3__,0),smalltalk.blk(__blk4__,0)) 
	__0__.getter=nil
	__0__.getter=smalltalk.blk(__blk1__,1) 
	return self.key_evaluate_assign_(key,__0__.getter,smalltalk.blk(__blk2__,3)) 
""","S8Binding_class_toInstanceVariable_")
,"instantiating","""toInstanceVariable: key
	" Return an instance of the receiver. "

	| getter |
	getter := [:ctx| ctx self instVarAt: key ].
	^self	key: key evaluate: getter
		assign: [:ndx :value :ctx|
			ndx isNil
			ifTrue: [ ctx self instVarAt: key put: value ]
			ifFalse: [ | target |
				target := ndx value: (getter value: ctx).
				target first basicAt: target last put: value
			]
		] """,nil)

smalltalk.bind(smalltalk.S8Binding,"initialize:source:",0
,smalltalk.__f__("""(self,aKeyOrBlock,aSource):
	#S8Binding>>#initialize:source:
	smalltalk.basic_at_put(self,"@key",aKeyOrBlock) 
	smalltalk.basic_at_put(self,"@source",aSource) 
	return self 
""","S8Binding_initialize_source_")
,"initialize","""initialize: aKeyOrBlock source: aSource
	" Private - Initialize the receiver. "

	key := aKeyOrBlock.
	source := aSource. """,nil)

smalltalk.bind(smalltalk.S8Binding,"key",0
,smalltalk.__f__("""(self):
	#S8Binding>>#key
	if not smalltalk.b(getattr(self,"@key",nil).isString()):
		return getattr(self,"@key",nil).evaluateWith_(smalltalk.String("key")) 
	 
	return getattr(self,"@key",nil) 
""","S8Binding_key")
,"accessing","""key
	" Return the key of the receiver. "

	key isString ifFalse: [ ^key evaluateWith: #key ].
	^key """,nil)

smalltalk.bind(smalltalk.S8Binding,"source",0
,smalltalk.__f__("""(self):
	#S8Binding>>#source
	return getattr(self,"@source",nil) 
""","S8Binding_source")
,"accessing","""source
	" Private - Return the source of the receiver. "

	^source """,nil)

smalltalk.bind(smalltalk.S8Binding,"local",0
,smalltalk.__f__("""(self):
	#S8Binding>>#local
	smalltalk.basic_at_put(self,"@source",nil) 
	return self 
""","S8Binding_local")
,"scope","""local
	" Returns the receiver acting on runtime context scope. "

	source := nil """,nil)

smalltalk.bind(smalltalk.S8Binding,"evaluateIn:",0
,smalltalk.__f__("""(self,aContext):
	#S8Binding>>#evaluateIn:
	if not smalltalk.b(getattr(self,"@key",nil).isString()):
		return getattr(self,"@key",nil).evaluateWithArguments_(smalltalk.Array.with_with_(smalltalk.String("evaluateIn:"),aContext)) 
	 
	if smalltalk.b(smalltalk.notNil_(getattr(self,"@source",nil))):
		def __blk1__():
			nil 
		return getattr(self,"@source",nil).at_ifAbsent_(getattr(self,"@key",nil),smalltalk.blk(__blk1__,0)) 
	 
	return aContext.at_(getattr(self,"@key",nil)) 
""","S8Binding_evaluateIn_")
,"evaluating","""evaluateIn: aContext
	" Returns the result of evaluating the receiver in aContext. "

	key isString ifFalse: [
		^key evaluateWithArguments: (Array with: #evaluateIn: with: aContext)
	].
	source notNil ifTrue: [ ^source at: key ifAbsent: [] ].
	^aContext at: key """,nil)

smalltalk.bind(smalltalk.S8Binding,"assign:to:in:",0
,smalltalk.__f__("""(self,indexBlock,aValue,aContext):
	#S8Binding>>#assign:to:in:
	__0__=smalltalk.newContext()
	def __blk1__():
		return aContext 
	def __blk2__():
		return getattr(self,"@source",nil) 
	__0__.target=nil
	if not smalltalk.b(getattr(self,"@key",nil).isString()):
		return getattr(self,"@key",nil).evaluateWithArguments_(smalltalk.Array.with_with_with_with_(smalltalk.String("assign:to:in:"),indexBlock,aValue,aContext)) 
	 
	__0__.target=smalltalk.if_true_false_(smalltalk.isNil_(getattr(self,"@source",nil)),smalltalk.blk(__blk1__,0),smalltalk.blk(__blk2__,0)) 
	if smalltalk.b(smalltalk.isNil_(indexBlock)):
		return __0__.target.at_put_(getattr(self,"@key",nil),aValue) 
	 
	__0__.target=indexBlock.value_(__0__.target.at_(getattr(self,"@key",nil))) 
	return smalltalk.basic_at_put_(__0__.target.first(),__0__.target.last(),aValue) 
""","S8Binding_assign_to_in_")
,"evaluating","""assign: indexBlock to: aValue in: aContext
	" Set the value for the receiver in aContext. "

	| target |
	key isString ifFalse: [
		^key evaluateWithArguments: (Array
			with: #assign:to:in:
			with: indexBlock with: aValue
			with: aContext)
	].
	target := source isNil ifTrue: [aContext] ifFalse: [source].
	indexBlock isNil ifTrue: [ ^target at: key put: aValue ].
	target := indexBlock value: (target at: key).
	^target first basicAt: target last put: aValue """,nil)

smalltalk.bind(smalltalk.S8LiteralBinding.__class__,"value:",0
,smalltalk.__f__("""(self,aValue):
	#S8LiteralBinding class>>#value:
	return self.basicNew().initialize_source_(smalltalk.String("constant"),aValue) 
""","S8LiteralBinding_class_value_")
,"instantiating","""value: aValue
	" Return an instance of the receiver. "

	^self basicNew initialize: #constant source: aValue """,nil)

smalltalk.bind(smalltalk.S8LiteralBinding,"assign:to:in:",0
,smalltalk.__f__("""(self,indexBlock,aValue,aContext):
	#S8LiteralBinding>>#assign:to:in:
	return self.invalidMessage_(smalltalk.String("assign:to:in:")) 
""","S8LiteralBinding_assign_to_in_")
,"evaluating","""assign: indexBlock to: aValue in: aContext
	" Set the value for the receiver in aContext. "

	^self invalidMessage: #assign:to:in: """,nil)

smalltalk.bind(smalltalk.S8LiteralBinding,"evaluateIn:",0
,smalltalk.__f__("""(self,aContext):
	#S8LiteralBinding>>#evaluateIn:
	return getattr(self,"@source",nil) 
""","S8LiteralBinding_evaluateIn_")
,"evaluating","""evaluateIn: aContext
	" Returns the result of evaluating the receiver in aContext. "

	^source """,nil)

smalltalk.bind(smalltalk.S8CopyBinding,"evaluateIn:",0
,smalltalk.__f__("""(self,aContext):
	#S8CopyBinding>>#evaluateIn:
	return getattr(self,"@source",nil).shallowCopy() 
""","S8CopyBinding_evaluateIn_")
,"evaluating","""evaluateIn: aContext
	" Returns the result of evaluating the receiver in aContext. "

	^source shallowCopy """,nil)

smalltalk.bind(smalltalk.S8Block.__class__,"defaultOptimizations",0
,smalltalk.__f__("""(self):
	#S8Block class>>#defaultOptimizations
	def __blk1__(_s8_rec):
		def __blk2__(receiver,msg,values,context):
			return (receiver).__class__ 
		def __blk3__(receiver,msg,values,context):
			return smalltalk.isNil_(receiver) 
		def __blk4__(receiver,msg,values,context):
			return smalltalk.notNil_(receiver) 
		def __blk5__(receiver,msg,values,context):
			return smalltalk.b_(receiver is values.first()) 
		def __blk6__(receiver,msg,values,context):
			return receiver._eq_eq_eq(values.first()) 
		def __blk7__(receiver,msg,values,context):
			return smalltalk.basic_at_(receiver,values.first()) 
		def __blk8__(receiver,msg,values,context):
			def __blk9__():
				return values.second().value() 
			return smalltalk.basic_at_ifAbsent_(receiver,values.first(),smalltalk.blk(__blk9__,0)) 
		def __blk10__(receiver,msg,values,context):
			return smalltalk.basic_at_put_(receiver,values.first(),values.second()) 
		def __blk11__(receiver,msg,values,context):
			return (receiver or nil) 
		def __blk12__(receiver,msg,values,context):
			return smalltalk.responds_to_(receiver,(values.first())) 
		_s8_rec.at_put_(smalltalk.String("class"),smalltalk.blk(__blk2__,4)) 
		_s8_rec.at_put_(smalltalk.String("isNil"),smalltalk.blk(__blk3__,4)) 
		_s8_rec.at_put_(smalltalk.String("notNil"),smalltalk.blk(__blk4__,4)) 
		_s8_rec.at_put_(smalltalk.String("=="),smalltalk.blk(__blk5__,4)) 
		_s8_rec.at_put_(smalltalk.String("==="),smalltalk.blk(__blk6__,4)) 
		_s8_rec.at_put_(smalltalk.String("basicAt:"),smalltalk.blk(__blk7__,4)) 
		_s8_rec.at_put_(smalltalk.String("basicAt:ifAbsent:"),smalltalk.blk(__blk8__,4)) 
		_s8_rec.at_put_(smalltalk.String("basicAt:put:"),smalltalk.blk(__blk10__,4)) 
		_s8_rec.at_put_(smalltalk.String("orNil"),smalltalk.blk(__blk11__,4)) 
		_s8_rec.at_put_(smalltalk.String("respondsTo:"),smalltalk.blk(__blk12__,4)) 
		return _s8_rec.yourself() 
	return __blk1__(smalltalk.PoolDictionary.new()) 
""","S8Block_class_defaultOptimizations")
,"actions","""defaultOptimizations
	" Private - Returns the default pool of optimized actions. "

	^PoolDictionary new
		at: #class put: [:receiver :msg :values :context| receiver class ];
		at: #isNil put: [:receiver :msg :values :context| receiver isNil ];
		at: #notNil put: [:receiver :msg :values :context| receiver notNil ];
		at: #== put: [:receiver :msg :values :context| receiver == values first ];
		at: #=== put: [:receiver :msg :values :context| receiver === values first ];
		at: #basicAt: put: [:receiver :msg :values :context| receiver basicAt: values first ];
		at: #basicAt:ifAbsent: put: [:receiver :msg :values :context|
			receiver basicAt: values first ifAbsent: [ values second value ] ];
		at: #basicAt:put: put: [:receiver :msg :values :context|
			receiver basicAt: values first put: values second ];
		at: #orNil put: [:receiver :msg :values :context| receiver orNil ];
		at: #respondsTo: put: [:receiver :msg :values :context|
			receiver respondsTo: values first ];
		yourself """,nil)

smalltalk.bind(smalltalk.S8Block.__class__,"optimizations",0
,smalltalk.__f__("""(self):
	#S8Block class>>#optimizations
	if smalltalk.b(smalltalk.isNil_(smalltalk.S8Block.classVariableAt_("Optimizations"))):
		smalltalk.S8Block.classVariableAt_put_("Optimizations",self.defaultOptimizations()) 
	 
	return smalltalk.S8Block.classVariableAt_("Optimizations") 
""","S8Block_class_optimizations")
,"actions","""optimizations
	" Private - Returns the pool of optimized actions. "

	Optimizations isNil ifTrue: [ Optimizations := self defaultOptimizations ].
	^Optimizations""",nil)

smalltalk.bind(smalltalk.S8Block.__class__,"for:in:",0
,smalltalk.__f__("""(self,aNode,aContext):
	#S8Block class>>#for:in:
	def __blk1__(_s8_rec):
		_s8_rec.node_(aNode) 
		_s8_rec.context_(aContext) 
		return _s8_rec.yourself() 
	return __blk1__(self.new()) 
""","S8Block_class_for_in_")
,"instantiation","""for: aNode in: aContext
	" Returns an instance of the receiver. "

	^self new
		node: aNode;
		context: aContext;
		yourself """,nil)

smalltalk.bind(smalltalk.S8Block,"node:",0
,smalltalk.__f__("""(self,aNode):
	#S8Block>>#node:
	smalltalk.basic_at_put(self,"@node",aNode) 
	return self 
""","S8Block_node_")
,"accessing","""node: aNode
	" Sets the receiver's parent node. "

	node := aNode """,nil)

smalltalk.bind(smalltalk.S8Block,"statements",0
,smalltalk.__f__("""(self):
	#S8Block>>#statements
	return getattr(self,"@node",nil).statements() 
""","S8Block_statements")
,"evaluating","""statements
	" Returns the receiver's statements. "

	^node statements """,nil)

smalltalk.bind(smalltalk.S8Block,"args",0
,smalltalk.__f__("""(self):
	#S8Block>>#args
	return getattr(self,"@node",nil).arguments() 
""","S8Block_args")
,"accessing","""args
	" Returns the receiver's arguments. "

	^node arguments """,nil)

smalltalk.bind(smalltalk.S8Block,"arguments",0
,smalltalk.__f__("""(self):
	#S8Block>>#arguments
	return getattr(self,"@node",nil).arguments() 
""","S8Block_arguments")
,"accessing","""arguments
	" Returns the receiver's arguments. "

	^node arguments """,nil)

smalltalk.bind(smalltalk.S8Block,"temporaries",0
,smalltalk.__f__("""(self):
	#S8Block>>#temporaries
	return getattr(self,"@node",nil).temporaries() 
""","S8Block_temporaries")
,"accessing","""temporaries
	" Returns the receiver's temporaries. "

	^node temporaries """,nil)

smalltalk.bind(smalltalk.S8Block,"argumentCount",0
,smalltalk.__f__("""(self):
	#S8Block>>#argumentCount
	return self.arguments().size() 
""","S8Block_argumentCount")
,"accessing","""argumentCount
	" Returns the number of arguments of the receiver. "

	^self arguments size """,nil)

smalltalk.bind(smalltalk.S8Block,"context:",0
,smalltalk.__f__("""(self,aContext):
	#S8Block>>#context:
	smalltalk.basic_at_put(self,"@context",aContext) 
	return self 
""","S8Block_context_")
,"accessing","""context: aContext
	" Sets the receiver's context. "

	context := aContext """,nil)

smalltalk.bind(smalltalk.S8Block,"bindTo:in:",0
,smalltalk.__f__("""(self,anArray,aContext):
	#S8Block>>#bindTo:in:
	__0__=smalltalk.newContext()
	def __blk1__(each):
		def __blk2__():
			return __0__.stream.next() 
		return each.assignValue_in_(smalltalk.if_true_false_(__0__.stream.atEnd(),nil,smalltalk.blk(__blk2__,0)),aContext) 
	def __blk3__(each):
		return each.assignValue_in_(nil,aContext) 
	__0__.args=nil
	__0__.stream=nil
	__0__.args=self.arguments() 
	if smalltalk.b(smalltalk.isObject_equalTo_(__0__.args.size(),smalltalk.Number(0))):
		return self 
	 
	if not smalltalk.b(smalltalk.isObject_equalTo_(__0__.args.size(),anArray.size())):
		pass
	 
	__0__.stream=anArray.stream() 
	__0__.args.do_(smalltalk.blk(__blk1__,1)) 
	self.temporaries().do_(smalltalk.blk(__blk3__,1)) 
	return self 
""","S8Block_bindTo_in_")
,"binding","""bindTo: anArray in: aContext
	" Private - Bind the arguments to values in anArray. "

	| args stream |
	args := self arguments.
	args size = 0 ifTrue: [ ^self ].
	args size = anArray size ifFalse: [
"		^self error: 'Invalid number of arguments.'	
DEBUG-		self note: 'Invalid number of arguments (' ,anArray size ,') must be ' ,args size
"	].

	stream := anArray stream.
	args do: [:each| each assignValue: (stream atEnd ifFalse: [ stream next ]) in: aContext ].
	self temporaries do: [:each| each assignValue: nil in: aContext ]. """,nil)

smalltalk.bind(smalltalk.S8Block,"asActionSequence",0
,smalltalk.__f__("""(self):
	#S8Block>>#asActionSequence
	return smalltalk.ActionSequence.with_(self) 
""","S8Block_asActionSequence")
,"converting","""asActionSequence
	" Return an ActionSequence from the receiver. "

	^ActionSequence with: self """,nil)

smalltalk.bind(smalltalk.S8Block,"valueBlock",0
,smalltalk.__f__("""(self):
	#S8Block>>#valueBlock
	def __blk1__():
		return self.value() 
	return smalltalk.blk(__blk1__,0) 
""","S8Block_valueBlock")
,"converting","""valueBlock
	" Private - Return the receiver as a native block to compute value. "

	^[ self value ] """,nil)

smalltalk.bind(smalltalk.S8Block,"ensure:",0
,smalltalk.__f__("""(self,aBlock):
	#S8Block>>#ensure:
	return self.valueBlock().ensure_(aBlock) 
""","S8Block_ensure_")
,"evaluating","""ensure: aBlock
	" Return the result of evaluating the receiver.
	Execute aBlock after the receiver is executed.
	"

	^self valueBlock ensure: aBlock """,nil)

smalltalk.bind(smalltalk.S8Block,"evaluate",0
,smalltalk.__f__("""(self):
	#S8Block>>#evaluate
	return self.value() 
""","S8Block_evaluate")
,"evaluating","""evaluate
	" Return the result of evaluating the receiver. "

	^self value """,nil)

smalltalk.bind(smalltalk.S8Block,"evaluateFor:",0
,smalltalk.__f__("""(self,anObject):
	#S8Block>>#evaluateFor:
	return self.evaluateWithArguments_(smalltalk.Array.with_(anObject)) 
""","S8Block_evaluateFor_")
,"evaluating","""evaluateFor: anObject
	" Return the result of evaluating the receiver with anObject. "

	^self evaluateWithArguments: (Array with: anObject) """,nil)

smalltalk.bind(smalltalk.S8Block,"evaluateWithArguments:",0
,smalltalk.__f__("""(self,anArray):
	#S8Block>>#evaluateWithArguments:
	def __blk1__():
		return self.value() 
	def __blk2__():
		return self.valueWithArguments_(anArray) 
	return smalltalk.if_true_false_(smalltalk.isObject_equalTo_(self.argumentCount(),smalltalk.Number(0)),smalltalk.blk(__blk1__,0),smalltalk.blk(__blk2__,0)) 
""","S8Block_evaluateWithArguments_")
,"evaluating","""evaluateWithArguments: anArray
	" Return the result of evaluating the receiver. "

	^self argumentCount = 0
		ifTrue: [ self value ]
		ifFalse: [ self valueWithArguments: anArray ] """,nil)

smalltalk.bind(smalltalk.S8Block,"evaluateWithoutInterrupts",0
,smalltalk.__f__("""(self):
	#S8Block>>#evaluateWithoutInterrupts
	return self.valueBlock().evaluateWithoutInterrupts() 
""","S8Block_evaluateWithoutInterrupts")
,"evaluating","""evaluateWithoutInterrupts
	" OBSOLETE - Disable interrupts, evaluate the receiver, enable interrupts, and answer the result of the evaluation. "

	^self valueBlock evaluateWithoutInterrupts """,nil)

smalltalk.bind(smalltalk.S8Block,"ifCurtailed:",0
,smalltalk.__f__("""(self,exceptionBlock):
	#S8Block>>#ifCurtailed:
	return self.valueBlock().ifCurtailed_(exceptionBlock) 
""","S8Block_ifCurtailed_")
,"evaluating","""ifCurtailed: exceptionBlock
	" Return the result of evaluating the receiver.
	If evaluation is limited by exiting before completion, the exception block is evaluated.
	"

	^self valueBlock ifCurtailed: exceptionBlock """,nil)

smalltalk.bind(smalltalk.S8Block,"on:do:",0
,smalltalk.__f__("""(self,anExceptionType,aBlock):
	#S8Block>>#on:do:
	return self.valueBlock().on_do_(anExceptionType,aBlock) 
""","S8Block_on_do_")
,"evaluating","""on: anExceptionType do: aBlock
	" Return the result of evaluating the receiver catching exceptions. "

	^self valueBlock on: anExceptionType do: aBlock """,nil)

smalltalk.bind(smalltalk.S8Block,"repeat",0
,smalltalk.__f__("""(self):
	#S8Block>>#repeat
	return self.valueBlock().repeat() 
""","S8Block_repeat")
,"evaluating","""repeat
	" OBSOLETE - Evaluate the receiver repeatedly, ending only if the block forces some stopping condition. "

	^self valueBlock repeat """,nil)

smalltalk.bind(smalltalk.S8Block,"value",0
,smalltalk.__f__("""(self):
	#S8Block>>#value
	return self.valueWithArguments_(smalltalk.newArray([])) 
""","S8Block_value")
,"evaluating","""value
	" Return the result of evaluating the receiver. "

	^self valueWithArguments: #() """,nil)

smalltalk.bind(smalltalk.S8Block,"value:",0
,smalltalk.__f__("""(self,argument):
	#S8Block>>#value:
	return self.valueWithArguments_(smalltalk.Array.with_(argument)) 
""","S8Block_value_")
,"evaluating","""value: argument
	" Return the result of evaluating the receiver with anObject. "

	^self valueWithArguments: (Array with: argument) """,nil)

smalltalk.bind(smalltalk.S8Block,"value:value:",0
,smalltalk.__f__("""(self,anObject,anotherObject):
	#S8Block>>#value:value:
	return self.valueWithArguments_(smalltalk.Array.with_with_(anObject,anotherObject)) 
""","S8Block_value_value_")
,"evaluating","""value: anObject value: anotherObject
	" Return the result of evaluating the receiver with arguments. "

	^self valueWithArguments: (Array with: anObject with: anotherObject) """,nil)

smalltalk.bind(smalltalk.S8Block,"value:value:value:",0
,smalltalk.__f__("""(self,anObject,anotherObject,thirdObject):
	#S8Block>>#value:value:value:
	return self.valueWithArguments_(smalltalk.Array.with_with_with_(anObject,anotherObject,thirdObject)) 
""","S8Block_value_value_value_")
,"evaluating","""value: anObject value: anotherObject value: thirdObject
	" Return the result of evaluating the receiver with arguments. "

	^self valueWithArguments: (Array with: anObject with: anotherObject with: thirdObject) """,nil)

smalltalk.bind(smalltalk.S8Block,"value:value:value:value:",0
,smalltalk.__f__("""(self,firstArgument,secondArgument,thirdArgument,fourthArgument):
	#S8Block>>#value:value:value:value:
	return self.valueWithArguments_(smalltalk.Array.with_with_with_with_(firstArgument,secondArgument,thirdArgument,fourthArgument)) 
""","S8Block_value_value_value_value_")
,"evaluating","""value: firstArgument value: secondArgument value: thirdArgument value: fourthArgument
	" Return the result of evaluating the receiver with arguments. "

	^self valueWithArguments: (Array
		with: firstArgument with: secondArgument
		with: thirdArgument with: fourthArgument) """,nil)

smalltalk.bind(smalltalk.S8Block,"valueWithArguments:",0
,smalltalk.__f__("""(self,anArray):
	#S8Block>>#valueWithArguments:
	def __blk1__(ctx):
		def __blk2__(total,each):
			return each.evaluateIn_(ctx) 
		self.bindTo_in_(anArray,ctx) 
		return getattr(self,"@node",nil).statements().inject_into_(nil,smalltalk.blk(__blk2__,2)) 
	return smalltalk.S8Context.in_clear_do_(getattr(self,"@context",nil),smalltalk.object_comma_(self.arguments(),self.temporaries()),smalltalk.blk(__blk1__,1)) 
""","S8Block_valueWithArguments_")
,"evaluating","""valueWithArguments: anArray
	" Return the result of evaluating the receiver with arguments. "

	^S8Context
		in: context clear: self arguments ,self temporaries
		do: [:ctx|
			self bindTo: anArray in: ctx.
			node statements inject: nil
				into: [:total :each| each evaluateIn: ctx ]
	] """,nil)

smalltalk.bind(smalltalk.S8Block,"valueDeferred",0
,smalltalk.__f__("""(self):
	#S8Block>>#valueDeferred
	self.valueDeferred_(smalltalk.Number(0)) 
	return self 
""","S8Block_valueDeferred")
,"evaluating","""valueDeferred
	" Evaluate the receiver deferred in time.
	Return the receiver.
	"

	self valueDeferred: 0""",nil)

smalltalk.bind(smalltalk.S8Block,"valueDeferred:",0
,smalltalk.__f__("""(self,milliseconds):
	#S8Block>>#valueDeferred:
	self.valueWithTimeout_(milliseconds) 
	return self 
""","S8Block_valueDeferred_")
,"evaluating","""valueDeferred: milliseconds
	" Evaluate the receiver deferred in time.
	Return the receiver.
	"

	self valueWithTimeout: milliseconds""",nil)

smalltalk.bind(smalltalk.S8Block,"valueWithTimeout:",0
,smalltalk.__f__("""(self,aNumber):
	#S8Block>>#valueWithTimeout:
	__0__=smalltalk.newContext()
	__0__.fn=nil
	__0__.fn=self.callableOf_(self) 
	return self.notImplementedYet_(smalltalk.String("valueWithTimeout:")) 
""","S8Block_valueWithTimeout_")
,"timeout","""valueWithTimeout: aNumber
	" Evaluate the receiver with time out. "

	| fn | fn := self callableOf: self.
	^{''js'setTimeout(fn,aNumber)'
	lua'self:notImplementedYet_("valueWithTimeout:")'
	py'self.notImplementedYet_(smalltalk.String("valueWithTimeout:"))'}""",nil)

smalltalk.bind(smalltalk.S8Block,"whileFalse",0
,smalltalk.__f__("""(self):
	#S8Block>>#whileFalse
	def __blk1__():
		nil 
	return self.whileFalse_(smalltalk.blk(__blk1__,0)) 
""","S8Block_whileFalse")
,"evaluating","""whileFalse
	" Evaluate the receiver until the result is true. "

	^self whileFalse: [] """,nil)

smalltalk.bind(smalltalk.S8Block,"whileFalse:",0
,smalltalk.__f__("""(self,aBlock):
	#S8Block>>#whileFalse:
	def __blk1__():
		return aBlock.value() 
	self.valueBlock().whileFalse_(smalltalk.blk(__blk1__,0)) 
	return nil 
""","S8Block_whileFalse_")
,"evaluating","""whileFalse: aBlock
	" Evaluate aBlock while the result of evaluating the receiver is false. "

	self valueBlock whileFalse: [ aBlock value ].
	^nil """,nil)

smalltalk.bind(smalltalk.S8Block,"whileTrue",0
,smalltalk.__f__("""(self):
	#S8Block>>#whileTrue
	def __blk1__():
		nil 
	return self.whileTrue_(smalltalk.blk(__blk1__,0)) 
""","S8Block_whileTrue")
,"evaluating","""whileTrue
	" Evaluate the receiver until the result is false. "

	^self whileTrue: [] """,nil)

smalltalk.bind(smalltalk.S8Block,"whileTrue:",0
,smalltalk.__f__("""(self,aBlock):
	#S8Block>>#whileTrue:
	def __blk1__():
		return aBlock.value() 
	self.valueBlock().whileTrue_(smalltalk.blk(__blk1__,0)) 
	return nil 
""","S8Block_whileTrue_")
,"evaluating","""whileTrue: aBlock
	" Evaluate aBlock while the result of evaluating the receiver is true. "

	self valueBlock whileTrue: [ aBlock value ].
	^nil """,nil)

smalltalk.bind(smalltalk.KeyedCollection,"bindingAt:",0
,smalltalk.__f__("""(self,aKey):
	#KeyedCollection>>#bindingAt:
	def __blk1__():
		return self.error_(smalltalk.object_comma_(smalltalk.String("Missing key "),aKey.asLiteral())) 
	return self.bindingAt_ifAbsent_(aKey,smalltalk.blk(__blk1__,0)) 
""","KeyedCollection_bindingAt_")
,"bindings","""bindingAt: aKey
	" Private - Return the binding at aKey, or generates an error if key is not present. "

	^self bindingAt: aKey ifAbsent: [ self error: 'Missing key ' ,aKey asLiteral ]""",nil)

smalltalk.bind(smalltalk.KeyedCollection,"bindingAt:ifAbsent:",0
,smalltalk.__f__("""(self,aKey,aBlock):
	#KeyedCollection>>#bindingAt:ifAbsent:
	if not smalltalk.b(self.includesKey_(aKey)):
		return aBlock.value() 
	 
	return smalltalk.S8Binding.key_in_(aKey,self) 
""","KeyedCollection_bindingAt_ifAbsent_")
,"bindings","""bindingAt: aKey ifAbsent: aBlock
	" Private - Return the binding at aKey, or the result of evaluating aBlock. "

	(self includesKey: aKey) ifFalse: [ ^aBlock value ].
	^S8Binding key: aKey in: self""",nil)

smalltalk.bind(smalltalk.Smalltalk,"bindingAt:ifAbsent:",0
,smalltalk.__f__("""(self,aKey,aBlock):
	#Smalltalk>>#bindingAt:ifAbsent:
	if not smalltalk.b(self.includesKey_(aKey)):
		return aBlock.value() 
	 
	return smalltalk.S8Binding.key_in_(aKey,self) 
""","Smalltalk_bindingAt_ifAbsent_")
,"bindings","""bindingAt: aKey ifAbsent: aBlock
	" Private - Return the binding at aKey, or the result of evaluating aBlock. "

	(self includesKey: aKey) ifFalse: [ ^aBlock value ].
	^S8Binding key: aKey in: self""",nil)

smalltalk.bind(smalltalk.Smalltalk,"bindingAt:",0
,smalltalk.__f__("""(self,aKey):
	#Smalltalk>>#bindingAt:
	def __blk1__():
		return self.error_(smalltalk.object_comma_(smalltalk.String("Missing key "),aKey.asLiteral())) 
	return self.bindingAt_ifAbsent_(aKey,smalltalk.blk(__blk1__,0)) 
""","Smalltalk_bindingAt_")
,"bindings","""bindingAt: aKey
	" Private - Return the binding at aKey, or generates an error if key is not present. "

	^self bindingAt: aKey ifAbsent: [ self error: 'Missing key ' ,aKey asLiteral ]""",nil)
