Skip to content

Commit 169f5cb

Browse files
Add the offset and offsetEnd fields to all nodes
1 parent 16241ee commit 169f5cb

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

schema/src/main/scala/io/shiftleft/codepropertygraph/schema/Ast.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,14 @@ object Ast extends SchemaBase {
8181
|start column number of the code represented by the node.
8282
|For machine-code-based and bytecode-based frontends, `LINE_NUMBER` contains
8383
|the address at which the code starts while `COLUMN_NUMBER` is undefined.
84+
|
85+
|The optional `OFFSET` and `OFFSET_END` specify the start
86+
|and exclusive end position of the code belonging to a node within the corresponding
87+
|`FILE` nodes `CONTENT` property.
8488
|""".stripMargin
8589
)
8690
.addProperties(order, code)
87-
.addProperties(lineNumber, columnNumber)
91+
.addProperties(lineNumber, columnNumber, offset, offsetEnd)
8892

8993
// The following nodes from other schemas are AST nodes
9094

schema/src/main/scala/io/shiftleft/codepropertygraph/schema/Method.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ object Method extends SchemaBase {
6161
|the name of the source file is specified in `FILENAME`. An optional hash value
6262
|MAY be calculated over the function contents and included in the `HASH` field.
6363
|
64-
|The optional `OFFSET` and `OFFSET_END` specify the start
65-
|and exclusive end position of the code belonging to a method within the corresponding
66-
|`FILE` nodes `CONTENT` property.
67-
|
6864
|Finally, the fully qualified name of the program constructs that the method
6965
|is immediately contained in is stored in the `AST_PARENT_FULL_NAME` field
7066
|and its type is indicated in the `AST_PARENT_TYPE` field to be one of
@@ -74,7 +70,6 @@ object Method extends SchemaBase {
7470
.protoId(ProtoIds.Method)
7571
.addProperties(fullName, isExternal, signature, lineNumberEnd, columnNumberEnd, filename, hash)
7672
.addProperties(astParentType, astParentFullName)
77-
.addProperties(offset, offsetEnd)
7873
.extendz(declaration)
7974
.primaryKey(name)
8075

schema/src/main/scala/io/shiftleft/codepropertygraph/schema/Type.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ object Type extends SchemaBase {
9797
|known to be an alias of another type (as for example introduced via the C
9898
|`typedef` statement), the name of the alias is stored in `ALIAS_TYPE_FULL_NAME`.
9999
|
100-
|The optional `OFFSET` and `OFFSET_END` specify the start
101-
|and exclusive end position of the code belonging to a `TYPE_DECL` within the corresponding
102-
|`FILE` nodes `CONTENT` property.
103-
|
104100
|Finally, the fully qualified name of the program constructs that the type declaration
105101
|is immediately contained in is stored in the `AST_PARENT_FULL_NAME` field
106102
|and its type is indicated in the `AST_PARENT_TYPE` field to be one of
@@ -111,7 +107,6 @@ object Type extends SchemaBase {
111107
.protoId(ProtoIds.TypeDecl)
112108
.addProperties(name, fullName, isExternal, inheritsFromTypeFullName, aliasTypeFullName, filename)
113109
.addProperties(astParentType, astParentFullName)
114-
.addProperties(offset, offsetEnd)
115110
.primaryKey(name)
116111

117112
val typeParameter: NodeType = builder

0 commit comments

Comments
 (0)