Skip to content

Commit de97f0c

Browse files
eregonandrykonchin
authored andcommitted
Include sourceCharIndex & sourceLength in TruffleASTPrinter
1 parent 7ac5c01 commit de97f0c

File tree

624 files changed

+11728
-103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

624 files changed

+11728
-103
lines changed

spec/truffle/parsing/fixtures/BEGIN/BEGIN.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,30 @@ ast: |
3737
SequenceNode
3838
attributes:
3939
flags = 12
40+
sourceCharIndex = 0
41+
sourceLength = 15
4042
children:
4143
body = [
4244
WriteLocalVariableNode
4345
attributes:
4446
flags = 0
4547
frameSlot = 0 # (self)
48+
sourceCharIndex = -1
49+
sourceLength = 0
4650
children:
4751
valueNode =
4852
ProfileArgumentNodeGen
4953
attributes:
5054
flags = 0
55+
sourceCharIndex = -1
56+
sourceLength = 0
5157
children:
5258
childNode_ =
5359
ReadSelfNode
5460
attributes:
5561
flags = 0
62+
sourceCharIndex = -1
63+
sourceLength = 0
5664
RubyCallNode
5765
attributes:
5866
descriptor = NoKeywordArgumentsDescriptor
@@ -67,11 +75,15 @@ ast: |
6775
methodName = "a"
6876
notEmptyKeywordsProfile = false
6977
notRuby2KeywordsHashProfile = false
78+
sourceCharIndex = 12
79+
sourceLength = 1
7080
children:
7181
receiver =
7282
SelfNode
7383
attributes:
7484
flags = 0
85+
sourceCharIndex = -1
86+
sourceLength = 0
7587
RubyCallNode
7688
attributes:
7789
descriptor = NoKeywordArgumentsDescriptor
@@ -86,9 +98,13 @@ ast: |
8698
methodName = "b"
8799
notEmptyKeywordsProfile = false
88100
notRuby2KeywordsHashProfile = false
101+
sourceCharIndex = 0
102+
sourceLength = 1
89103
children:
90104
receiver =
91105
SelfNode
92106
attributes:
93107
flags = 0
108+
sourceCharIndex = -1
109+
sourceLength = 0
94110
]

spec/truffle/parsing/fixtures/BEGIN/when_multiple_occurrences.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,30 @@ ast: |
4545
SequenceNode
4646
attributes:
4747
flags = 12
48+
sourceCharIndex = 0
49+
sourceLength = 43
4850
children:
4951
body = [
5052
WriteLocalVariableNode
5153
attributes:
5254
flags = 0
5355
frameSlot = 0 # (self)
56+
sourceCharIndex = -1
57+
sourceLength = 0
5458
children:
5559
valueNode =
5660
ProfileArgumentNodeGen
5761
attributes:
5862
flags = 0
63+
sourceCharIndex = -1
64+
sourceLength = 0
5965
children:
6066
childNode_ =
6167
ReadSelfNode
6268
attributes:
6369
flags = 0
70+
sourceCharIndex = -1
71+
sourceLength = 0
6472
RubyCallNode
6573
attributes:
6674
descriptor = NoKeywordArgumentsDescriptor
@@ -75,11 +83,15 @@ ast: |
7583
methodName = "a"
7684
notEmptyKeywordsProfile = false
7785
notRuby2KeywordsHashProfile = false
86+
sourceCharIndex = 10
87+
sourceLength = 1
7888
children:
7989
receiver =
8090
SelfNode
8191
attributes:
8292
flags = 0
93+
sourceCharIndex = -1
94+
sourceLength = 0
8395
RubyCallNode
8496
attributes:
8597
descriptor = NoKeywordArgumentsDescriptor
@@ -94,11 +106,15 @@ ast: |
94106
methodName = "b"
95107
notEmptyKeywordsProfile = false
96108
notRuby2KeywordsHashProfile = false
109+
sourceCharIndex = 25
110+
sourceLength = 1
97111
children:
98112
receiver =
99113
SelfNode
100114
attributes:
101115
flags = 0
116+
sourceCharIndex = -1
117+
sourceLength = 0
102118
RubyCallNode
103119
attributes:
104120
descriptor = NoKeywordArgumentsDescriptor
@@ -113,12 +129,18 @@ ast: |
113129
methodName = "c"
114130
notEmptyKeywordsProfile = false
115131
notRuby2KeywordsHashProfile = false
132+
sourceCharIndex = 40
133+
sourceLength = 1
116134
children:
117135
receiver =
118136
SelfNode
119137
attributes:
120138
flags = 0
139+
sourceCharIndex = -1
140+
sourceLength = 0
121141
NilLiteralNode
122142
attributes:
123143
flags = 0
144+
sourceCharIndex = 0
145+
sourceLength = 43
124146
]

