Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1027.mcz ==================== Summary ==================== Name: System-mt.1027 Author: mt Time: 24 May 2018, 10:30:46.580621 am UUID: 03fbd834-afce-ba4b-89d0-989e09f085bd Ancestors: System-kfr.1026 Harmonize method references and class references. =============== Diff against System-kfr.1026 =============== Item was added: + ----- Method: ClassDescription>>asReference (in category '*System-Tools') ----- + asReference + + ^ self classReference! Item was added: + ----- Method: ClassDescription>>classReference (in category '*System-Tools') ----- + classReference + + ^ ClassReference class: self! Item was changed: Object subclass: #ClassReference instanceVariableNames: 'classSymbol stringVersion classIsMeta environment' + classVariableNames: 'InvalidReference' - classVariableNames: '' poolDictionaries: '' category: 'System-Tools'! !ClassReference commentStamp: '<historical>' prior: 0! A ClassReference is is a lightweight proxy for a Class's definition. Allows class definitions to be viewed in MessageLists Instance Variables classSymbol: Symbol for method's class (without class keyword if meta) stringVersion: the class's definition ! Item was added: + ----- Method: ClassReference class>>invalid (in category 'instance creation') ----- + invalid + "Returns an invalid class reference to avoid the usage of nil." + + ^ InvalidReference ifNil: [ + InvalidReference := self new + setClassSymbol: #NonExistentClass + classIsMeta: false + environment: Environment default + stringVersion: '<The Invalid Class Reference>']! Item was added: + ----- Method: ClassReference>>asReference (in category 'converting') ----- + asReference + + ^ self! Item was added: + ----- Method: ClassReference>>asString (in category 'converting') ----- + asString + + ^(stringVersion ifNil: [ self stringVersionDefault ]) asString! Item was changed: + ----- Method: ClassReference>>isClassReference (in category 'testing') ----- - ----- Method: ClassReference>>isClassReference (in category 'comparisons') ----- isClassReference + + ^ true! - ^true! Item was changed: + ----- Method: ClassReference>>isMethodReference (in category 'testing') ----- - ----- Method: ClassReference>>isMethodReference (in category 'comparisons') ----- isMethodReference + + ^ false! - ^false! Item was added: + ----- Method: ClassReference>>isValid (in category 'testing') ----- + isValid + + ^ self actualClass notNil! Item was changed: ----- Method: ClassReference>>setClassSymbol:classIsMeta:environment:stringVersion: (in category 'initialize-release') ----- setClassSymbol: classSym classIsMeta: isMeta environment: anEnvironment stringVersion: aString classSymbol := classSym. classIsMeta := isMeta. + stringVersion := aString. - stringVersion := aString, ' (definition)'. environment := anEnvironment! Item was changed: ----- Method: ClassReference>>setClassSymbol:classIsMeta:stringVersion: (in category 'initialize-release') ----- setClassSymbol: classSym classIsMeta: isMeta stringVersion: aString classSymbol := classSym. classIsMeta := isMeta. + stringVersion := aString.! - stringVersion := aString, ' (definition)'! Item was changed: ----- Method: ClassReference>>setStandardClass: (in category 'initialize-release') ----- setStandardClass: aClass self setClassSymbol: aClass theNonMetaClass name classIsMeta: aClass isMeta environment: aClass environment + stringVersion: aClass name, ' (definition)'! - stringVersion: aClass name! Item was added: + ----- Method: ClassReference>>stringVersion: (in category 'accessing') ----- + stringVersion: aString + + stringVersion := aString! Item was added: + ----- Method: ClassReference>>stringVersionDefault (in category 'accessing') ----- + stringVersionDefault + + ^classSymbol, (classIsMeta ifTrue: [ ' class' ] ifFalse: ['']) ! Item was added: + ----- Method: CompiledCode>>asReference (in category '*System-converting') ----- + asReference + + ^ self methodReference ifNil: [MethodReference invalid]! Item was changed: ----- Method: CompiledCode>>methodReference (in category '*System-Support') ----- methodReference + | class selector | class := self methodClass ifNil: [^nil]. selector := self selector ifNil: [^nil]. + ^ MethodReference class: class selector: selector! - ^MethodReference class: class selector: selector. - ! Item was changed: Object subclass: #MethodReference instanceVariableNames: 'classSymbol classIsMeta methodSymbol stringVersion category environment' + classVariableNames: 'InvalidReference' - classVariableNames: '' poolDictionaries: '' category: 'System-Tools'! !MethodReference commentStamp: 'tlk 5/9/2006 18:43' prior: 0! A MethodReference is is a lightweight proxy for a CompiledMethod. Has methods for pointed to the CompileMethod's source statements, byte codes. Is heavily used my Tools. Instance Variables classIsMeta: Boolean class vs. instance classSymbol: Symbol for method's class (without class keyword if meta) methodSymbol: Symbol for method's selector stringVersion: 'Class>>selector:' format ! Item was added: + ----- Method: MethodReference class>>invalid (in category 'instance creation') ----- + invalid + "Creates an invalid method reference to avoid the usage of nil." + + ^ InvalidReference ifNil: [ + InvalidReference := self new + setClassSymbol: #NonExistentClass + classIsMeta: false + methodSymbol: #nonExistentSelector + stringVersion: '<The Invalid Method Reference>']! Item was added: + ----- Method: MethodReference>>asReference (in category 'converting') ----- + asReference + + ^ self! Item was added: + ----- Method: MethodReference>>isClassReference (in category 'testing') ----- + isClassReference + + ^ false! Item was changed: ----- Method: MethodReference>>isMethodReference (in category 'testing') ----- isMethodReference + + ^ true! - ^true! Item was changed: ----- Method: MethodReference>>sourceCode (in category 'accessing') ----- sourceCode + + ^ self actualClass sourceCodeAt: self methodSymbol! - ^ self actualClass sourceCodeAt: methodSymbol! Item was changed: ----- Method: MethodReference>>sourceString (in category 'accessing') ----- sourceString + + ^ self sourceCode asString! - ^ (self actualClass sourceCodeAt: self methodSymbol) asString! |
Free forum by Nabble | Edit this page |