FogBugz (Case [Issue]10918) Compiler Opal - Direct reference to ClassBuilder in Opal test

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FogBugz (Case [Issue]10918) Compiler Opal - Direct reference to ClassBuilder in Opal test

Pharo Issue Tracker
A FogBugz case was opened by Martin Dias.

Case ID:      10918
Title:        Direct reference to ClassBuilder in Opal test
Status:       Work Needed
Category:     Inquiry
Project:      Compiler Opal
Area:         Misc
Priority:     3 - Must Fix
Milestone:    Pharo3.0: 30/03/2014
Assigned To:  Everyone

URL:          https://pharo.fogbugz.com/default.asp?10918

I am looking forward to remove direct references to ClassBuilder. As part of such task, we should change this test, that compiles in ClassBuilder. Do you agree?

OCCompiledMethodIntegrityTests>>
testComplexMethodClassBuilder

| newCompiledMethod originalCompiledMethod |

(Smalltalk hasClassNamed: #Compiler) ifFalse: [^self skip].

newCompiledMethod := (OpalCompiler new
compile:'superclass: aClass
variableByteSubclass: t instanceVariableNames: f
classVariableNames: d poolDictionaries: s category: cat
| oldClassOrNil actualType |
(aClass instSize > 0)
ifTrue: [^self error: ''cannot make a byte subclass of a class with named fields''].
(aClass isVariable and: [aClass isWords])
ifTrue: [^self error: ''cannot make a byte subclass of a class with word fields''].
(aClass isVariable and: [aClass isPointers])
ifTrue: [^self error: ''cannot make a byte subclass of a class with pointer fields''].
oldClassOrNil := aClass environment at: t ifAbsent:[nil].
actualType := (oldClassOrNil notNil
and: [oldClassOrNil typeOfClass == #compiledMethod])
ifTrue: [#compiledMethod]
ifFalse: [#bytes].
^self
name: t
inEnvironment: aClass environment
subclassOf: aClass
type: actualType
instanceVariableNames: f
classVariableNames: d
poolDictionaries: s
category: cat'
in: ClassBuilder
classified: nil
notifying: nil
ifFail: [])
generate.

originalCompiledMethod := ((Smalltalk classNamed: #Compiler) new
compile:'superclass: aClass
variableByteSubclass: t instanceVariableNames: f
classVariableNames: d poolDictionaries: s category: cat
| oldClassOrNil actualType |
(aClass instSize > 0)
ifTrue: [^self error: ''cannot make a byte subclass of a class with named fields''].
(aClass isVariable and: [aClass isWords])
ifTrue: [^self error: ''cannot make a byte subclass of a class with word fields''].
(aClass isVariable and: [aClass isPointers])
ifTrue: [^self error: ''cannot make a byte subclass of a class with pointer fields''].
oldClassOrNil := aClass environment at: t ifAbsent:[nil].
actualType := (oldClassOrNil notNil
and: [oldClassOrNil typeOfClass == #compiledMethod])
ifTrue: [#compiledMethod]
ifFalse: [#bytes].
^self
name: t
inEnvironment: aClass environment
subclassOf: aClass
type: actualType
instanceVariableNames: f
classVariableNames: d
poolDictionaries: s
category: cat'
in: ClassBuilder
classified: nil
notifying: nil
ifFail: [])
generate.

self assert: newCompiledMethod numArgs = originalCompiledMethod numArgs.
self assert: newCompiledMethod numLiterals = originalCompiledMethod numLiterals.
self assert: newCompiledMethod numTemps = originalCompiledMethod numTemps.
self assert: newCompiledMethod primitive = originalCompiledMethod primitive.
self assert: newCompiledMethod header = originalCompiledMethod header


You are subscribed to this case.  If you do not want to receive automatic notifications in the future, unsubscribe (https://pharo.fogbugz.com/default.asp?pre=preUnsubscribe&pg=pgEditBug&command=view&ixBug=10918) from this case.

_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker