File tree 1 file changed +25
-4
lines changed
1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change 2
2
#name : ' TSCImporterVisitor' ,
3
3
#superclass : ' TSCLanguageVisitor' ,
4
4
#instVars : [
5
+ ' parser' ,
5
6
' model' ,
6
7
' context' ,
7
8
' sourceCode' ,
@@ -35,10 +36,13 @@ TSCImporterVisitor >> ensureEntityExist: aFamixCEntity value: aString [
35
36
{ #category : ' visiting' }
36
37
TSCImporterVisitor >> extractSourceAnchor: aTSNode [
37
38
38
- ^ FamixCIndexedFileAnchor new
39
- startPos: aTSNode startByte;
40
- endPos: aTSNode endByte;
41
- fileName: fileName
39
+ | sourceAnchor |
40
+ sourceAnchor := FamixCIndexedFileAnchor new
41
+ startPos: aTSNode startByte;
42
+ endPos: aTSNode endByte.
43
+ fileName ifNotNil: [ sourceAnchor filename: fileName ].
44
+
45
+ ^ sourceAnchor
42
46
]
43
47
44
48
{ #category : ' accessing' }
@@ -53,10 +57,27 @@ TSCImporterVisitor >> fileName: anObject [
53
57
fileName := anObject
54
58
]
55
59
60
+ { #category : ' as yet unclassified' }
61
+ TSCImporterVisitor >> importFromString: aString [
62
+
63
+ | rootNode |
64
+ rootNode := (parser parseString: aString) rootNode.
65
+ sourceCode := aString.
66
+ fileName := nil .
67
+
68
+ rootNode accept: self .
69
+
70
+ ^ model
71
+ ]
72
+
56
73
{ #category : ' initialization' }
57
74
TSCImporterVisitor >> initialize [
58
75
59
76
super initialize.
77
+
78
+ parser := TSParser new .
79
+ parser language: (TSLanguage cLanguage).
80
+
60
81
context := Stack new .
61
82
model := FamixCModel new .
62
83
inDeclaration := false
You can’t perform that action at this time.
0 commit comments