[squeak-dev] The Trunk: Collections-nice.447.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jul 20 07:23:16 UTC 2011


Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.447.mcz

==================== Summary ====================

Name: Collections-nice.447
Author: nice
Time: 20 July 2011, 9:22:39.538 am
UUID: d4b8e2f5-d54f-49a0-a8af-d31df8268adc
Ancestors: Collections-eem.446

Refine Association>>literalEqual: to correctly handle variable binding identity.
Use literalEqual: in hasLiteral:
Deprecate use of Array>>#hasLiteralThorough:

=============== Diff against Collections-eem.446 ===============

Item was changed:
  ----- Method: Array>>hasLiteral: (in category 'private') -----
  hasLiteral: literal
  	"Answer true if literal is identical to any literal in this array, even 
  	if imbedded in further array structure. This method is only intended 
  	for private use by CompiledMethod hasLiteralSymbol:"
  
+ 	| lit |
- 	| litClass lit |
- 	litClass := literal class.
  	1 to: self size do: 
  		[:index | 
+ 		((lit := self at: index) literalEqual: literal) ifTrue: [^true].
+ 		(Array == lit class and: [lit hasLiteral: literal]) ifTrue: [^true]].
- 		(litClass == (lit := self at: index) class
- 		and: [literal = lit]) ifTrue: [^true].
- 		(Array == lit class
- 		 and: [lit hasLiteral: literal]) ifTrue: [^true]].
  	^false!

Item was changed:
  ----- Method: Array>>hasLiteralThorough: (in category 'private') -----
  hasLiteralThorough: literal
  	"Answer true if literal is identical to any literal in this array, even if imbedded in further array structures or closure methods"
  
+ 	self deprecated: 'Never send #hasLiteralThorough: to an Array, just use #hasLiteral:'.
+ 	^self hasLiteral: literal!
- 	| lit |
- 	1 to: self size do: [:index |
- 		(lit := self at: index) == literal ifTrue: [^ true].
- 		(lit hasLiteralThorough: literal) ifTrue: [^ true]].
- 	^ false!

Item was added:
+ ----- Method: Association>>literalEqual: (in category 'testing') -----
+ literalEqual: otherLiteral
+ 	"Answer true if the receiver and otherLiteral represent the same literal.
+ 	Variable bindings are literally equals only if identical.
+ 	This is how variable sharing works, by preserving identity and changing only the value."
+ 	^self == otherLiteral!




More information about the Squeak-dev mailing list