[Pkg] The Trunk: Compiler-eem.233.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Aug 15 01:51:23 UTC 2012


Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.233.mcz

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

Name: Compiler-eem.233
Author: eem
Time: 14 August 2012, 6:50:49.205 pm
UUID: 231126f7-9b84-4261-bb3a-9f79e67fddf1
Ancestors: Compiler-nice.232

Fix comment collection for blocks.  Old code forgot to nil
currentComment after adding to a block.

=============== Diff against Compiler-nice.232 ===============

Item was changed:
  ----- Method: Parser>>statements:innerBlock:blockNode: (in category 'expression types') -----
  statements: argNodes innerBlock: inner blockNode: theBlockNode
  
  	| stmts returns start |
  	"give initial comment to block, since others trail statements"
  	theBlockNode comment: currentComment.
+ 	currentComment := nil.
  	stmts := OrderedCollection new.
  	returns := false.
  	hereType ~~ #rightBracket ifTrue:
  		[[theBlockNode startOfLastStatement: (start := self startOfNextToken).
  		  (returns := self matchReturn)
  			ifTrue: 
  				[self expression ifFalse:
  					[^self expected: 'Expression to return'].
  				 self addComment.
  				 stmts addLast: (parseNode isReturningIf
  								ifTrue: [parseNode]
  								ifFalse: [ReturnNode new
  											expr: parseNode
  											encoder: encoder
  											sourceRange: (start to: self endOfLastToken)])]
  			ifFalse: 
  				[self expression
  					ifTrue: 
  						[self addComment.
  						 stmts addLast: parseNode]
  					ifFalse: 
  						[self addComment.
  						 stmts size = 0 ifTrue: 
  							[stmts addLast: 
  								(encoder encodeVariable:
  									(inner ifTrue: ['nil'] ifFalse: ['self']))]]].
  		  returns ifTrue: 
  			[self match: #period.
  			 (hereType == #rightBracket or: [hereType == #doIt]) ifFalse:
  				[^self expected: 'End of block']].
  		  returns not and: [self match: #period]] whileTrue].
  	theBlockNode
  		arguments: argNodes
  		statements: stmts
  		returns: returns
  		from: encoder.
  	parseNode := theBlockNode.
  	^true!



More information about the Packages mailing list