[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[scripting] 510 - Compiler building


"Compiling methods..."
ScriptCompilerTest buildAccessors!

! ScriptCompilerTest class methodsFor: #instantiation !
x: x y: y
	^self basicNew
		x: x;
		y: y;
		yourself! !

! ScriptCompilerTest class methodsFor: #instantiation !
zero
	^self x: 0 y: 0! !

! ScriptCompilerTest class methodsFor: #instantiation !
value: x
	^self x: x y: x! !

! ScriptCompilerTest methodsFor: #operations !
+ aNumber
	^self class
		x: x + aNumber
		y: y + aNumber! !

! ScriptCompilerTest methodsFor: #operations !
* z
	^z * (x + y)! !

! ScriptCompilerTest methodsFor: #operations !
xy
	^x * y! !

! ScriptCompilerTest methodsFor: #operations !
point
	^x @ y! !

! ScriptCompilerTest methodsFor: #iteration !
do: aBlock
	^x to: y do: aBlock! !

! ScriptCompilerTest methodsFor: #iteration !
select: aBlock
	^(x to: y) select: aBlock! !


"Testing instance lookup..."
#( x x: y y: + * xy
) do: [:selector|
	(ScriptCompilerTest new respondsTo: selector) ifFalse: [
		^self error: 'Must implement ' ,selector asLiteral
	]
].


"Testing class lookup..."
#( x:y: zero
) do: [:selector|
	(ScriptCompilerTest respondsTo: selector) ifFalse: [
		^self error: 'Must implement ' ,selector asLiteral
	]
].