spec/truffle/parsing/fixtures/END.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,25 @@ ast: |
1313
attributes:
1414
flags = 1
1515
holder = org.truffleruby.language.control.OnceNode$Holder@...
16+
sourceCharIndex = 0
17+
sourceLength = 15
1618
children:
1719
child =
1820
CatchBreakNode
1921
attributes:
2022
breakID = org.truffleruby.language.control.BreakID@...
2123
flags = 0
2224
isWhile = false
25+
sourceCharIndex = 0
26+
sourceLength = 0
2327
children:
2428
body =
2529
FrameOnStackNode
2630
attributes:
2731
flags = 0
2832
frameOnStackMarkerSlot = 2
33+
sourceCharIndex = -1
34+
sourceLength = 0
2935
children:
3036
child =
3137
RubyCallNode
@@ -42,11 +48,15 @@ ast: |
4248
methodName = "at_exit"
4349
notEmptyKeywordsProfile = false
4450
notRuby2KeywordsHashProfile = false
51+
sourceCharIndex = -1
52+
sourceLength = 0
4553
children:
4654
arguments = [
4755
BooleanLiteralNode
4856
attributes:
4957
flags = 0
58+
sourceCharIndex = 0
59+
sourceLength = 0
5060
value = false
5161
]
5262
block =
@@ -57,6 +67,8 @@ ast: |
5767
flags = 0
5868
frameOnStackMarkerSlot = 2
5969
sharedMethodInfo = SharedMethodInfo(staticLexicalScope = :: Object, arity = Arity{preRequired = 0, optional = 0, hasRest = false, isImplicitRest = false, postRequired = 0, keywordArguments = [], requiredKeywordArgumentsCount = 0, hasKeywordsRest = false}, originName = block in <top (required)>, blockDepth = 1, parseName = block in <top (required)>, notes = <top (required)>, argumentDescriptors = [])
70+
sourceCharIndex = 0
71+
sourceLength = 0
6072
type = PROC
6173
call targets:
6274
RubyProcRootNode
@@ -77,43 +89,59 @@ ast: |
7789
SequenceNode
7890
attributes:
7991
flags = 12
92+
sourceCharIndex = 0
93+
sourceLength = 0
8094
children:
8195
body = [
8296
WriteLocalVariableNode
8397
attributes:
8498
flags = 0
8599
frameSlot = 0 # (self)
100+
sourceCharIndex = -1
101+
sourceLength = 0
86102
children:
87103
valueNode =
88104
ProfileArgumentNodeGen
89105
attributes:
90106
flags = 0
107+
sourceCharIndex = -1
108+
sourceLength = 0
91109
children:
92110
childNode_ =
93111
ReadSelfNode
94112
attributes:
95113
flags = 0
114+
sourceCharIndex = -1
115+
sourceLength = 0
96116
IntegerFixnumLiteralNode
97117
attributes:
98118
flags = 1
119+
sourceCharIndex = 8
120+
sourceLength = 1
99121
value = 1
100122
IntegerFixnumLiteralNode
101123
attributes:
102124
flags = 1
125+
sourceCharIndex = 12
126+
sourceLength = 1
103127
value = 2
104128
]
105129
receiver =
106130
ReadConstantNode
107131
attributes:
108132
flags = 0
109133
name = "KernelOperations"
134+
sourceCharIndex = 0
135+
sourceLength = 0
110136
children:
111137
moduleNode =
112138
ReadConstantWithLexicalScopeNode
113139
attributes:
114140
flags = 0
115141
lexicalScope = :: Object
116142
name = "Truffle"
143+
sourceCharIndex = 0
144+
sourceLength = 0
117145
children:
118146
getConstantNode =
119147
GetConstantNodeGen

spec/truffle/parsing/fixtures/TOPLEVEL_BINDING.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,47 @@ ast: |
2929
SequenceNode
3030
attributes:
3131
flags = 12
32+
sourceCharIndex = 0
33+
sourceLength = 5
3234
children:
3335
body = [
3436
SetTopLevelBindingNode
3537
attributes:
3638
flags = 0
39+
sourceCharIndex = -1
40+
sourceLength = 0
3741
WriteLocalVariableNode
3842
attributes:
3943
flags = 0
4044
frameSlot = 0 # (self)
45+
sourceCharIndex = -1
46+
sourceLength = 0
4147
children:
4248
valueNode =
4349
ProfileArgumentNodeGen
4450
attributes:
4551
flags = 0
52+
sourceCharIndex = -1
53+
sourceLength = 0
4654
children:
4755
childNode_ =
4856
ReadSelfNode
4957
attributes:
5058
flags = 0
59+
sourceCharIndex = -1
60+
sourceLength = 0
5161
WriteLocalVariableNode
5262
attributes:
5363
flags = 1
5464
frameSlot = 2 # a
65+
sourceCharIndex = 0
66+
sourceLength = 5
5567
children:
5668
valueNode =
5769
IntegerFixnumLiteralNode
5870
attributes:
5971
flags = 0
72+
sourceCharIndex = 4
73+
sourceLength = 1
6074
value = 1
6175
]

spec/truffle/parsing/fixtures/__ENCODING__.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ ast: |
77
ObjectLiteralNode
88
attributes:
99
flags = 1
10-
object = UTF-8
10+
object = UTF-8
11+
sourceCharIndex = 0
12+
sourceLength = 12

0 commit comments

Comments
 (0)