[Vm-dev] VM Maker: VMMaker.oscog-eem.3247.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Aug 9 17:44:28 UTC 2022


Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3247.mcz

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

Name: VMMaker.oscog-eem.3247
Author: eem
Time: 9 August 2022, 10:44:08.998623 am
UUID: f0011edc-4b22-4095-b001-c94c9e6a00cc
Ancestors: VMMaker.oscog-eem.3246

Oops! the last change caused a regression cuz there are #if\...\#else\...\#endif forms.  So get a little bit cleverer.

=============== Diff against VMMaker.oscog-eem.3246 ===============

Item was changed:
  ----- Method: CCodeGenerator>>extractTypeFor:fromDeclaration: (in category 'utilities') -----
  extractTypeFor: aVariable fromDeclaration: aVariableDeclaration
  	"Eliminate inessentials from aVariableDeclaration to answer a C type without the variable,
  	 or initializations etc"
  	| decl substrings |
  	((aVariableDeclaration beginsWith: 'static ')
  	 or: [aVariableDeclaration beginsWith: 'extern ']) ifTrue:
  		[^self extractTypeFor: aVariable fromDeclaration: (aVariableDeclaration allButFirst: 7)].
  	(aVariableDeclaration first = $# and: [aVariableDeclaration includes: $\]) ifTrue:
  		[substrings := aVariableDeclaration subStrings: '\'.
+ 		 "We're expecting either #if \decl\#endif or #if\decl\#else\#define...\#endif"
+ 		 self assert: ((#[3 5] includes: substrings size) and: [(substrings reject: [:substring| substring beginsWith: '#']) size = 1]).
+ 		 ^self extractTypeFor: aVariable fromDeclaration: (substrings detect: [:substring| substring first ~~ $#]) ].
- 		 self assert: (substrings size = 3 and: [substrings last beginsWith: '#']).
- 		 ^self extractTypeFor: aVariable fromDeclaration: substrings second].
  	decl := (aVariableDeclaration indexOf: $= ifAbsent: [])
  				ifNotNil: [:index| aVariableDeclaration copyFrom: 1 to: index - 1]
  				ifNil: [aVariableDeclaration].
  	decl := decl copyReplaceAll: aVariable with: '' tokenish: [:ch| ch = $_ or: [ch isAlphaNumeric]].
  	^self baseTypeForType: decl!



More information about the Vm-dev mailing list