Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FILE_CONENT property proposal. #1737

Merged
merged 4 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,35 @@ object FileSystem extends SchemaBase {
|""".stripMargin
)
.protoId(38)
.addProperties(name, hash)
.addProperties(name, hash, content)

val offset = builder
.addProperty(
name = "OFFSET",
valueType = ValueType.Int,
comment = """
|Start offset into the CONTENT property of the corresponding FILE node.
|The offset is measure in characters so parts of the content can easily
|be accessed via `content.substring(offset, offsetEnd)`.
|E.g. for METHOD nodes this start offset points to the start of the methods
|source code in the string holding the source code of the entire file.
""".stripMargin
)
.protoId(3812)

val offsetEnd = builder
.addProperty(
name = "OFFSET_END",
valueType = ValueType.Int,
comment = """
|End offset (exclusive) into the CONTENT property of the corresponding FILE node.
|The end offset is measure in characters so parts of the content can easily
|be accessed via `content.substring(offset, offsetEnd)`.
|E.g. for METHOD nodes this end offset points to the first code position which is
|not part of the method.
""".stripMargin
)
.protoId(3813)

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ object Method extends SchemaBase {
|`LINE_NUMBER`, `COLUMN_NUMBER`, `LINE_NUMBER_END`, and `COLUMN_NUMBER_END` and
|the name of the source file is specified in `FILENAME`. An optional hash value
|MAY be calculated over the function contents and included in the `HASH` field.
|The optional `OFFSET` and `OFFSET_END` specify the start
|and exclusive end position of the code belonging to a method within the corresponding
|`FILE` nodes `CONTENT` property.
|
|Finally, the fully qualified name of the program constructs that the method
|is immediately contained in is stored in the `AST_PARENT_FULL_NAME` field
Expand All @@ -70,6 +73,7 @@ object Method extends SchemaBase {
.protoId(1)
.addProperties(fullName, isExternal, signature, lineNumberEnd, columnNumberEnd, filename, hash)
.addProperties(astParentType, astParentFullName)
.addProperties(offset, offsetEnd)
.extendz(declaration)

val isVariadic = builder
Expand Down
Loading