@@ -28,7 +28,7 @@ TSFASTPythonImporter >> manageBinaryOperator: aTSNode ofKind: aClass [
2828 add: ' leftOperand' asAliasOfField: ' left' ;
2929 add: ' rightOperand' asAliasOfField: ' right' ].
3030
31- fastEntity := self createEntityForNode : aTSNode.
31+ fastEntity := self handleNode : aTSNode.
3232
3333 " TreeSitter does not seems to manage operator. See: https://github.com/tree-sitter/tree-sitter-python/issues/328
3434 So I try to het this property manually."
@@ -66,13 +66,13 @@ TSFASTPythonImporter >> visitAssignment: aTSNode [
6666 " add: 'variable' asAliasOfField: 'left';"
6767 add: ' expression' asAliasOfField: ' right' ].
6868
69- ^ self createEntityForNode : aTSNode
69+ ^ self handleNode : aTSNode
7070]
7171
7272{ #category : ' visiting' }
7373TSFASTPythonImporter >> visitAttribute: aTSNode [
7474
75- ^ self createEntityForNode : aTSNode kind: FASTPyAttributeAccess
75+ ^ self handleNode : aTSNode kind: FASTPyAttributeAccess
7676]
7777
7878{ #category : ' visiting' }
@@ -87,13 +87,13 @@ TSFASTPythonImporter >> visitBlock: aTSNode [
8787 self onNextContextDo: [ :contextEntry | contextEntry add: ' statements' asAliasOfField: ' <unnamedChild>' ].
8888
8989 aTSNode parent type = #else_clause ifTrue: [
90- ^ self createEntityForNode : aTSNode kind: FASTPyElseClause parentManagementBlock : [ :entity | self topFastEntity elseClause: entity ] ].
90+ ^ self handleNode : aTSNode kind: FASTPyElseClause parentBlock : [ :entity | self topFastEntity elseClause: entity ] ].
9191
92- ((context top isOfFASTType: FASTPyIfStatement ) and : [ context top field = #consequence ]) ifTrue: [ ^ self createEntityForNode : aTSNode kind: FASTPyThenClause ].
92+ ((context top isOfFASTType: FASTPyIfStatement ) and : [ context top field = #consequence ]) ifTrue: [ ^ self handleNode : aTSNode kind: FASTPyThenClause ].
9393
9494 (context top isOfFASTType: FASTPyElifClause ) ifTrue: [ self setTopFieldTo: #statements . " We manually update the field to bypass the block and" ^ self rawVisitChildren: aTSNode ].
9595
96- ^ self createEntityForNode : aTSNode kind: FASTPyBlock
96+ ^ self handleNode : aTSNode kind: FASTPyBlock
9797]
9898
9999{ #category : ' visiting' }
@@ -107,22 +107,22 @@ TSFASTPythonImporter >> visitCall: aTSNode [
107107
108108 self onNextContextDo: [ :entry | entry add: ' callee' asAliasOfField: ' function' ].
109109
110- ^ self createEntityForNode : aTSNode kind: FASTPyCall
110+ ^ self handleNode : aTSNode kind: FASTPyCall
111111]
112112
113113{ #category : ' visiting' }
114114TSFASTPythonImporter >> visitCollection: aTSNode [
115115
116116 self onNextContextDo: [ :entry | entry add: #initializers asAliasOfField: ' <unnamedChild>' ].
117117
118- ^ self createEntityForNode : aTSNode
118+ ^ self handleNode : aTSNode
119119]
120120
121121{ #category : ' visiting' }
122122TSFASTPythonImporter >> visitComment: aTSNode [
123123
124124 self flag: #todo . " Manage to put the right trait on entities containing me and change the block."
125- ^ self createEntityForNode : aTSNode parentManagementBlock : [ :entity | self topFastEntity addGenericChild: entity ]
125+ ^ self handleNode : aTSNode parentBlock : [ :entity | self topFastEntity addGenericChild: entity ]
126126]
127127
128128{ #category : ' visiting' }
@@ -131,7 +131,7 @@ TSFASTPythonImporter >> visitComparisonOperator: aTSNode [
131131 | fastEntity |
132132 self onNextContextDo: [ :contextEntry | contextEntry add: ' operands' asAliasOfField: ' <unnamedChild>' ].
133133
134- fastEntity := self createEntityForNode : aTSNode.
134+ fastEntity := self handleNode : aTSNode.
135135
136136 " The node does not gives us the operators so we try to get them ourselves."
137137 fastEntity operators:
@@ -145,7 +145,7 @@ TSFASTPythonImporter >> visitComprehension: aTSNode [
145145
146146 self onNextContextDo: [ :entry | entry add: ' clauses' asAliasOfField: ' <unnamedChild>' ].
147147
148- ^ self createEntityForNode : aTSNode
148+ ^ self handleNode : aTSNode
149149]
150150
151151{ #category : ' visiting' }
@@ -175,7 +175,7 @@ TSFASTPythonImporter >> visitDeleteStatement: aTSNode [
175175
176176 self onNextContextDo: [ :entry | entry add: #expression asAliasOfField: ' <unnamedChild>' ].
177177
178- ^ self createEntityForNode : aTSNode
178+ ^ self handleNode : aTSNode
179179]
180180
181181{ #category : ' visiting' }
@@ -221,13 +221,13 @@ TSFASTPythonImporter >> visitDottedName: aTSNode [
221221 fastEntity segments: (aTSNode namedChildren collect: [ :child | self sourceCodeOf: child ]).
222222 ^ fastEntity ].
223223
224- ^ self createEntityForNode : aTSNode
224+ ^ self handleNode : aTSNode
225225]
226226
227227{ #category : ' visiting' }
228228TSFASTPythonImporter >> visitElifClause: aTSNode [
229229
230- ^ self createEntityForNode : aTSNode kind: FASTPyElifClause parentManagementBlock : [ :entity | self topFastEntity addElifClause: entity ]
230+ ^ self handleNode : aTSNode kind: FASTPyElifClause parentBlock : [ :entity | self topFastEntity addElifClause: entity ]
231231]
232232
233233{ #category : ' visiting' }
@@ -241,13 +241,13 @@ TSFASTPythonImporter >> visitExpressionList: aTSNode [
241241
242242 self onNextContextDo: [ :entry | entry add: ' expressions' asAliasOfField: ' <unnamedChild>' ].
243243
244- ^ self createEntityForNode : aTSNode kind: FASTPyExpressionList
244+ ^ self handleNode : aTSNode kind: FASTPyExpressionList
245245]
246246
247247{ #category : ' visiting' }
248248TSFASTPythonImporter >> visitFalse: aNode [
249249
250- ^ self createEntityForNode : aNode kind: FASTPyBoolean
250+ ^ self handleNode : aNode kind: FASTPyBoolean
251251]
252252
253253{ #category : ' visiting' }
@@ -258,8 +258,8 @@ TSFASTPythonImporter >> visitFunctionDefinition: aNode [
258258 self onNextContextDo: [ :contextEntry | contextEntry add: ' statementBlock' asAliasOfField: ' body' ].
259259
260260 definition := (context anySatisfy: [ :entry | entry fastEntity isClassDefinition ])
261- ifTrue: [ self createEntityForNode : aNode kind: FASTPyMethodDefinition ]
262- ifFalse: [ self createEntityForNode : aNode kind: FASTPyFunctionDefinition ]
261+ ifTrue: [ self handleNode : aNode kind: FASTPyMethodDefinition ]
262+ ifFalse: [ self handleNode : aNode kind: FASTPyFunctionDefinition ]
263263]
264264
265265{ #category : ' visiting' }
@@ -287,7 +287,7 @@ TSFASTPythonImporter >> visitGlobalStatement: aTSNode [
287287
288288 self onNextContextDo: [ :contextEntry | contextEntry add: ' variable' asAliasOfField: ' <unnamedChild>' ].
289289
290- ^ self createEntityForNode : aTSNode
290+ ^ self handleNode : aTSNode
291291]
292292
293293{ #category : ' visiting' }
@@ -300,34 +300,34 @@ TSFASTPythonImporter >> visitIdentifier: aNode [
300300
301301 " If I am on the left side of an assignation then I am a variable."
302302 (context anySatisfy: [ :entry | entry field = #left and : [ entry isOfFASTType: FASTPyAssignment ] ]) ifTrue: [
303- ^ self createEntityForNode : aNode kind: FASTPyVariable ].
303+ ^ self handleNode : aNode kind: FASTPyVariable ].
304304
305305 " In case we are in an alias, we edit the property alias of the last imported entity"
306306 (aNode parent type = #aliased_import ) ifTrue: [ ^ self topFastEntity importedEntities last alias: (self sourceCodeOf: aNode) ].
307307
308308 " Those statements points a variable"
309309 ((context top isOfFASTType: FASTPyGlobalStatement ) or : [ context top isOfFASTType: FASTPyNonlocalStatement ])
310- ifTrue: [ ^ self createEntityForNode : aNode kind: FASTPyVariable ].
310+ ifTrue: [ ^ self handleNode : aNode kind: FASTPyVariable ].
311311
312- (context top field = #attribute and : [ context top isOfFASTType: FASTPyAttributeAccess ]) ifTrue: [ ^ self createEntityForNode : aNode kind: FASTPyVariable ].
312+ (context top field = #attribute and : [ context top isOfFASTType: FASTPyAttributeAccess ]) ifTrue: [ ^ self handleNode : aNode kind: FASTPyVariable ].
313313
314- ^ self createEntityForNode : aNode
314+ ^ self handleNode : aNode
315315]
316316
317317{ #category : ' visiting' }
318318TSFASTPythonImporter >> visitIfClause: aTSNode [
319319
320320 self onNextContextDo: [ :entry | entry add: ' expression' asAliasOfField: ' <unnamedChild>' ].
321321
322- ^ self createEntityForNode : aTSNode kind: FASTPyIfClause
322+ ^ self handleNode : aTSNode kind: FASTPyIfClause
323323]
324324
325325{ #category : ' visiting' }
326326TSFASTPythonImporter >> visitIfStatement: aTSNode [
327327
328328 self onNextContextDo: [ :contextEntry | contextEntry add: ' thenClause' asAliasOfField: ' consequence' ].
329329
330- ^ self createEntityForNode : aTSNode kind: FASTPyIfStatement
330+ ^ self handleNode : aTSNode kind: FASTPyIfStatement
331331]
332332
333333{ #category : ' visiting' }
@@ -338,14 +338,14 @@ TSFASTPythonImporter >> visitImportFromStatement: aTSNode [
338338 add: ' importedEntities' asAliasOfField: ' name' ;
339339 add: ' fromModule' asAliasOfField: ' module_name' ].
340340
341- ^ self createEntityForNode : aTSNode kind: FASTPyImportFromStatement
341+ ^ self handleNode : aTSNode kind: FASTPyImportFromStatement
342342]
343343
344344{ #category : ' visiting' }
345345TSFASTPythonImporter >> visitImportPrefix: aTSNode [
346346
347347 | fastEntity |
348- fastEntity := self createEntityForNode : aTSNode kind: FASTPyFromModule .
348+ fastEntity := self handleNode : aTSNode kind: FASTPyFromModule .
349349 fastEntity segments: { (self sourceCodeOf: aTSNode) }.
350350 ^ fastEntity
351351]
@@ -355,15 +355,15 @@ TSFASTPythonImporter >> visitImportStatement: aTSNode [
355355
356356 self onNextContextDo: [ :contextEntry | contextEntry add: ' importedEntities' asAliasOfField: ' name' ].
357357
358- ^ self createEntityForNode : aTSNode
358+ ^ self handleNode : aTSNode
359359]
360360
361361{ #category : ' visiting' }
362362TSFASTPythonImporter >> visitInteger: aTSNode [
363363 " In python we have integers and complex numbers.
364364 A Complex ends with a j"
365365
366- ^ self createEntityForNode : aTSNode kind: ((self sourceCodeOf: aTSNode) last isLetter
366+ ^ self handleNode : aTSNode kind: ((self sourceCodeOf: aTSNode) last isLetter
367367 ifTrue: [ FASTPyComplex ]
368368 ifFalse: [ FASTPyInteger ])
369369]
@@ -373,7 +373,7 @@ TSFASTPythonImporter >> visitLambda: aTSNode [
373373
374374 self onNextContextDo: [ :entry | entry add: ' expression' asAliasOfField: ' body' ].
375375
376- ^ self createEntityForNode : aTSNode kind: FASTPyLambda
376+ ^ self handleNode : aTSNode kind: FASTPyLambda
377377]
378378
379379{ #category : ' visiting' }
@@ -406,23 +406,23 @@ TSFASTPythonImporter >> visitListSplat: aTSNode [
406406
407407 self onNextContextDo: [ :entry | entry add: #iterable asAliasOfField: ' <unnamedChild>' ].
408408
409- ^ self createEntityForNode : aTSNode kind: FASTPyListSplat
409+ ^ self handleNode : aTSNode kind: FASTPyListSplat
410410]
411411
412412{ #category : ' visiting' }
413413TSFASTPythonImporter >> visitModule: aTSNode [
414414
415415 self onNextContextDo: [ :entry | entry add: ' statements' asAliasOfField: ' <unnamedChild>' ].
416416
417- ^ self createEntityForNode : aTSNode kind: FASTPyModule
417+ ^ self handleNode : aTSNode kind: FASTPyModule
418418]
419419
420420{ #category : ' visiting' }
421421TSFASTPythonImporter >> visitNonlocalStatement: aTSNode [
422422
423423 self onNextContextDo: [ :contextEntry | contextEntry add: ' variable' asAliasOfField: ' <unnamedChild>' ].
424424
425- ^ self createEntityForNode : aTSNode
425+ ^ self handleNode : aTSNode
426426]
427427
428428{ #category : ' visiting' }
@@ -433,7 +433,7 @@ TSFASTPythonImporter >> visitParameters: aNode [
433433
434434 aNode collectNamedChild do: [ :parameterNode |
435435 | parameter |
436- parameter := self createEntityForNode : parameterNode kind: FASTPyParameter parentManagementBlock : [ :entity | self topFastEntity addParameter: entity ].
436+ parameter := self handleNode : parameterNode kind: FASTPyParameter parentBlock : [ :entity | self topFastEntity addParameter: entity ].
437437 parameter name: parameter sourceCode " This case is pretty straightforward since names are the source code of the parameter." ]
438438]
439439
@@ -449,7 +449,7 @@ TSFASTPythonImporter >> visitPatternList: aTSNode [
449449
450450 self onNextContextDo: [ :entry | entry add: ' elements' asAliasOfField: ' <unnamedChild>' ].
451451
452- ^ self createEntityForNode : aTSNode kind: FASTPyPatternList
452+ ^ self handleNode : aTSNode kind: FASTPyPatternList
453453]
454454
455455{ #category : ' visiting' }
@@ -482,15 +482,15 @@ TSFASTPythonImporter >> visitSlice: aTSNode [
482482
483483 self onNextContextDo: [ :entry | entry add: ' components' asAliasOfField: ' <unnamedChild>' ].
484484
485- ^ self createEntityForNode : aTSNode kind: FASTPySlice
485+ ^ self handleNode : aTSNode kind: FASTPySlice
486486]
487487
488488{ #category : ' visiting' }
489489TSFASTPythonImporter >> visitStatement: aTSNode [
490490
491491 self onNextContextDo: [ :entry | entry add: #expression asAliasOfField: ' <unnamedChild>' ].
492492
493- ^ self createEntityForNode : aTSNode
493+ ^ self handleNode : aTSNode
494494]
495495
496496{ #category : ' visiting - noop' }
@@ -519,13 +519,13 @@ TSFASTPythonImporter >> visitSubscript: aTSNode [
519519
520520 self onNextContextDo: [ :entry | entry add: #indices asAliasOfField: ' subscript' ].
521521
522- ^ self createEntityForNode : aTSNode
522+ ^ self handleNode : aTSNode
523523]
524524
525525{ #category : ' visiting' }
526526TSFASTPythonImporter >> visitTrue: aNode [
527527
528- ^ self createEntityForNode : aNode kind: FASTPyBoolean
528+ ^ self handleNode : aNode kind: FASTPyBoolean
529529]
530530
531531{ #category : ' visiting' }
@@ -539,22 +539,22 @@ TSFASTPythonImporter >> visitTupleExpression: aTSNode [
539539
540540 self onNextContextDo: [ :entry | entry add: #initializers asAliasOfField: ' <unnamedChild>' ].
541541
542- ^ self createEntityForNode : aTSNode kind: FASTPyTuple
542+ ^ self handleNode : aTSNode kind: FASTPyTuple
543543]
544544
545545{ #category : ' visiting' }
546546TSFASTPythonImporter >> visitTuplePattern: aTSNode [
547547
548548 self onNextContextDo: [ :entry | entry add: ' patterns' asAliasOfField: ' <unnamedChild>' ].
549549
550- ^ self createEntityForNode : aTSNode kind: FASTPyTuplePattern
550+ ^ self handleNode : aTSNode kind: FASTPyTuplePattern
551551]
552552
553553{ #category : ' visiting' }
554554TSFASTPythonImporter >> visitUnaryOperator: aTSNode [
555555
556556 | fastEntity |
557- fastEntity := self createEntityForNode : aTSNode.
557+ fastEntity := self handleNode : aTSNode.
558558
559559 " TreeSitter does not seems to manage operator. See: https://github.com/tree-sitter/tree-sitter-python/issues/328"
560560 fastEntity operator: (fastEntity sourceText copyFrom: fastEntity startPos to: fastEntity argument startPos - 1 ) trim.
0 commit comments