Class {
	#name : #FFICompilerPlugin,
	#superclass : #OCCompilerASTPlugin,
	#category : #UnifiedFFI
}

{ #category : #api }
FFICompilerPlugin >> transform [
	| rule pattern |
	pattern := '`@message ffiCall: ``@args'.
	rule := RBParseTreeSearcher new
		matchesAnyOf: {pattern}
		do: [ :node :answer | ast propertyAt: #methodProperties ifAbsentPut: [ FFIAdditionalFFIMethodState new: 0 ] ].
	rule executeTree: ast.
	ast propertyAt: #methodProperties ifPresent: [ :methodState | methodState argsNames: ast argumentNames ] ifAbsent: [  ].
	^ ast
]

Class {
	#name : #FFICompilerPlugin,
	#superclass : #OCCompilerASTPlugin,
	#category : #UnifiedFFI
}

{ #category : #api }
FFICompilerPlugin >> transform [
	| rule patterns |
	patterns := {'`@message ffiCall: ``@args' . '`@message ffiCall: ``@args module: ``@args' .
	'`@message ffiCall: ``@args  module: ``@args options: ``@args' . '`@message ffiCall: ``@args options: ``@args'}.
	rule := RBParseTreeSearcher new
		matchesAnyOf: patterns
		do:
			[ :node :answer | ast propertyAt: #methodProperties ifAbsentPut: [ FFIAdditionalFFIMethodState new: 0 ] ].
	rule executeTree: ast.
	ast
		propertyAt: #methodProperties
		ifPresent: [ :methodState | methodState argsNames: ast argumentNames ]
		ifAbsent: [  ].
	^ ast
]

Add more patterns in the transformation
Add more patterns in the transformation


estebanlm/pharo,estebanlm/pharo,estebanlm/pharo