From 6d90c69a21e73f2d474ae21f45162d4d73dc5605 Mon Sep 17 00:00:00 2001 From: Michael Pollmeier Date: Mon, 1 Jul 2024 12:09:25 +0200 Subject: [PATCH] test with heapspike fix depends on https://github.com/joernio/flatgraph/pull/213, not merged yet --- build.sbt | 2 +- .../generated/GraphSchema.scala | 325 ++++++++++++ .../generated/nodes/Annotation.scala | 235 ++++++++- .../generated/nodes/AnnotationLiteral.scala | 208 +++++++- .../generated/nodes/AnnotationParameter.scala | 123 ++++- .../nodes/AnnotationParameterAssign.scala | 123 ++++- .../generated/nodes/ArrayInitializer.scala | 181 ++++++- .../generated/nodes/Binding.scala | 88 +++- .../generated/nodes/Block.scala | 266 +++++++++- .../generated/nodes/Call.scala | 374 +++++++++++++- .../generated/nodes/ClosureBinding.scala | 96 +++- .../generated/nodes/Comment.scala | 150 +++++- .../generated/nodes/ConfigFile.scala | 61 ++- .../generated/nodes/ControlStructure.scala | 235 ++++++++- .../generated/nodes/Dependency.scala | 92 +++- .../generated/nodes/FieldIdentifier.scala | 208 +++++++- .../generated/nodes/File.scala | 208 +++++++- .../generated/nodes/Finding.scala | 73 ++- .../generated/nodes/Identifier.scala | 293 ++++++++++- .../generated/nodes/Import.scala | 278 ++++++++++- .../generated/nodes/JumpLabel.scala | 177 ++++++- .../generated/nodes/JumpTarget.scala | 204 +++++++- .../generated/nodes/KeyValuePair.scala | 61 ++- .../generated/nodes/Literal.scala | 266 +++++++++- .../generated/nodes/Local.scala | 266 +++++++++- .../generated/nodes/Location.scala | 289 ++++++++++- .../generated/nodes/Member.scala | 289 ++++++++++- .../generated/nodes/MetaData.scala | 148 +++++- .../generated/nodes/Method.scala | 467 +++++++++++++++++- .../generated/nodes/MethodParameterIn.scala | 347 ++++++++++++- .../generated/nodes/MethodParameterOut.scala | 258 +++++++++- .../generated/nodes/MethodRef.scala | 293 ++++++++++- .../generated/nodes/MethodReturn.scala | 235 ++++++++- .../generated/nodes/Modifier.scala | 150 +++++- .../generated/nodes/Namespace.scala | 150 +++++- .../generated/nodes/NamespaceBlock.scala | 204 +++++++- .../generated/nodes/Return.scala | 181 ++++++- .../generated/nodes/Tag.scala | 61 ++- .../generated/nodes/TagNodePair.scala | 67 ++- .../generated/nodes/TemplateDom.scala | 208 +++++++- .../generated/nodes/Type.scala | 88 +++- .../generated/nodes/TypeArgument.scala | 123 ++++- .../generated/nodes/TypeDecl.scala | 407 ++++++++++++++- .../generated/nodes/TypeParameter.scala | 150 +++++- .../generated/nodes/TypeRef.scala | 266 +++++++++- .../generated/nodes/Unknown.scala | 320 +++++++++++- 46 files changed, 8946 insertions(+), 348 deletions(-) diff --git a/build.sbt b/build.sbt index 62b8640a0..a91097b28 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ name := "codepropertygraph" // parsed by project/Versions.scala, updated by updateDependencies.sh -val flatgraphVersion = "0.0.68+2-d5a3d18e" +val flatgraphVersion = "0.0.70+5-ca6ab404" inThisBuild( List( diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/GraphSchema.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/GraphSchema.scala index 7fccb6d66..98dc997a4 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/GraphSchema.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/GraphSchema.scala @@ -914,6 +914,328 @@ object GraphSchema extends flatgraph.Schema { nodePropertyDescriptors(4663) = FormalQtyType.QtyOne nodePropertyDescriptors } + private val newNodeInsertionHelpers: Array[flatgraph.NewNodePropertyInsertionHelper] = { + val _newNodeInserters = new Array[flatgraph.NewNodePropertyInsertionHelper](5192) + _newNodeInserters(88) = nodes.NewAnnotation.InsertionHelpers.NewNodeInserter_Annotation_argumentIndex + _newNodeInserters(176) = nodes.NewAnnotation.InsertionHelpers.NewNodeInserter_Annotation_argumentName + _newNodeInserters(880) = nodes.NewAnnotation.InsertionHelpers.NewNodeInserter_Annotation_code + _newNodeInserters(968) = nodes.NewAnnotation.InsertionHelpers.NewNodeInserter_Annotation_columnNumber + _newNodeInserters(1936) = nodes.NewAnnotation.InsertionHelpers.NewNodeInserter_Annotation_fullName + _newNodeInserters(2992) = nodes.NewAnnotation.InsertionHelpers.NewNodeInserter_Annotation_lineNumber + _newNodeInserters(3432) = nodes.NewAnnotation.InsertionHelpers.NewNodeInserter_Annotation_name + _newNodeInserters(3784) = nodes.NewAnnotation.InsertionHelpers.NewNodeInserter_Annotation_order + _newNodeInserters(90) = nodes.NewAnnotationLiteral.InsertionHelpers.NewNodeInserter_AnnotationLiteral_argumentIndex + _newNodeInserters(178) = nodes.NewAnnotationLiteral.InsertionHelpers.NewNodeInserter_AnnotationLiteral_argumentName + _newNodeInserters(882) = nodes.NewAnnotationLiteral.InsertionHelpers.NewNodeInserter_AnnotationLiteral_code + _newNodeInserters(970) = nodes.NewAnnotationLiteral.InsertionHelpers.NewNodeInserter_AnnotationLiteral_columnNumber + _newNodeInserters(2994) = nodes.NewAnnotationLiteral.InsertionHelpers.NewNodeInserter_AnnotationLiteral_lineNumber + _newNodeInserters(3434) = nodes.NewAnnotationLiteral.InsertionHelpers.NewNodeInserter_AnnotationLiteral_name + _newNodeInserters(3786) = nodes.NewAnnotationLiteral.InsertionHelpers.NewNodeInserter_AnnotationLiteral_order + _newNodeInserters(884) = nodes.NewAnnotationParameter.InsertionHelpers.NewNodeInserter_AnnotationParameter_code + _newNodeInserters(972) = + nodes.NewAnnotationParameter.InsertionHelpers.NewNodeInserter_AnnotationParameter_columnNumber + _newNodeInserters(2996) = + nodes.NewAnnotationParameter.InsertionHelpers.NewNodeInserter_AnnotationParameter_lineNumber + _newNodeInserters(3788) = nodes.NewAnnotationParameter.InsertionHelpers.NewNodeInserter_AnnotationParameter_order + _newNodeInserters(886) = + nodes.NewAnnotationParameterAssign.InsertionHelpers.NewNodeInserter_AnnotationParameterAssign_code + _newNodeInserters(974) = + nodes.NewAnnotationParameterAssign.InsertionHelpers.NewNodeInserter_AnnotationParameterAssign_columnNumber + _newNodeInserters(2998) = + nodes.NewAnnotationParameterAssign.InsertionHelpers.NewNodeInserter_AnnotationParameterAssign_lineNumber + _newNodeInserters(3790) = + nodes.NewAnnotationParameterAssign.InsertionHelpers.NewNodeInserter_AnnotationParameterAssign_order + _newNodeInserters(96) = nodes.NewArrayInitializer.InsertionHelpers.NewNodeInserter_ArrayInitializer_argumentIndex + _newNodeInserters(184) = nodes.NewArrayInitializer.InsertionHelpers.NewNodeInserter_ArrayInitializer_argumentName + _newNodeInserters(888) = nodes.NewArrayInitializer.InsertionHelpers.NewNodeInserter_ArrayInitializer_code + _newNodeInserters(976) = nodes.NewArrayInitializer.InsertionHelpers.NewNodeInserter_ArrayInitializer_columnNumber + _newNodeInserters(3000) = nodes.NewArrayInitializer.InsertionHelpers.NewNodeInserter_ArrayInitializer_lineNumber + _newNodeInserters(3792) = nodes.NewArrayInitializer.InsertionHelpers.NewNodeInserter_ArrayInitializer_order + _newNodeInserters(3178) = nodes.NewBinding.InsertionHelpers.NewNodeInserter_Binding_methodFullName + _newNodeInserters(3442) = nodes.NewBinding.InsertionHelpers.NewNodeInserter_Binding_name + _newNodeInserters(4322) = nodes.NewBinding.InsertionHelpers.NewNodeInserter_Binding_signature + _newNodeInserters(100) = nodes.NewBlock.InsertionHelpers.NewNodeInserter_Block_argumentIndex + _newNodeInserters(188) = nodes.NewBlock.InsertionHelpers.NewNodeInserter_Block_argumentName + _newNodeInserters(892) = nodes.NewBlock.InsertionHelpers.NewNodeInserter_Block_code + _newNodeInserters(980) = nodes.NewBlock.InsertionHelpers.NewNodeInserter_Block_columnNumber + _newNodeInserters(1596) = nodes.NewBlock.InsertionHelpers.NewNodeInserter_Block_dynamicTypeHintFullName + _newNodeInserters(3004) = nodes.NewBlock.InsertionHelpers.NewNodeInserter_Block_lineNumber + _newNodeInserters(3796) = nodes.NewBlock.InsertionHelpers.NewNodeInserter_Block_order + _newNodeInserters(4148) = nodes.NewBlock.InsertionHelpers.NewNodeInserter_Block_possibleTypes + _newNodeInserters(4588) = nodes.NewBlock.InsertionHelpers.NewNodeInserter_Block_typeFullName + _newNodeInserters(102) = nodes.NewCall.InsertionHelpers.NewNodeInserter_Call_argumentIndex + _newNodeInserters(190) = nodes.NewCall.InsertionHelpers.NewNodeInserter_Call_argumentName + _newNodeInserters(894) = nodes.NewCall.InsertionHelpers.NewNodeInserter_Call_code + _newNodeInserters(982) = nodes.NewCall.InsertionHelpers.NewNodeInserter_Call_columnNumber + _newNodeInserters(1510) = nodes.NewCall.InsertionHelpers.NewNodeInserter_Call_dispatchType + _newNodeInserters(1598) = nodes.NewCall.InsertionHelpers.NewNodeInserter_Call_dynamicTypeHintFullName + _newNodeInserters(3006) = nodes.NewCall.InsertionHelpers.NewNodeInserter_Call_lineNumber + _newNodeInserters(3182) = nodes.NewCall.InsertionHelpers.NewNodeInserter_Call_methodFullName + _newNodeInserters(3446) = nodes.NewCall.InsertionHelpers.NewNodeInserter_Call_name + _newNodeInserters(3798) = nodes.NewCall.InsertionHelpers.NewNodeInserter_Call_order + _newNodeInserters(4150) = nodes.NewCall.InsertionHelpers.NewNodeInserter_Call_possibleTypes + _newNodeInserters(4326) = nodes.NewCall.InsertionHelpers.NewNodeInserter_Call_signature + _newNodeInserters(4590) = nodes.NewCall.InsertionHelpers.NewNodeInserter_Call_typeFullName + _newNodeInserters(720) = nodes.NewClosureBinding.InsertionHelpers.NewNodeInserter_ClosureBinding_closureBindingId + _newNodeInserters(808) = nodes.NewClosureBinding.InsertionHelpers.NewNodeInserter_ClosureBinding_closureOriginalName + _newNodeInserters(1688) = nodes.NewClosureBinding.InsertionHelpers.NewNodeInserter_ClosureBinding_evaluationStrategy + _newNodeInserters(898) = nodes.NewComment.InsertionHelpers.NewNodeInserter_Comment_code + _newNodeInserters(986) = nodes.NewComment.InsertionHelpers.NewNodeInserter_Comment_columnNumber + _newNodeInserters(1866) = nodes.NewComment.InsertionHelpers.NewNodeInserter_Comment_filename + _newNodeInserters(3010) = nodes.NewComment.InsertionHelpers.NewNodeInserter_Comment_lineNumber + _newNodeInserters(3802) = nodes.NewComment.InsertionHelpers.NewNodeInserter_Comment_order + _newNodeInserters(1252) = nodes.NewConfigFile.InsertionHelpers.NewNodeInserter_ConfigFile_content + _newNodeInserters(3452) = nodes.NewConfigFile.InsertionHelpers.NewNodeInserter_ConfigFile_name + _newNodeInserters(110) = nodes.NewControlStructure.InsertionHelpers.NewNodeInserter_ControlStructure_argumentIndex + _newNodeInserters(198) = nodes.NewControlStructure.InsertionHelpers.NewNodeInserter_ControlStructure_argumentName + _newNodeInserters(902) = nodes.NewControlStructure.InsertionHelpers.NewNodeInserter_ControlStructure_code + _newNodeInserters(990) = nodes.NewControlStructure.InsertionHelpers.NewNodeInserter_ControlStructure_columnNumber + _newNodeInserters(1342) = + nodes.NewControlStructure.InsertionHelpers.NewNodeInserter_ControlStructure_controlStructureType + _newNodeInserters(3014) = nodes.NewControlStructure.InsertionHelpers.NewNodeInserter_ControlStructure_lineNumber + _newNodeInserters(3806) = nodes.NewControlStructure.InsertionHelpers.NewNodeInserter_ControlStructure_order + _newNodeInserters(4070) = nodes.NewControlStructure.InsertionHelpers.NewNodeInserter_ControlStructure_parserTypeName + _newNodeInserters(1432) = nodes.NewDependency.InsertionHelpers.NewNodeInserter_Dependency_dependencyGroupId + _newNodeInserters(3456) = nodes.NewDependency.InsertionHelpers.NewNodeInserter_Dependency_name + _newNodeInserters(4776) = nodes.NewDependency.InsertionHelpers.NewNodeInserter_Dependency_version + _newNodeInserters(114) = nodes.NewFieldIdentifier.InsertionHelpers.NewNodeInserter_FieldIdentifier_argumentIndex + _newNodeInserters(202) = nodes.NewFieldIdentifier.InsertionHelpers.NewNodeInserter_FieldIdentifier_argumentName + _newNodeInserters(466) = nodes.NewFieldIdentifier.InsertionHelpers.NewNodeInserter_FieldIdentifier_canonicalName + _newNodeInserters(906) = nodes.NewFieldIdentifier.InsertionHelpers.NewNodeInserter_FieldIdentifier_code + _newNodeInserters(994) = nodes.NewFieldIdentifier.InsertionHelpers.NewNodeInserter_FieldIdentifier_columnNumber + _newNodeInserters(3018) = nodes.NewFieldIdentifier.InsertionHelpers.NewNodeInserter_FieldIdentifier_lineNumber + _newNodeInserters(3810) = nodes.NewFieldIdentifier.InsertionHelpers.NewNodeInserter_FieldIdentifier_order + _newNodeInserters(908) = nodes.NewFile.InsertionHelpers.NewNodeInserter_File_code + _newNodeInserters(996) = nodes.NewFile.InsertionHelpers.NewNodeInserter_File_columnNumber + _newNodeInserters(1260) = nodes.NewFile.InsertionHelpers.NewNodeInserter_File_content + _newNodeInserters(2052) = nodes.NewFile.InsertionHelpers.NewNodeInserter_File_hash + _newNodeInserters(3020) = nodes.NewFile.InsertionHelpers.NewNodeInserter_File_lineNumber + _newNodeInserters(3460) = nodes.NewFile.InsertionHelpers.NewNodeInserter_File_name + _newNodeInserters(3812) = nodes.NewFile.InsertionHelpers.NewNodeInserter_File_order + _newNodeInserters(4870) = nodes.NewFinding.InsertionHelpers.NewNodeInserter_Finding_evidence + _newNodeInserters(4958) = nodes.NewFinding.InsertionHelpers.NewNodeInserter_Finding_keyValuePairs + _newNodeInserters(120) = nodes.NewIdentifier.InsertionHelpers.NewNodeInserter_Identifier_argumentIndex + _newNodeInserters(208) = nodes.NewIdentifier.InsertionHelpers.NewNodeInserter_Identifier_argumentName + _newNodeInserters(912) = nodes.NewIdentifier.InsertionHelpers.NewNodeInserter_Identifier_code + _newNodeInserters(1000) = nodes.NewIdentifier.InsertionHelpers.NewNodeInserter_Identifier_columnNumber + _newNodeInserters(1616) = nodes.NewIdentifier.InsertionHelpers.NewNodeInserter_Identifier_dynamicTypeHintFullName + _newNodeInserters(3024) = nodes.NewIdentifier.InsertionHelpers.NewNodeInserter_Identifier_lineNumber + _newNodeInserters(3464) = nodes.NewIdentifier.InsertionHelpers.NewNodeInserter_Identifier_name + _newNodeInserters(3816) = nodes.NewIdentifier.InsertionHelpers.NewNodeInserter_Identifier_order + _newNodeInserters(4168) = nodes.NewIdentifier.InsertionHelpers.NewNodeInserter_Identifier_possibleTypes + _newNodeInserters(4608) = nodes.NewIdentifier.InsertionHelpers.NewNodeInserter_Identifier_typeFullName + _newNodeInserters(914) = nodes.NewImport.InsertionHelpers.NewNodeInserter_Import_code + _newNodeInserters(1002) = nodes.NewImport.InsertionHelpers.NewNodeInserter_Import_columnNumber + _newNodeInserters(1794) = nodes.NewImport.InsertionHelpers.NewNodeInserter_Import_explicitAs + _newNodeInserters(2146) = nodes.NewImport.InsertionHelpers.NewNodeInserter_Import_importedAs + _newNodeInserters(2234) = nodes.NewImport.InsertionHelpers.NewNodeInserter_Import_importedEntity + _newNodeInserters(2498) = nodes.NewImport.InsertionHelpers.NewNodeInserter_Import_isExplicit + _newNodeInserters(2762) = nodes.NewImport.InsertionHelpers.NewNodeInserter_Import_isWildcard + _newNodeInserters(3026) = nodes.NewImport.InsertionHelpers.NewNodeInserter_Import_lineNumber + _newNodeInserters(3818) = nodes.NewImport.InsertionHelpers.NewNodeInserter_Import_order + _newNodeInserters(916) = nodes.NewJumpLabel.InsertionHelpers.NewNodeInserter_JumpLabel_code + _newNodeInserters(1004) = nodes.NewJumpLabel.InsertionHelpers.NewNodeInserter_JumpLabel_columnNumber + _newNodeInserters(3028) = nodes.NewJumpLabel.InsertionHelpers.NewNodeInserter_JumpLabel_lineNumber + _newNodeInserters(3468) = nodes.NewJumpLabel.InsertionHelpers.NewNodeInserter_JumpLabel_name + _newNodeInserters(3820) = nodes.NewJumpLabel.InsertionHelpers.NewNodeInserter_JumpLabel_order + _newNodeInserters(4084) = nodes.NewJumpLabel.InsertionHelpers.NewNodeInserter_JumpLabel_parserTypeName + _newNodeInserters(126) = nodes.NewJumpTarget.InsertionHelpers.NewNodeInserter_JumpTarget_argumentIndex + _newNodeInserters(918) = nodes.NewJumpTarget.InsertionHelpers.NewNodeInserter_JumpTarget_code + _newNodeInserters(1006) = nodes.NewJumpTarget.InsertionHelpers.NewNodeInserter_JumpTarget_columnNumber + _newNodeInserters(3030) = nodes.NewJumpTarget.InsertionHelpers.NewNodeInserter_JumpTarget_lineNumber + _newNodeInserters(3470) = nodes.NewJumpTarget.InsertionHelpers.NewNodeInserter_JumpTarget_name + _newNodeInserters(3822) = nodes.NewJumpTarget.InsertionHelpers.NewNodeInserter_JumpTarget_order + _newNodeInserters(4086) = nodes.NewJumpTarget.InsertionHelpers.NewNodeInserter_JumpTarget_parserTypeName + _newNodeInserters(2856) = nodes.NewKeyValuePair.InsertionHelpers.NewNodeInserter_KeyValuePair_key + _newNodeInserters(4704) = nodes.NewKeyValuePair.InsertionHelpers.NewNodeInserter_KeyValuePair_value + _newNodeInserters(130) = nodes.NewLiteral.InsertionHelpers.NewNodeInserter_Literal_argumentIndex + _newNodeInserters(218) = nodes.NewLiteral.InsertionHelpers.NewNodeInserter_Literal_argumentName + _newNodeInserters(922) = nodes.NewLiteral.InsertionHelpers.NewNodeInserter_Literal_code + _newNodeInserters(1010) = nodes.NewLiteral.InsertionHelpers.NewNodeInserter_Literal_columnNumber + _newNodeInserters(1626) = nodes.NewLiteral.InsertionHelpers.NewNodeInserter_Literal_dynamicTypeHintFullName + _newNodeInserters(3034) = nodes.NewLiteral.InsertionHelpers.NewNodeInserter_Literal_lineNumber + _newNodeInserters(3826) = nodes.NewLiteral.InsertionHelpers.NewNodeInserter_Literal_order + _newNodeInserters(4178) = nodes.NewLiteral.InsertionHelpers.NewNodeInserter_Literal_possibleTypes + _newNodeInserters(4618) = nodes.NewLiteral.InsertionHelpers.NewNodeInserter_Literal_typeFullName + _newNodeInserters(748) = nodes.NewLocal.InsertionHelpers.NewNodeInserter_Local_closureBindingId + _newNodeInserters(924) = nodes.NewLocal.InsertionHelpers.NewNodeInserter_Local_code + _newNodeInserters(1012) = nodes.NewLocal.InsertionHelpers.NewNodeInserter_Local_columnNumber + _newNodeInserters(1628) = nodes.NewLocal.InsertionHelpers.NewNodeInserter_Local_dynamicTypeHintFullName + _newNodeInserters(3036) = nodes.NewLocal.InsertionHelpers.NewNodeInserter_Local_lineNumber + _newNodeInserters(3476) = nodes.NewLocal.InsertionHelpers.NewNodeInserter_Local_name + _newNodeInserters(3828) = nodes.NewLocal.InsertionHelpers.NewNodeInserter_Local_order + _newNodeInserters(4180) = nodes.NewLocal.InsertionHelpers.NewNodeInserter_Local_possibleTypes + _newNodeInserters(4620) = nodes.NewLocal.InsertionHelpers.NewNodeInserter_Local_typeFullName + _newNodeInserters(574) = nodes.NewLocation.InsertionHelpers.NewNodeInserter_Location_className + _newNodeInserters(662) = nodes.NewLocation.InsertionHelpers.NewNodeInserter_Location_classShortName + _newNodeInserters(1894) = nodes.NewLocation.InsertionHelpers.NewNodeInserter_Location_filename + _newNodeInserters(3038) = nodes.NewLocation.InsertionHelpers.NewNodeInserter_Location_lineNumber + _newNodeInserters(3214) = nodes.NewLocation.InsertionHelpers.NewNodeInserter_Location_methodFullName + _newNodeInserters(3302) = nodes.NewLocation.InsertionHelpers.NewNodeInserter_Location_methodShortName + _newNodeInserters(3566) = nodes.NewLocation.InsertionHelpers.NewNodeInserter_Location_nodeLabel + _newNodeInserters(4006) = nodes.NewLocation.InsertionHelpers.NewNodeInserter_Location_packageName + _newNodeInserters(4446) = nodes.NewLocation.InsertionHelpers.NewNodeInserter_Location_symbol + _newNodeInserters(5062) = nodes.NewLocation.InsertionHelpers.NewNodeInserter_Location_node + _newNodeInserters(312) = nodes.NewMember.InsertionHelpers.NewNodeInserter_Member_astParentFullName + _newNodeInserters(400) = nodes.NewMember.InsertionHelpers.NewNodeInserter_Member_astParentType + _newNodeInserters(928) = nodes.NewMember.InsertionHelpers.NewNodeInserter_Member_code + _newNodeInserters(1016) = nodes.NewMember.InsertionHelpers.NewNodeInserter_Member_columnNumber + _newNodeInserters(1632) = nodes.NewMember.InsertionHelpers.NewNodeInserter_Member_dynamicTypeHintFullName + _newNodeInserters(3040) = nodes.NewMember.InsertionHelpers.NewNodeInserter_Member_lineNumber + _newNodeInserters(3480) = nodes.NewMember.InsertionHelpers.NewNodeInserter_Member_name + _newNodeInserters(3832) = nodes.NewMember.InsertionHelpers.NewNodeInserter_Member_order + _newNodeInserters(4184) = nodes.NewMember.InsertionHelpers.NewNodeInserter_Member_possibleTypes + _newNodeInserters(4624) = nodes.NewMember.InsertionHelpers.NewNodeInserter_Member_typeFullName + _newNodeInserters(2074) = nodes.NewMetaData.InsertionHelpers.NewNodeInserter_MetaData_hash + _newNodeInserters(2954) = nodes.NewMetaData.InsertionHelpers.NewNodeInserter_MetaData_language + _newNodeInserters(3922) = nodes.NewMetaData.InsertionHelpers.NewNodeInserter_MetaData_overlays + _newNodeInserters(4274) = nodes.NewMetaData.InsertionHelpers.NewNodeInserter_MetaData_root + _newNodeInserters(4802) = nodes.NewMetaData.InsertionHelpers.NewNodeInserter_MetaData_version + _newNodeInserters(316) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_astParentFullName + _newNodeInserters(404) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_astParentType + _newNodeInserters(932) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_code + _newNodeInserters(1020) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_columnNumber + _newNodeInserters(1108) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_columnNumberEnd + _newNodeInserters(1900) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_filename + _newNodeInserters(1988) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_fullName + _newNodeInserters(2076) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_hash + _newNodeInserters(2604) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_isExternal + _newNodeInserters(3044) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_lineNumber + _newNodeInserters(3132) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_lineNumberEnd + _newNodeInserters(3484) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_name + _newNodeInserters(3660) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_offset + _newNodeInserters(3748) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_offsetEnd + _newNodeInserters(3836) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_order + _newNodeInserters(4364) = nodes.NewMethod.InsertionHelpers.NewNodeInserter_Method_signature + _newNodeInserters(758) = + nodes.NewMethodParameterIn.InsertionHelpers.NewNodeInserter_MethodParameterIn_closureBindingId + _newNodeInserters(934) = nodes.NewMethodParameterIn.InsertionHelpers.NewNodeInserter_MethodParameterIn_code + _newNodeInserters(1022) = nodes.NewMethodParameterIn.InsertionHelpers.NewNodeInserter_MethodParameterIn_columnNumber + _newNodeInserters(1638) = + nodes.NewMethodParameterIn.InsertionHelpers.NewNodeInserter_MethodParameterIn_dynamicTypeHintFullName + _newNodeInserters(1726) = + nodes.NewMethodParameterIn.InsertionHelpers.NewNodeInserter_MethodParameterIn_evaluationStrategy + _newNodeInserters(2342) = nodes.NewMethodParameterIn.InsertionHelpers.NewNodeInserter_MethodParameterIn_index + _newNodeInserters(2694) = nodes.NewMethodParameterIn.InsertionHelpers.NewNodeInserter_MethodParameterIn_isVariadic + _newNodeInserters(3046) = nodes.NewMethodParameterIn.InsertionHelpers.NewNodeInserter_MethodParameterIn_lineNumber + _newNodeInserters(3486) = nodes.NewMethodParameterIn.InsertionHelpers.NewNodeInserter_MethodParameterIn_name + _newNodeInserters(3838) = nodes.NewMethodParameterIn.InsertionHelpers.NewNodeInserter_MethodParameterIn_order + _newNodeInserters(4190) = + nodes.NewMethodParameterIn.InsertionHelpers.NewNodeInserter_MethodParameterIn_possibleTypes + _newNodeInserters(4630) = nodes.NewMethodParameterIn.InsertionHelpers.NewNodeInserter_MethodParameterIn_typeFullName + _newNodeInserters(936) = nodes.NewMethodParameterOut.InsertionHelpers.NewNodeInserter_MethodParameterOut_code + _newNodeInserters(1024) = + nodes.NewMethodParameterOut.InsertionHelpers.NewNodeInserter_MethodParameterOut_columnNumber + _newNodeInserters(1728) = + nodes.NewMethodParameterOut.InsertionHelpers.NewNodeInserter_MethodParameterOut_evaluationStrategy + _newNodeInserters(2344) = nodes.NewMethodParameterOut.InsertionHelpers.NewNodeInserter_MethodParameterOut_index + _newNodeInserters(2696) = nodes.NewMethodParameterOut.InsertionHelpers.NewNodeInserter_MethodParameterOut_isVariadic + _newNodeInserters(3048) = nodes.NewMethodParameterOut.InsertionHelpers.NewNodeInserter_MethodParameterOut_lineNumber + _newNodeInserters(3488) = nodes.NewMethodParameterOut.InsertionHelpers.NewNodeInserter_MethodParameterOut_name + _newNodeInserters(3840) = nodes.NewMethodParameterOut.InsertionHelpers.NewNodeInserter_MethodParameterOut_order + _newNodeInserters(4632) = + nodes.NewMethodParameterOut.InsertionHelpers.NewNodeInserter_MethodParameterOut_typeFullName + _newNodeInserters(146) = nodes.NewMethodRef.InsertionHelpers.NewNodeInserter_MethodRef_argumentIndex + _newNodeInserters(234) = nodes.NewMethodRef.InsertionHelpers.NewNodeInserter_MethodRef_argumentName + _newNodeInserters(938) = nodes.NewMethodRef.InsertionHelpers.NewNodeInserter_MethodRef_code + _newNodeInserters(1026) = nodes.NewMethodRef.InsertionHelpers.NewNodeInserter_MethodRef_columnNumber + _newNodeInserters(1642) = nodes.NewMethodRef.InsertionHelpers.NewNodeInserter_MethodRef_dynamicTypeHintFullName + _newNodeInserters(3050) = nodes.NewMethodRef.InsertionHelpers.NewNodeInserter_MethodRef_lineNumber + _newNodeInserters(3226) = nodes.NewMethodRef.InsertionHelpers.NewNodeInserter_MethodRef_methodFullName + _newNodeInserters(3842) = nodes.NewMethodRef.InsertionHelpers.NewNodeInserter_MethodRef_order + _newNodeInserters(4194) = nodes.NewMethodRef.InsertionHelpers.NewNodeInserter_MethodRef_possibleTypes + _newNodeInserters(4634) = nodes.NewMethodRef.InsertionHelpers.NewNodeInserter_MethodRef_typeFullName + _newNodeInserters(940) = nodes.NewMethodReturn.InsertionHelpers.NewNodeInserter_MethodReturn_code + _newNodeInserters(1028) = nodes.NewMethodReturn.InsertionHelpers.NewNodeInserter_MethodReturn_columnNumber + _newNodeInserters(1644) = + nodes.NewMethodReturn.InsertionHelpers.NewNodeInserter_MethodReturn_dynamicTypeHintFullName + _newNodeInserters(1732) = nodes.NewMethodReturn.InsertionHelpers.NewNodeInserter_MethodReturn_evaluationStrategy + _newNodeInserters(3052) = nodes.NewMethodReturn.InsertionHelpers.NewNodeInserter_MethodReturn_lineNumber + _newNodeInserters(3844) = nodes.NewMethodReturn.InsertionHelpers.NewNodeInserter_MethodReturn_order + _newNodeInserters(4196) = nodes.NewMethodReturn.InsertionHelpers.NewNodeInserter_MethodReturn_possibleTypes + _newNodeInserters(4636) = nodes.NewMethodReturn.InsertionHelpers.NewNodeInserter_MethodReturn_typeFullName + _newNodeInserters(942) = nodes.NewModifier.InsertionHelpers.NewNodeInserter_Modifier_code + _newNodeInserters(1030) = nodes.NewModifier.InsertionHelpers.NewNodeInserter_Modifier_columnNumber + _newNodeInserters(3054) = nodes.NewModifier.InsertionHelpers.NewNodeInserter_Modifier_lineNumber + _newNodeInserters(3406) = nodes.NewModifier.InsertionHelpers.NewNodeInserter_Modifier_modifierType + _newNodeInserters(3846) = nodes.NewModifier.InsertionHelpers.NewNodeInserter_Modifier_order + _newNodeInserters(944) = nodes.NewNamespace.InsertionHelpers.NewNodeInserter_Namespace_code + _newNodeInserters(1032) = nodes.NewNamespace.InsertionHelpers.NewNodeInserter_Namespace_columnNumber + _newNodeInserters(3056) = nodes.NewNamespace.InsertionHelpers.NewNodeInserter_Namespace_lineNumber + _newNodeInserters(3496) = nodes.NewNamespace.InsertionHelpers.NewNodeInserter_Namespace_name + _newNodeInserters(3848) = nodes.NewNamespace.InsertionHelpers.NewNodeInserter_Namespace_order + _newNodeInserters(946) = nodes.NewNamespaceBlock.InsertionHelpers.NewNodeInserter_NamespaceBlock_code + _newNodeInserters(1034) = nodes.NewNamespaceBlock.InsertionHelpers.NewNodeInserter_NamespaceBlock_columnNumber + _newNodeInserters(1914) = nodes.NewNamespaceBlock.InsertionHelpers.NewNodeInserter_NamespaceBlock_filename + _newNodeInserters(2002) = nodes.NewNamespaceBlock.InsertionHelpers.NewNodeInserter_NamespaceBlock_fullName + _newNodeInserters(3058) = nodes.NewNamespaceBlock.InsertionHelpers.NewNodeInserter_NamespaceBlock_lineNumber + _newNodeInserters(3498) = nodes.NewNamespaceBlock.InsertionHelpers.NewNodeInserter_NamespaceBlock_name + _newNodeInserters(3850) = nodes.NewNamespaceBlock.InsertionHelpers.NewNodeInserter_NamespaceBlock_order + _newNodeInserters(156) = nodes.NewReturn.InsertionHelpers.NewNodeInserter_Return_argumentIndex + _newNodeInserters(244) = nodes.NewReturn.InsertionHelpers.NewNodeInserter_Return_argumentName + _newNodeInserters(948) = nodes.NewReturn.InsertionHelpers.NewNodeInserter_Return_code + _newNodeInserters(1036) = nodes.NewReturn.InsertionHelpers.NewNodeInserter_Return_columnNumber + _newNodeInserters(3060) = nodes.NewReturn.InsertionHelpers.NewNodeInserter_Return_lineNumber + _newNodeInserters(3852) = nodes.NewReturn.InsertionHelpers.NewNodeInserter_Return_order + _newNodeInserters(3502) = nodes.NewTag.InsertionHelpers.NewNodeInserter_Tag_name + _newNodeInserters(4734) = nodes.NewTag.InsertionHelpers.NewNodeInserter_Tag_value + _newNodeInserters(5088) = nodes.NewTagNodePair.InsertionHelpers.NewNodeInserter_TagNodePair_node + _newNodeInserters(5176) = nodes.NewTagNodePair.InsertionHelpers.NewNodeInserter_TagNodePair_tag + _newNodeInserters(162) = nodes.NewTemplateDom.InsertionHelpers.NewNodeInserter_TemplateDom_argumentIndex + _newNodeInserters(250) = nodes.NewTemplateDom.InsertionHelpers.NewNodeInserter_TemplateDom_argumentName + _newNodeInserters(954) = nodes.NewTemplateDom.InsertionHelpers.NewNodeInserter_TemplateDom_code + _newNodeInserters(1042) = nodes.NewTemplateDom.InsertionHelpers.NewNodeInserter_TemplateDom_columnNumber + _newNodeInserters(3066) = nodes.NewTemplateDom.InsertionHelpers.NewNodeInserter_TemplateDom_lineNumber + _newNodeInserters(3506) = nodes.NewTemplateDom.InsertionHelpers.NewNodeInserter_TemplateDom_name + _newNodeInserters(3858) = nodes.NewTemplateDom.InsertionHelpers.NewNodeInserter_TemplateDom_order + _newNodeInserters(2012) = nodes.NewType.InsertionHelpers.NewNodeInserter_Type_fullName + _newNodeInserters(3508) = nodes.NewType.InsertionHelpers.NewNodeInserter_Type_name + _newNodeInserters(4564) = nodes.NewType.InsertionHelpers.NewNodeInserter_Type_typeDeclFullName + _newNodeInserters(958) = nodes.NewTypeArgument.InsertionHelpers.NewNodeInserter_TypeArgument_code + _newNodeInserters(1046) = nodes.NewTypeArgument.InsertionHelpers.NewNodeInserter_TypeArgument_columnNumber + _newNodeInserters(3070) = nodes.NewTypeArgument.InsertionHelpers.NewNodeInserter_TypeArgument_lineNumber + _newNodeInserters(3862) = nodes.NewTypeArgument.InsertionHelpers.NewNodeInserter_TypeArgument_order + _newNodeInserters(80) = nodes.NewTypeDecl.InsertionHelpers.NewNodeInserter_TypeDecl_aliasTypeFullName + _newNodeInserters(344) = nodes.NewTypeDecl.InsertionHelpers.NewNodeInserter_TypeDecl_astParentFullName + _newNodeInserters(432) = nodes.NewTypeDecl.InsertionHelpers.NewNodeInserter_TypeDecl_astParentType + _newNodeInserters(960) = nodes.NewTypeDecl.InsertionHelpers.NewNodeInserter_TypeDecl_code + _newNodeInserters(1048) = nodes.NewTypeDecl.InsertionHelpers.NewNodeInserter_TypeDecl_columnNumber + _newNodeInserters(1928) = nodes.NewTypeDecl.InsertionHelpers.NewNodeInserter_TypeDecl_filename + _newNodeInserters(2016) = nodes.NewTypeDecl.InsertionHelpers.NewNodeInserter_TypeDecl_fullName + _newNodeInserters(2456) = nodes.NewTypeDecl.InsertionHelpers.NewNodeInserter_TypeDecl_inheritsFromTypeFullName + _newNodeInserters(2632) = nodes.NewTypeDecl.InsertionHelpers.NewNodeInserter_TypeDecl_isExternal + _newNodeInserters(3072) = nodes.NewTypeDecl.InsertionHelpers.NewNodeInserter_TypeDecl_lineNumber + _newNodeInserters(3512) = nodes.NewTypeDecl.InsertionHelpers.NewNodeInserter_TypeDecl_name + _newNodeInserters(3688) = nodes.NewTypeDecl.InsertionHelpers.NewNodeInserter_TypeDecl_offset + _newNodeInserters(3776) = nodes.NewTypeDecl.InsertionHelpers.NewNodeInserter_TypeDecl_offsetEnd + _newNodeInserters(3864) = nodes.NewTypeDecl.InsertionHelpers.NewNodeInserter_TypeDecl_order + _newNodeInserters(962) = nodes.NewTypeParameter.InsertionHelpers.NewNodeInserter_TypeParameter_code + _newNodeInserters(1050) = nodes.NewTypeParameter.InsertionHelpers.NewNodeInserter_TypeParameter_columnNumber + _newNodeInserters(3074) = nodes.NewTypeParameter.InsertionHelpers.NewNodeInserter_TypeParameter_lineNumber + _newNodeInserters(3514) = nodes.NewTypeParameter.InsertionHelpers.NewNodeInserter_TypeParameter_name + _newNodeInserters(3866) = nodes.NewTypeParameter.InsertionHelpers.NewNodeInserter_TypeParameter_order + _newNodeInserters(172) = nodes.NewTypeRef.InsertionHelpers.NewNodeInserter_TypeRef_argumentIndex + _newNodeInserters(260) = nodes.NewTypeRef.InsertionHelpers.NewNodeInserter_TypeRef_argumentName + _newNodeInserters(964) = nodes.NewTypeRef.InsertionHelpers.NewNodeInserter_TypeRef_code + _newNodeInserters(1052) = nodes.NewTypeRef.InsertionHelpers.NewNodeInserter_TypeRef_columnNumber + _newNodeInserters(1668) = nodes.NewTypeRef.InsertionHelpers.NewNodeInserter_TypeRef_dynamicTypeHintFullName + _newNodeInserters(3076) = nodes.NewTypeRef.InsertionHelpers.NewNodeInserter_TypeRef_lineNumber + _newNodeInserters(3868) = nodes.NewTypeRef.InsertionHelpers.NewNodeInserter_TypeRef_order + _newNodeInserters(4220) = nodes.NewTypeRef.InsertionHelpers.NewNodeInserter_TypeRef_possibleTypes + _newNodeInserters(4660) = nodes.NewTypeRef.InsertionHelpers.NewNodeInserter_TypeRef_typeFullName + _newNodeInserters(174) = nodes.NewUnknown.InsertionHelpers.NewNodeInserter_Unknown_argumentIndex + _newNodeInserters(262) = nodes.NewUnknown.InsertionHelpers.NewNodeInserter_Unknown_argumentName + _newNodeInserters(966) = nodes.NewUnknown.InsertionHelpers.NewNodeInserter_Unknown_code + _newNodeInserters(1054) = nodes.NewUnknown.InsertionHelpers.NewNodeInserter_Unknown_columnNumber + _newNodeInserters(1230) = nodes.NewUnknown.InsertionHelpers.NewNodeInserter_Unknown_containedRef + _newNodeInserters(1670) = nodes.NewUnknown.InsertionHelpers.NewNodeInserter_Unknown_dynamicTypeHintFullName + _newNodeInserters(3078) = nodes.NewUnknown.InsertionHelpers.NewNodeInserter_Unknown_lineNumber + _newNodeInserters(3870) = nodes.NewUnknown.InsertionHelpers.NewNodeInserter_Unknown_order + _newNodeInserters(4134) = nodes.NewUnknown.InsertionHelpers.NewNodeInserter_Unknown_parserTypeName + _newNodeInserters(4222) = nodes.NewUnknown.InsertionHelpers.NewNodeInserter_Unknown_possibleTypes + _newNodeInserters(4662) = nodes.NewUnknown.InsertionHelpers.NewNodeInserter_Unknown_typeFullName + _newNodeInserters + } override def getNumberOfNodeKinds: Int = 44 override def getNumberOfEdgeKinds: Int = 24 override def getNodeLabel(nodeKind: Int): String = nodeLabels(nodeKind) @@ -1224,4 +1546,7 @@ object GraphSchema extends flatgraph.Schema { override def getNodePropertyFormalQuantity(nodeKind: Int, propertyKind: Int): FormalQtyType.FormalQuantity = nodePropertyDescriptors(1 + propertyOffsetArrayIndex(nodeKind, propertyKind)) .asInstanceOf[FormalQtyType.FormalQuantity] + + override def getNewNodePropertyInserter(nodeKind: Int, propertyKind: Int): flatgraph.NewNodePropertyInsertionHelper = + newNodeInsertionHelpers(propertyOffsetArrayIndex(nodeKind, propertyKind)) } diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Annotation.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Annotation.scala index 1d2a4d60c..e2ec7b22f 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Annotation.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Annotation.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1389,7 +1390,223 @@ object NewAnnotation { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_Annotation_argumentIndex extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotation => + dstCast(offset) = generated.argumentIndex + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Annotation_argumentName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotation => + generated.argumentName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Annotation_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotation => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Annotation_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotation => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Annotation_fullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotation => + dstCast(offset) = generated.fullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Annotation_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotation => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Annotation_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotation => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Annotation_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotation => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewAnnotation extends NewNode(0.toShort) with AnnotationBase with ExpressionNew { override type StoredNodeType = Annotation override def label: String = "ANNOTATION" @@ -1420,15 +1637,15 @@ class NewAnnotation extends NewNode(0.toShort) with AnnotationBase with Expressi def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def name(value: String): this.type = { this.name = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 1, Iterator(this.argumentIndex)) - if (argumentName.nonEmpty) interface.insertProperty(this, 2, this.argumentName) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - interface.insertProperty(this, 22, Iterator(this.fullName)) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 1, 1) + interface.countProperty(this, 2, argumentName.size) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 22, 1) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationLiteral.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationLiteral.scala index 85d42b106..c4e71468e 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationLiteral.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationLiteral.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1375,7 +1376,198 @@ object NewAnnotationLiteral { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_AnnotationLiteral_argumentIndex extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotationLiteral => + dstCast(offset) = generated.argumentIndex + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_AnnotationLiteral_argumentName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotationLiteral => + generated.argumentName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_AnnotationLiteral_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotationLiteral => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_AnnotationLiteral_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotationLiteral => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_AnnotationLiteral_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotationLiteral => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_AnnotationLiteral_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotationLiteral => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_AnnotationLiteral_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotationLiteral => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewAnnotationLiteral extends NewNode(1.toShort) with AnnotationLiteralBase with ExpressionNew { override type StoredNodeType = AnnotationLiteral override def label: String = "ANNOTATION_LITERAL" @@ -1404,14 +1596,14 @@ class NewAnnotationLiteral extends NewNode(1.toShort) with AnnotationLiteralBase def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def name(value: String): this.type = { this.name = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 1, Iterator(this.argumentIndex)) - if (argumentName.nonEmpty) interface.insertProperty(this, 2, this.argumentName) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 1, 1) + interface.countProperty(this, 2, argumentName.size) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameter.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameter.scala index a0f88df2f..5ead9924f 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameter.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameter.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1330,7 +1331,119 @@ object NewAnnotationParameter { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_AnnotationParameter_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotationParameter => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_AnnotationParameter_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotationParameter => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_AnnotationParameter_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotationParameter => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_AnnotationParameter_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotationParameter => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewAnnotationParameter extends NewNode(2.toShort) with AnnotationParameterBase with AstNodeNew { override type StoredNodeType = AnnotationParameter override def label: String = "ANNOTATION_PARAMETER" @@ -1352,11 +1465,11 @@ class NewAnnotationParameter extends NewNode(2.toShort) with AnnotationParameter def lineNumber(value: Int): this.type = { this.lineNumber = Option(value); this } def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameterAssign.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameterAssign.scala index 5b80a3428..309aff021 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameterAssign.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/AnnotationParameterAssign.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1333,7 +1334,119 @@ object NewAnnotationParameterAssign { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_AnnotationParameterAssign_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotationParameterAssign => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_AnnotationParameterAssign_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotationParameterAssign => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_AnnotationParameterAssign_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotationParameterAssign => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_AnnotationParameterAssign_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewAnnotationParameterAssign => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewAnnotationParameterAssign extends NewNode(3.toShort) with AnnotationParameterAssignBase with AstNodeNew { override type StoredNodeType = AnnotationParameterAssign override def label: String = "ANNOTATION_PARAMETER_ASSIGN" @@ -1355,11 +1468,11 @@ class NewAnnotationParameterAssign extends NewNode(3.toShort) with AnnotationPar def lineNumber(value: Int): this.type = { this.lineNumber = Option(value); this } def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ArrayInitializer.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ArrayInitializer.scala index 40f76711e..ea1abc074 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ArrayInitializer.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ArrayInitializer.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1365,7 +1366,173 @@ object NewArrayInitializer { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_ArrayInitializer_argumentIndex extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewArrayInitializer => + dstCast(offset) = generated.argumentIndex + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_ArrayInitializer_argumentName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewArrayInitializer => + generated.argumentName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_ArrayInitializer_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewArrayInitializer => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_ArrayInitializer_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewArrayInitializer => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_ArrayInitializer_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewArrayInitializer => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_ArrayInitializer_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewArrayInitializer => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewArrayInitializer extends NewNode(4.toShort) with ArrayInitializerBase with AstNodeNew with ExpressionNew { override type StoredNodeType = ArrayInitializer override def label: String = "ARRAY_INITIALIZER" @@ -1392,13 +1559,13 @@ class NewArrayInitializer extends NewNode(4.toShort) with ArrayInitializerBase w def lineNumber(value: Int): this.type = { this.lineNumber = Option(value); this } def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 1, Iterator(this.argumentIndex)) - if (argumentName.nonEmpty) interface.insertProperty(this, 2, this.argumentName) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 1, 1) + interface.countProperty(this, 2, argumentName.size) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Binding.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Binding.scala index 4a04218cf..3f99b99b2 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Binding.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Binding.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -94,7 +95,86 @@ object NewBinding { def apply(): NewBinding = new NewBinding private val outNeighbors: Map[String, Set[String]] = Map("REF" -> Set("METHOD")) private val inNeighbors: Map[String, Set[String]] = Map("BINDS" -> Set("TYPE_DECL")) + + object InsertionHelpers { + object NewNodeInserter_Binding_methodFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewBinding => + dstCast(offset) = generated.methodFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Binding_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewBinding => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Binding_signature extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewBinding => + dstCast(offset) = generated.signature + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewBinding extends NewNode(5.toShort) with BindingBase { override type StoredNodeType = Binding override def label: String = "BINDING" @@ -112,10 +192,10 @@ class NewBinding extends NewNode(5.toShort) with BindingBase { def methodFullName(value: String): this.type = { this.methodFullName = value; this } def name(value: String): this.type = { this.name = value; this } def signature(value: String): this.type = { this.signature = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 36, Iterator(this.methodFullName)) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 49, Iterator(this.signature)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 36, 1) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 49, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Block.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Block.scala index 6ce3f9c0e..30ec09e6f 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Block.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Block.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1410,7 +1411,252 @@ object NewBlock { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_Block_argumentIndex extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewBlock => + dstCast(offset) = generated.argumentIndex + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Block_argumentName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewBlock => + generated.argumentName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Block_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewBlock => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Block_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewBlock => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Block_dynamicTypeHintFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewBlock => + for (item <- generated.dynamicTypeHintFullName) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Block_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewBlock => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Block_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewBlock => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Block_possibleTypes extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewBlock => + for (item <- generated.possibleTypes) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Block_typeFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewBlock => + dstCast(offset) = generated.typeFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewBlock extends NewNode(6.toShort) with BlockBase with ExpressionNew { override type StoredNodeType = Block override def label: String = "BLOCK" @@ -1445,16 +1691,16 @@ class NewBlock extends NewNode(6.toShort) with BlockBase with ExpressionNew { def order(value: Int): this.type = { this.order = value; this } def possibleTypes(value: IterableOnce[String]): this.type = { this.possibleTypes = value.iterator.to(ArraySeq); this } def typeFullName(value: String): this.type = { this.typeFullName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 1, Iterator(this.argumentIndex)) - if (argumentName.nonEmpty) interface.insertProperty(this, 2, this.argumentName) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (dynamicTypeHintFullName.nonEmpty) interface.insertProperty(this, 18, this.dynamicTypeHintFullName) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 43, Iterator(this.order)) - if (possibleTypes.nonEmpty) interface.insertProperty(this, 47, this.possibleTypes) - interface.insertProperty(this, 52, Iterator(this.typeFullName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 1, 1) + interface.countProperty(this, 2, argumentName.size) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 18, dynamicTypeHintFullName.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 47, possibleTypes.size) + interface.countProperty(this, 52, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Call.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Call.scala index fe3b29b5f..1cab3b256 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Call.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Call.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1474,7 +1475,352 @@ object NewCall { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_Call_argumentIndex extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewCall => + dstCast(offset) = generated.argumentIndex + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Call_argumentName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewCall => + generated.argumentName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Call_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewCall => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Call_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewCall => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Call_dispatchType extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewCall => + dstCast(offset) = generated.dispatchType + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Call_dynamicTypeHintFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewCall => + for (item <- generated.dynamicTypeHintFullName) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Call_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewCall => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Call_methodFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewCall => + dstCast(offset) = generated.methodFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Call_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewCall => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Call_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewCall => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Call_possibleTypes extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewCall => + for (item <- generated.possibleTypes) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Call_signature extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewCall => + dstCast(offset) = generated.signature + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Call_typeFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewCall => + dstCast(offset) = generated.typeFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewCall extends NewNode(7.toShort) with CallBase with CallReprNew with ExpressionNew { override type StoredNodeType = Call override def label: String = "CALL" @@ -1517,20 +1863,20 @@ class NewCall extends NewNode(7.toShort) with CallBase with CallReprNew with Exp def possibleTypes(value: IterableOnce[String]): this.type = { this.possibleTypes = value.iterator.to(ArraySeq); this } def signature(value: String): this.type = { this.signature = value; this } def typeFullName(value: String): this.type = { this.typeFullName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 1, Iterator(this.argumentIndex)) - if (argumentName.nonEmpty) interface.insertProperty(this, 2, this.argumentName) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - interface.insertProperty(this, 17, Iterator(this.dispatchType)) - if (dynamicTypeHintFullName.nonEmpty) interface.insertProperty(this, 18, this.dynamicTypeHintFullName) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 36, Iterator(this.methodFullName)) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 43, Iterator(this.order)) - if (possibleTypes.nonEmpty) interface.insertProperty(this, 47, this.possibleTypes) - interface.insertProperty(this, 49, Iterator(this.signature)) - interface.insertProperty(this, 52, Iterator(this.typeFullName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 1, 1) + interface.countProperty(this, 2, argumentName.size) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 17, 1) + interface.countProperty(this, 18, dynamicTypeHintFullName.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 36, 1) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 47, possibleTypes.size) + interface.countProperty(this, 49, 1) + interface.countProperty(this, 52, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ClosureBinding.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ClosureBinding.scala index f0a144d94..986edb653 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ClosureBinding.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ClosureBinding.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -100,7 +101,94 @@ object NewClosureBinding { private val outNeighbors: Map[String, Set[String]] = Map("REF" -> Set("LOCAL", "METHOD_PARAMETER_IN")) private val inNeighbors: Map[String, Set[String]] = Map("CAPTURE" -> Set("METHOD_REF", "TYPE_REF"), "CAPTURED_BY" -> Set("LOCAL", "METHOD_PARAMETER_IN")) + + object InsertionHelpers { + object NewNodeInserter_ClosureBinding_closureBindingId extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewClosureBinding => + generated.closureBindingId match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_ClosureBinding_closureOriginalName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewClosureBinding => + generated.closureOriginalName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_ClosureBinding_evaluationStrategy extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewClosureBinding => + dstCast(offset) = generated.evaluationStrategy + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewClosureBinding extends NewNode(8.toShort) with ClosureBindingBase { override type StoredNodeType = ClosureBinding override def label: String = "CLOSURE_BINDING" @@ -120,10 +208,10 @@ class NewClosureBinding extends NewNode(8.toShort) with ClosureBindingBase { def closureOriginalName(value: Option[String]): this.type = { this.closureOriginalName = value; this } def closureOriginalName(value: String): this.type = { this.closureOriginalName = Option(value); this } def evaluationStrategy(value: String): this.type = { this.evaluationStrategy = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - if (closureBindingId.nonEmpty) interface.insertProperty(this, 8, this.closureBindingId) - if (closureOriginalName.nonEmpty) interface.insertProperty(this, 9, this.closureOriginalName) - interface.insertProperty(this, 19, Iterator(this.evaluationStrategy)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 8, closureBindingId.size) + interface.countProperty(this, 9, closureOriginalName.size) + interface.countProperty(this, 19, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Comment.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Comment.scala index 4952ca790..0879410cb 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Comment.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Comment.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1348,7 +1349,144 @@ object NewComment { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_Comment_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewComment => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Comment_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewComment => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Comment_filename extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewComment => + dstCast(offset) = generated.filename + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Comment_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewComment => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Comment_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewComment => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewComment extends NewNode(9.toShort) with CommentBase with AstNodeNew { override type StoredNodeType = Comment override def label: String = "COMMENT" @@ -1372,12 +1510,12 @@ class NewComment extends NewNode(9.toShort) with CommentBase with AstNodeNew { def lineNumber(value: Int): this.type = { this.lineNumber = Option(value); this } def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - interface.insertProperty(this, 21, Iterator(this.filename)) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 21, 1) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ConfigFile.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ConfigFile.scala index dbc160c6b..a7780ef71 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ConfigFile.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ConfigFile.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -76,7 +77,61 @@ object NewConfigFile { def apply(): NewConfigFile = new NewConfigFile private val outNeighbors: Map[String, Set[String]] = Map() private val inNeighbors: Map[String, Set[String]] = Map() + + object InsertionHelpers { + object NewNodeInserter_ConfigFile_content extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewConfigFile => + dstCast(offset) = generated.content + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_ConfigFile_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewConfigFile => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewConfigFile extends NewNode(10.toShort) with ConfigFileBase { override type StoredNodeType = ConfigFile override def label: String = "CONFIG_FILE" @@ -92,9 +147,9 @@ class NewConfigFile extends NewNode(10.toShort) with ConfigFileBase { var name: String = "": String def content(value: String): this.type = { this.content = value; this } def name(value: String): this.type = { this.name = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 14, Iterator(this.content)) - interface.insertProperty(this, 39, Iterator(this.name)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 14, 1) + interface.countProperty(this, 39, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ControlStructure.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ControlStructure.scala index 1d2cc527d..7676cc223 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ControlStructure.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/ControlStructure.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1392,7 +1393,223 @@ object NewControlStructure { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_ControlStructure_argumentIndex extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewControlStructure => + dstCast(offset) = generated.argumentIndex + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_ControlStructure_argumentName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewControlStructure => + generated.argumentName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_ControlStructure_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewControlStructure => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_ControlStructure_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewControlStructure => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_ControlStructure_controlStructureType extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewControlStructure => + dstCast(offset) = generated.controlStructureType + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_ControlStructure_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewControlStructure => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_ControlStructure_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewControlStructure => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_ControlStructure_parserTypeName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewControlStructure => + dstCast(offset) = generated.parserTypeName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewControlStructure extends NewNode(11.toShort) with ControlStructureBase with ExpressionNew { override type StoredNodeType = ControlStructure override def label: String = "CONTROL_STRUCTURE" @@ -1423,15 +1640,15 @@ class NewControlStructure extends NewNode(11.toShort) with ControlStructureBase def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def order(value: Int): this.type = { this.order = value; this } def parserTypeName(value: String): this.type = { this.parserTypeName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 1, Iterator(this.argumentIndex)) - if (argumentName.nonEmpty) interface.insertProperty(this, 2, this.argumentName) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - interface.insertProperty(this, 15, Iterator(this.controlStructureType)) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 43, Iterator(this.order)) - interface.insertProperty(this, 46, Iterator(this.parserTypeName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 1, 1) + interface.countProperty(this, 2, argumentName.size) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 15, 1) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 46, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Dependency.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Dependency.scala index f11c01198..b78d7b2b9 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Dependency.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Dependency.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -85,7 +86,90 @@ object NewDependency { def apply(): NewDependency = new NewDependency private val outNeighbors: Map[String, Set[String]] = Map() private val inNeighbors: Map[String, Set[String]] = Map("IMPORTS" -> Set("IMPORT")) + + object InsertionHelpers { + object NewNodeInserter_Dependency_dependencyGroupId extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewDependency => + generated.dependencyGroupId match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Dependency_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewDependency => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Dependency_version extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewDependency => + dstCast(offset) = generated.version + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewDependency extends NewNode(12.toShort) with DependencyBase { override type StoredNodeType = Dependency override def label: String = "DEPENDENCY" @@ -104,10 +188,10 @@ class NewDependency extends NewNode(12.toShort) with DependencyBase { def dependencyGroupId(value: String): this.type = { this.dependencyGroupId = Option(value); this } def name(value: String): this.type = { this.name = value; this } def version(value: String): this.type = { this.version = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - if (dependencyGroupId.nonEmpty) interface.insertProperty(this, 16, this.dependencyGroupId) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 54, Iterator(this.version)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 16, dependencyGroupId.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 54, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/FieldIdentifier.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/FieldIdentifier.scala index 3a88f5a82..1dcff8ebd 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/FieldIdentifier.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/FieldIdentifier.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1385,7 +1386,198 @@ object NewFieldIdentifier { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_FieldIdentifier_argumentIndex extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFieldIdentifier => + dstCast(offset) = generated.argumentIndex + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_FieldIdentifier_argumentName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFieldIdentifier => + generated.argumentName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_FieldIdentifier_canonicalName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFieldIdentifier => + dstCast(offset) = generated.canonicalName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_FieldIdentifier_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFieldIdentifier => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_FieldIdentifier_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFieldIdentifier => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_FieldIdentifier_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFieldIdentifier => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_FieldIdentifier_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFieldIdentifier => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewFieldIdentifier extends NewNode(13.toShort) with FieldIdentifierBase with ExpressionNew { override type StoredNodeType = FieldIdentifier override def label: String = "FIELD_IDENTIFIER" @@ -1414,14 +1606,14 @@ class NewFieldIdentifier extends NewNode(13.toShort) with FieldIdentifierBase wi def lineNumber(value: Int): this.type = { this.lineNumber = Option(value); this } def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 1, Iterator(this.argumentIndex)) - if (argumentName.nonEmpty) interface.insertProperty(this, 2, this.argumentName) - interface.insertProperty(this, 5, Iterator(this.canonicalName)) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 1, 1) + interface.countProperty(this, 2, argumentName.size) + interface.countProperty(this, 5, 1) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/File.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/File.scala index fa6022fd3..f6bc42921 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/File.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/File.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1371,7 +1372,198 @@ object NewFile { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_File_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFile => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_File_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFile => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_File_content extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFile => + dstCast(offset) = generated.content + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_File_hash extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFile => + generated.hash match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_File_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFile => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_File_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFile => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_File_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFile => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewFile extends NewNode(14.toShort) with FileBase with AstNodeNew { override type StoredNodeType = File override def label: String = "FILE" @@ -1400,14 +1592,14 @@ class NewFile extends NewNode(14.toShort) with FileBase with AstNodeNew { def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def name(value: String): this.type = { this.name = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - interface.insertProperty(this, 14, Iterator(this.content)) - if (hash.nonEmpty) interface.insertProperty(this, 23, this.hash) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 14, 1) + interface.countProperty(this, 23, hash.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Finding.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Finding.scala index 4cde40bfb..35d780f01 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Finding.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Finding.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -62,7 +63,71 @@ object NewFinding { def apply(): NewFinding = new NewFinding private val outNeighbors: Map[String, Set[String]] = Map() private val inNeighbors: Map[String, Set[String]] = Map() + + object InsertionHelpers { + object NewNodeInserter_Finding_evidence extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[flatgraph.GNode]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFinding => + for (item <- generated.evidence) { + dstCast(offset) = item match { + case newV: flatgraph.DNode => newV.storedRef.get; case oldV: flatgraph.GNode => oldV; + case null => null + } + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Finding_keyValuePairs extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[flatgraph.GNode]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewFinding => + for (item <- generated.keyValuePairs) { + dstCast(offset) = item match { + case newV: flatgraph.DNode => newV.storedRef.get; case oldV: flatgraph.GNode => oldV; + case null => null + } + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewFinding extends NewNode(15.toShort) with FindingBase { override type StoredNodeType = Finding override def label: String = "FINDING" @@ -80,9 +145,11 @@ class NewFinding extends NewNode(15.toShort) with FindingBase { def keyValuePairs(value: IterableOnce[KeyValuePairBase]): this.type = { this.keyValuePairs = value.iterator.to(ArraySeq); this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - if (evidence.nonEmpty) interface.insertProperty(this, 55, this.evidence) - if (keyValuePairs.nonEmpty) interface.insertProperty(this, 56, this.keyValuePairs) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 55, evidence.size) + evidence.foreach(interface.visitContainedNode) + interface.countProperty(this, 56, keyValuePairs.size) + keyValuePairs.foreach(interface.visitContainedNode) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Identifier.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Identifier.scala index baba10937..1f6fd6531 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Identifier.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Identifier.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1421,7 +1422,277 @@ object NewIdentifier { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_Identifier_argumentIndex extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewIdentifier => + dstCast(offset) = generated.argumentIndex + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Identifier_argumentName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewIdentifier => + generated.argumentName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Identifier_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewIdentifier => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Identifier_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewIdentifier => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Identifier_dynamicTypeHintFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewIdentifier => + for (item <- generated.dynamicTypeHintFullName) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Identifier_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewIdentifier => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Identifier_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewIdentifier => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Identifier_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewIdentifier => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Identifier_possibleTypes extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewIdentifier => + for (item <- generated.possibleTypes) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Identifier_typeFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewIdentifier => + dstCast(offset) = generated.typeFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewIdentifier extends NewNode(16.toShort) with IdentifierBase with ExpressionNew { override type StoredNodeType = Identifier override def label: String = "IDENTIFIER" @@ -1458,17 +1729,17 @@ class NewIdentifier extends NewNode(16.toShort) with IdentifierBase with Express def order(value: Int): this.type = { this.order = value; this } def possibleTypes(value: IterableOnce[String]): this.type = { this.possibleTypes = value.iterator.to(ArraySeq); this } def typeFullName(value: String): this.type = { this.typeFullName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 1, Iterator(this.argumentIndex)) - if (argumentName.nonEmpty) interface.insertProperty(this, 2, this.argumentName) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (dynamicTypeHintFullName.nonEmpty) interface.insertProperty(this, 18, this.dynamicTypeHintFullName) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 43, Iterator(this.order)) - if (possibleTypes.nonEmpty) interface.insertProperty(this, 47, this.possibleTypes) - interface.insertProperty(this, 52, Iterator(this.typeFullName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 1, 1) + interface.countProperty(this, 2, argumentName.size) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 18, dynamicTypeHintFullName.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 47, possibleTypes.size) + interface.countProperty(this, 52, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Import.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Import.scala index 81ed5e07b..ef77ff055 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Import.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Import.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1406,7 +1407,264 @@ object NewImport { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_Import_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewImport => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Import_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewImport => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Import_explicitAs extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Boolean]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewImport => + generated.explicitAs match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Import_importedAs extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewImport => + generated.importedAs match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Import_importedEntity extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewImport => + generated.importedEntity match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Import_isExplicit extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Boolean]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewImport => + generated.isExplicit match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Import_isWildcard extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Boolean]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewImport => + generated.isWildcard match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Import_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewImport => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Import_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewImport => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewImport extends NewNode(17.toShort) with ImportBase with AstNodeNew { override type StoredNodeType = Import override def label: String = "IMPORT" @@ -1443,16 +1701,16 @@ class NewImport extends NewNode(17.toShort) with ImportBase with AstNodeNew { def lineNumber(value: Int): this.type = { this.lineNumber = Option(value); this } def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (explicitAs.nonEmpty) interface.insertProperty(this, 20, this.explicitAs) - if (importedAs.nonEmpty) interface.insertProperty(this, 24, this.importedAs) - if (importedEntity.nonEmpty) interface.insertProperty(this, 25, this.importedEntity) - if (isExplicit.nonEmpty) interface.insertProperty(this, 28, this.isExplicit) - if (isWildcard.nonEmpty) interface.insertProperty(this, 31, this.isWildcard) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 20, explicitAs.size) + interface.countProperty(this, 24, importedAs.size) + interface.countProperty(this, 25, importedEntity.size) + interface.countProperty(this, 28, isExplicit.size) + interface.countProperty(this, 31, isWildcard.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpLabel.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpLabel.scala index f1b86d0fb..b845634a5 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpLabel.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpLabel.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1350,7 +1351,169 @@ object NewJumpLabel { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_JumpLabel_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewJumpLabel => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_JumpLabel_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewJumpLabel => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_JumpLabel_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewJumpLabel => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_JumpLabel_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewJumpLabel => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_JumpLabel_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewJumpLabel => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_JumpLabel_parserTypeName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewJumpLabel => + dstCast(offset) = generated.parserTypeName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewJumpLabel extends NewNode(18.toShort) with JumpLabelBase with AstNodeNew { override type StoredNodeType = JumpLabel override def label: String = "JUMP_LABEL" @@ -1376,13 +1539,13 @@ class NewJumpLabel extends NewNode(18.toShort) with JumpLabelBase with AstNodeNe def name(value: String): this.type = { this.name = value; this } def order(value: Int): this.type = { this.order = value; this } def parserTypeName(value: String): this.type = { this.parserTypeName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 43, Iterator(this.order)) - interface.insertProperty(this, 46, Iterator(this.parserTypeName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 46, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpTarget.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpTarget.scala index 76e5d6c5f..5bd067a4e 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpTarget.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/JumpTarget.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1372,7 +1373,194 @@ object NewJumpTarget { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_JumpTarget_argumentIndex extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewJumpTarget => + dstCast(offset) = generated.argumentIndex + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_JumpTarget_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewJumpTarget => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_JumpTarget_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewJumpTarget => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_JumpTarget_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewJumpTarget => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_JumpTarget_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewJumpTarget => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_JumpTarget_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewJumpTarget => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_JumpTarget_parserTypeName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewJumpTarget => + dstCast(offset) = generated.parserTypeName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewJumpTarget extends NewNode(19.toShort) with JumpTargetBase with AstNodeNew with CfgNodeNew { override type StoredNodeType = JumpTarget override def label: String = "JUMP_TARGET" @@ -1400,14 +1588,14 @@ class NewJumpTarget extends NewNode(19.toShort) with JumpTargetBase with AstNode def name(value: String): this.type = { this.name = value; this } def order(value: Int): this.type = { this.order = value; this } def parserTypeName(value: String): this.type = { this.parserTypeName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 1, Iterator(this.argumentIndex)) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 43, Iterator(this.order)) - interface.insertProperty(this, 46, Iterator(this.parserTypeName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 1, 1) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 46, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/KeyValuePair.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/KeyValuePair.scala index f33e118fe..683422b25 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/KeyValuePair.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/KeyValuePair.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -72,7 +73,61 @@ object NewKeyValuePair { def apply(): NewKeyValuePair = new NewKeyValuePair private val outNeighbors: Map[String, Set[String]] = Map() private val inNeighbors: Map[String, Set[String]] = Map() + + object InsertionHelpers { + object NewNodeInserter_KeyValuePair_key extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewKeyValuePair => + dstCast(offset) = generated.key + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_KeyValuePair_value extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewKeyValuePair => + dstCast(offset) = generated.value + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewKeyValuePair extends NewNode(20.toShort) with KeyValuePairBase { override type StoredNodeType = KeyValuePair override def label: String = "KEY_VALUE_PAIR" @@ -88,9 +143,9 @@ class NewKeyValuePair extends NewNode(20.toShort) with KeyValuePairBase { var value: String = "": String def key(value: String): this.type = { this.key = value; this } def value(value: String): this.type = { this.value = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 32, Iterator(this.key)) - interface.insertProperty(this, 53, Iterator(this.value)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 32, 1) + interface.countProperty(this, 53, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Literal.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Literal.scala index cebb09dfe..f4e27d5ec 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Literal.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Literal.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1410,7 +1411,252 @@ object NewLiteral { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_Literal_argumentIndex extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLiteral => + dstCast(offset) = generated.argumentIndex + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Literal_argumentName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLiteral => + generated.argumentName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Literal_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLiteral => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Literal_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLiteral => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Literal_dynamicTypeHintFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLiteral => + for (item <- generated.dynamicTypeHintFullName) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Literal_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLiteral => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Literal_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLiteral => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Literal_possibleTypes extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLiteral => + for (item <- generated.possibleTypes) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Literal_typeFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLiteral => + dstCast(offset) = generated.typeFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewLiteral extends NewNode(21.toShort) with LiteralBase with ExpressionNew { override type StoredNodeType = Literal override def label: String = "LITERAL" @@ -1445,16 +1691,16 @@ class NewLiteral extends NewNode(21.toShort) with LiteralBase with ExpressionNew def order(value: Int): this.type = { this.order = value; this } def possibleTypes(value: IterableOnce[String]): this.type = { this.possibleTypes = value.iterator.to(ArraySeq); this } def typeFullName(value: String): this.type = { this.typeFullName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 1, Iterator(this.argumentIndex)) - if (argumentName.nonEmpty) interface.insertProperty(this, 2, this.argumentName) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (dynamicTypeHintFullName.nonEmpty) interface.insertProperty(this, 18, this.dynamicTypeHintFullName) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 43, Iterator(this.order)) - if (possibleTypes.nonEmpty) interface.insertProperty(this, 47, this.possibleTypes) - interface.insertProperty(this, 52, Iterator(this.typeFullName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 1, 1) + interface.countProperty(this, 2, argumentName.size) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 18, dynamicTypeHintFullName.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 47, possibleTypes.size) + interface.countProperty(this, 52, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Local.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Local.scala index b3ca33e37..27d91cf07 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Local.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Local.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1401,7 +1402,252 @@ object NewLocal { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_Local_closureBindingId extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocal => + generated.closureBindingId match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Local_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocal => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Local_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocal => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Local_dynamicTypeHintFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocal => + for (item <- generated.dynamicTypeHintFullName) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Local_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocal => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Local_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocal => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Local_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocal => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Local_possibleTypes extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocal => + for (item <- generated.possibleTypes) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Local_typeFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocal => + dstCast(offset) = generated.typeFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewLocal extends NewNode(22.toShort) with LocalBase with AstNodeNew with DeclarationNew { override type StoredNodeType = Local override def label: String = "LOCAL" @@ -1436,16 +1682,16 @@ class NewLocal extends NewNode(22.toShort) with LocalBase with AstNodeNew with D def order(value: Int): this.type = { this.order = value; this } def possibleTypes(value: IterableOnce[String]): this.type = { this.possibleTypes = value.iterator.to(ArraySeq); this } def typeFullName(value: String): this.type = { this.typeFullName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - if (closureBindingId.nonEmpty) interface.insertProperty(this, 8, this.closureBindingId) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (dynamicTypeHintFullName.nonEmpty) interface.insertProperty(this, 18, this.dynamicTypeHintFullName) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 43, Iterator(this.order)) - if (possibleTypes.nonEmpty) interface.insertProperty(this, 47, this.possibleTypes) - interface.insertProperty(this, 52, Iterator(this.typeFullName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 8, closureBindingId.size) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 18, dynamicTypeHintFullName.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 47, possibleTypes.size) + interface.countProperty(this, 52, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Location.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Location.scala index e5388a960..53d9b6944 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Location.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Location.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -153,7 +154,272 @@ object NewLocation { def apply(): NewLocation = new NewLocation private val outNeighbors: Map[String, Set[String]] = Map() private val inNeighbors: Map[String, Set[String]] = Map() + + object InsertionHelpers { + object NewNodeInserter_Location_className extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocation => + dstCast(offset) = generated.className + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Location_classShortName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocation => + dstCast(offset) = generated.classShortName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Location_filename extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocation => + dstCast(offset) = generated.filename + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Location_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocation => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Location_methodFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocation => + dstCast(offset) = generated.methodFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Location_methodShortName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocation => + dstCast(offset) = generated.methodShortName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Location_nodeLabel extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocation => + dstCast(offset) = generated.nodeLabel + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Location_packageName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocation => + dstCast(offset) = generated.packageName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Location_symbol extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocation => + dstCast(offset) = generated.symbol + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Location_node extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[flatgraph.GNode]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewLocation => + generated.node match { + case Some(item) => + dstCast(offset) = item match { + case newV: flatgraph.DNode => newV.storedRef.get; case oldV: flatgraph.GNode => oldV; + case null => null + } + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewLocation extends NewNode(23.toShort) with LocationBase { override type StoredNodeType = Location override def label: String = "LOCATION" @@ -187,17 +453,18 @@ class NewLocation extends NewNode(23.toShort) with LocationBase { def nodeLabel(value: String): this.type = { this.nodeLabel = value; this } def packageName(value: String): this.type = { this.packageName = value; this } def symbol(value: String): this.type = { this.symbol = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 6, Iterator(this.className)) - interface.insertProperty(this, 7, Iterator(this.classShortName)) - interface.insertProperty(this, 21, Iterator(this.filename)) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 36, Iterator(this.methodFullName)) - interface.insertProperty(this, 37, Iterator(this.methodShortName)) - interface.insertProperty(this, 40, Iterator(this.nodeLabel)) - interface.insertProperty(this, 45, Iterator(this.packageName)) - interface.insertProperty(this, 50, Iterator(this.symbol)) - if (node.nonEmpty) interface.insertProperty(this, 57, this.node) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 6, 1) + interface.countProperty(this, 7, 1) + interface.countProperty(this, 21, 1) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 36, 1) + interface.countProperty(this, 37, 1) + interface.countProperty(this, 40, 1) + interface.countProperty(this, 45, 1) + interface.countProperty(this, 50, 1) + interface.countProperty(this, 57, node.size) + node.foreach(interface.visitContainedNode) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Member.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Member.scala index 904956db7..d4a52c8bc 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Member.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Member.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1414,7 +1415,273 @@ object NewMember { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_Member_astParentFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMember => + dstCast(offset) = generated.astParentFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Member_astParentType extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMember => + dstCast(offset) = generated.astParentType + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Member_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMember => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Member_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMember => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Member_dynamicTypeHintFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMember => + for (item <- generated.dynamicTypeHintFullName) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Member_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMember => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Member_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMember => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Member_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMember => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Member_possibleTypes extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMember => + for (item <- generated.possibleTypes) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Member_typeFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMember => + dstCast(offset) = generated.typeFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewMember extends NewNode(24.toShort) with MemberBase with AstNodeNew with DeclarationNew { override type StoredNodeType = Member override def label: String = "MEMBER" @@ -1450,17 +1717,17 @@ class NewMember extends NewNode(24.toShort) with MemberBase with AstNodeNew with def order(value: Int): this.type = { this.order = value; this } def possibleTypes(value: IterableOnce[String]): this.type = { this.possibleTypes = value.iterator.to(ArraySeq); this } def typeFullName(value: String): this.type = { this.typeFullName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 3, Iterator(this.astParentFullName)) - interface.insertProperty(this, 4, Iterator(this.astParentType)) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (dynamicTypeHintFullName.nonEmpty) interface.insertProperty(this, 18, this.dynamicTypeHintFullName) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 43, Iterator(this.order)) - if (possibleTypes.nonEmpty) interface.insertProperty(this, 47, this.possibleTypes) - interface.insertProperty(this, 52, Iterator(this.typeFullName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 3, 1) + interface.countProperty(this, 4, 1) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 18, dynamicTypeHintFullName.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 47, possibleTypes.size) + interface.countProperty(this, 52, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MetaData.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MetaData.scala index 046de8215..c2935a6e2 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MetaData.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MetaData.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -130,7 +131,142 @@ object NewMetaData { def apply(): NewMetaData = new NewMetaData private val outNeighbors: Map[String, Set[String]] = Map() private val inNeighbors: Map[String, Set[String]] = Map() + + object InsertionHelpers { + object NewNodeInserter_MetaData_hash extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMetaData => + generated.hash match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MetaData_language extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMetaData => + dstCast(offset) = generated.language + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MetaData_overlays extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMetaData => + for (item <- generated.overlays) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MetaData_root extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMetaData => + dstCast(offset) = generated.root + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MetaData_version extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMetaData => + dstCast(offset) = generated.version + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewMetaData extends NewNode(25.toShort) with MetaDataBase { override type StoredNodeType = MetaData override def label: String = "META_DATA" @@ -153,12 +289,12 @@ class NewMetaData extends NewNode(25.toShort) with MetaDataBase { def overlays(value: IterableOnce[String]): this.type = { this.overlays = value.iterator.to(ArraySeq); this } def root(value: String): this.type = { this.root = value; this } def version(value: String): this.type = { this.version = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - if (hash.nonEmpty) interface.insertProperty(this, 23, this.hash) - interface.insertProperty(this, 33, Iterator(this.language)) - if (overlays.nonEmpty) interface.insertProperty(this, 44, this.overlays) - interface.insertProperty(this, 48, Iterator(this.root)) - interface.insertProperty(this, 54, Iterator(this.version)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 23, hash.size) + interface.countProperty(this, 33, 1) + interface.countProperty(this, 44, overlays.size) + interface.countProperty(this, 48, 1) + interface.countProperty(this, 54, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Method.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Method.scala index b0bc9b8d4..a67296f42 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Method.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Method.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1517,7 +1518,439 @@ object NewMethod { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_Method_astParentFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + dstCast(offset) = generated.astParentFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Method_astParentType extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + dstCast(offset) = generated.astParentType + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Method_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Method_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Method_columnNumberEnd extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + generated.columnNumberEnd match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Method_filename extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + dstCast(offset) = generated.filename + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Method_fullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + dstCast(offset) = generated.fullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Method_hash extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + generated.hash match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Method_isExternal extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Boolean]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + dstCast(offset) = generated.isExternal + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Method_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Method_lineNumberEnd extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + generated.lineNumberEnd match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Method_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Method_offset extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + generated.offset match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Method_offsetEnd extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + generated.offsetEnd match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Method_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Method_signature extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethod => + dstCast(offset) = generated.signature + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewMethod extends NewNode(26.toShort) with MethodBase with AstNodeNew with CfgNodeNew with DeclarationNew { override type StoredNodeType = Method override def label: String = "METHOD" @@ -1568,23 +2001,23 @@ class NewMethod extends NewNode(26.toShort) with MethodBase with AstNodeNew with def offsetEnd(value: Option[Int]): this.type = { this.offsetEnd = value; this } def order(value: Int): this.type = { this.order = value; this } def signature(value: String): this.type = { this.signature = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 3, Iterator(this.astParentFullName)) - interface.insertProperty(this, 4, Iterator(this.astParentType)) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (columnNumberEnd.nonEmpty) interface.insertProperty(this, 12, this.columnNumberEnd) - interface.insertProperty(this, 21, Iterator(this.filename)) - interface.insertProperty(this, 22, Iterator(this.fullName)) - if (hash.nonEmpty) interface.insertProperty(this, 23, this.hash) - interface.insertProperty(this, 29, Iterator(this.isExternal)) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - if (lineNumberEnd.nonEmpty) interface.insertProperty(this, 35, this.lineNumberEnd) - interface.insertProperty(this, 39, Iterator(this.name)) - if (offset.nonEmpty) interface.insertProperty(this, 41, this.offset) - if (offsetEnd.nonEmpty) interface.insertProperty(this, 42, this.offsetEnd) - interface.insertProperty(this, 43, Iterator(this.order)) - interface.insertProperty(this, 49, Iterator(this.signature)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 3, 1) + interface.countProperty(this, 4, 1) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 12, columnNumberEnd.size) + interface.countProperty(this, 21, 1) + interface.countProperty(this, 22, 1) + interface.countProperty(this, 23, hash.size) + interface.countProperty(this, 29, 1) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 35, lineNumberEnd.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 41, offset.size) + interface.countProperty(this, 42, offsetEnd.size) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 49, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterIn.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterIn.scala index 9d012b510..8f489d2f8 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterIn.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterIn.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1457,7 +1458,327 @@ object NewMethodParameterIn { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_MethodParameterIn_closureBindingId extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterIn => + generated.closureBindingId match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterIn_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterIn => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterIn_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterIn => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterIn_dynamicTypeHintFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterIn => + for (item <- generated.dynamicTypeHintFullName) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterIn_evaluationStrategy extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterIn => + dstCast(offset) = generated.evaluationStrategy + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterIn_index extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterIn => + dstCast(offset) = generated.index + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterIn_isVariadic extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Boolean]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterIn => + dstCast(offset) = generated.isVariadic + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterIn_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterIn => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterIn_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterIn => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterIn_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterIn => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterIn_possibleTypes extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterIn => + for (item <- generated.possibleTypes) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterIn_typeFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterIn => + dstCast(offset) = generated.typeFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewMethodParameterIn extends NewNode(27.toShort) with MethodParameterInBase @@ -1503,19 +1824,19 @@ class NewMethodParameterIn def order(value: Int): this.type = { this.order = value; this } def possibleTypes(value: IterableOnce[String]): this.type = { this.possibleTypes = value.iterator.to(ArraySeq); this } def typeFullName(value: String): this.type = { this.typeFullName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - if (closureBindingId.nonEmpty) interface.insertProperty(this, 8, this.closureBindingId) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (dynamicTypeHintFullName.nonEmpty) interface.insertProperty(this, 18, this.dynamicTypeHintFullName) - interface.insertProperty(this, 19, Iterator(this.evaluationStrategy)) - interface.insertProperty(this, 26, Iterator(this.index)) - interface.insertProperty(this, 30, Iterator(this.isVariadic)) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 43, Iterator(this.order)) - if (possibleTypes.nonEmpty) interface.insertProperty(this, 47, this.possibleTypes) - interface.insertProperty(this, 52, Iterator(this.typeFullName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 8, closureBindingId.size) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 18, dynamicTypeHintFullName.size) + interface.countProperty(this, 19, 1) + interface.countProperty(this, 26, 1) + interface.countProperty(this, 30, 1) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 47, possibleTypes.size) + interface.countProperty(this, 52, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterOut.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterOut.scala index ee908891b..edcf0a25b 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterOut.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterOut.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1417,7 +1418,244 @@ object NewMethodParameterOut { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_MethodParameterOut_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterOut => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterOut_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterOut => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterOut_evaluationStrategy extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterOut => + dstCast(offset) = generated.evaluationStrategy + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterOut_index extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterOut => + dstCast(offset) = generated.index + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterOut_isVariadic extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Boolean]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterOut => + dstCast(offset) = generated.isVariadic + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterOut_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterOut => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterOut_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterOut => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterOut_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterOut => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodParameterOut_typeFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodParameterOut => + dstCast(offset) = generated.typeFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewMethodParameterOut extends NewNode(28.toShort) with MethodParameterOutBase @@ -1454,16 +1692,16 @@ class NewMethodParameterOut def name(value: String): this.type = { this.name = value; this } def order(value: Int): this.type = { this.order = value; this } def typeFullName(value: String): this.type = { this.typeFullName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - interface.insertProperty(this, 19, Iterator(this.evaluationStrategy)) - interface.insertProperty(this, 26, Iterator(this.index)) - interface.insertProperty(this, 30, Iterator(this.isVariadic)) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 43, Iterator(this.order)) - interface.insertProperty(this, 52, Iterator(this.typeFullName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 19, 1) + interface.countProperty(this, 26, 1) + interface.countProperty(this, 30, 1) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 52, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodRef.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodRef.scala index 02b6e896c..45aa16699 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodRef.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodRef.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1425,7 +1426,277 @@ object NewMethodRef { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_MethodRef_argumentIndex extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodRef => + dstCast(offset) = generated.argumentIndex + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodRef_argumentName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodRef => + generated.argumentName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodRef_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodRef => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodRef_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodRef => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodRef_dynamicTypeHintFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodRef => + for (item <- generated.dynamicTypeHintFullName) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodRef_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodRef => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodRef_methodFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodRef => + dstCast(offset) = generated.methodFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodRef_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodRef => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodRef_possibleTypes extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodRef => + for (item <- generated.possibleTypes) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodRef_typeFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodRef => + dstCast(offset) = generated.typeFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewMethodRef extends NewNode(29.toShort) with MethodRefBase with ExpressionNew { override type StoredNodeType = MethodRef override def label: String = "METHOD_REF" @@ -1462,17 +1733,17 @@ class NewMethodRef extends NewNode(29.toShort) with MethodRefBase with Expressio def order(value: Int): this.type = { this.order = value; this } def possibleTypes(value: IterableOnce[String]): this.type = { this.possibleTypes = value.iterator.to(ArraySeq); this } def typeFullName(value: String): this.type = { this.typeFullName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 1, Iterator(this.argumentIndex)) - if (argumentName.nonEmpty) interface.insertProperty(this, 2, this.argumentName) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (dynamicTypeHintFullName.nonEmpty) interface.insertProperty(this, 18, this.dynamicTypeHintFullName) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 36, Iterator(this.methodFullName)) - interface.insertProperty(this, 43, Iterator(this.order)) - if (possibleTypes.nonEmpty) interface.insertProperty(this, 47, this.possibleTypes) - interface.insertProperty(this, 52, Iterator(this.typeFullName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 1, 1) + interface.countProperty(this, 2, argumentName.size) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 18, dynamicTypeHintFullName.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 36, 1) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 47, possibleTypes.size) + interface.countProperty(this, 52, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodReturn.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodReturn.scala index 25cd40e7f..cf9de98e4 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodReturn.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodReturn.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1397,7 +1398,223 @@ object NewMethodReturn { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_MethodReturn_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodReturn => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodReturn_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodReturn => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodReturn_dynamicTypeHintFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodReturn => + for (item <- generated.dynamicTypeHintFullName) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodReturn_evaluationStrategy extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodReturn => + dstCast(offset) = generated.evaluationStrategy + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodReturn_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodReturn => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodReturn_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodReturn => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodReturn_possibleTypes extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodReturn => + for (item <- generated.possibleTypes) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_MethodReturn_typeFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewMethodReturn => + dstCast(offset) = generated.typeFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewMethodReturn extends NewNode(30.toShort) with MethodReturnBase with CfgNodeNew { override type StoredNodeType = MethodReturn override def label: String = "METHOD_RETURN" @@ -1429,15 +1646,15 @@ class NewMethodReturn extends NewNode(30.toShort) with MethodReturnBase with Cfg def order(value: Int): this.type = { this.order = value; this } def possibleTypes(value: IterableOnce[String]): this.type = { this.possibleTypes = value.iterator.to(ArraySeq); this } def typeFullName(value: String): this.type = { this.typeFullName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (dynamicTypeHintFullName.nonEmpty) interface.insertProperty(this, 18, this.dynamicTypeHintFullName) - interface.insertProperty(this, 19, Iterator(this.evaluationStrategy)) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 43, Iterator(this.order)) - if (possibleTypes.nonEmpty) interface.insertProperty(this, 47, this.possibleTypes) - interface.insertProperty(this, 52, Iterator(this.typeFullName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 18, dynamicTypeHintFullName.size) + interface.countProperty(this, 19, 1) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 47, possibleTypes.size) + interface.countProperty(this, 52, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Modifier.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Modifier.scala index 1c918a4af..afae56de2 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Modifier.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Modifier.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1344,7 +1345,144 @@ object NewModifier { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_Modifier_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewModifier => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Modifier_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewModifier => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Modifier_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewModifier => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Modifier_modifierType extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewModifier => + dstCast(offset) = generated.modifierType + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Modifier_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewModifier => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewModifier extends NewNode(31.toShort) with ModifierBase with AstNodeNew { override type StoredNodeType = Modifier override def label: String = "MODIFIER" @@ -1368,12 +1506,12 @@ class NewModifier extends NewNode(31.toShort) with ModifierBase with AstNodeNew def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def modifierType(value: String): this.type = { this.modifierType = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 38, Iterator(this.modifierType)) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 38, 1) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Namespace.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Namespace.scala index 39da6e263..72d6abe56 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Namespace.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Namespace.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1340,7 +1341,144 @@ object NewNamespace { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_Namespace_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewNamespace => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Namespace_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewNamespace => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Namespace_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewNamespace => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Namespace_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewNamespace => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Namespace_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewNamespace => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewNamespace extends NewNode(32.toShort) with NamespaceBase with AstNodeNew { override type StoredNodeType = Namespace override def label: String = "NAMESPACE" @@ -1364,12 +1502,12 @@ class NewNamespace extends NewNode(32.toShort) with NamespaceBase with AstNodeNe def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def name(value: String): this.type = { this.name = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NamespaceBlock.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NamespaceBlock.scala index a25e4a0b5..9c92b21dd 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NamespaceBlock.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NamespaceBlock.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1372,7 +1373,194 @@ object NewNamespaceBlock { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_NamespaceBlock_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewNamespaceBlock => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_NamespaceBlock_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewNamespaceBlock => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_NamespaceBlock_filename extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewNamespaceBlock => + dstCast(offset) = generated.filename + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_NamespaceBlock_fullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewNamespaceBlock => + dstCast(offset) = generated.fullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_NamespaceBlock_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewNamespaceBlock => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_NamespaceBlock_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewNamespaceBlock => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_NamespaceBlock_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewNamespaceBlock => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewNamespaceBlock extends NewNode(33.toShort) with NamespaceBlockBase with AstNodeNew { override type StoredNodeType = NamespaceBlock override def label: String = "NAMESPACE_BLOCK" @@ -1400,14 +1588,14 @@ class NewNamespaceBlock extends NewNode(33.toShort) with NamespaceBlockBase with def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def name(value: String): this.type = { this.name = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - interface.insertProperty(this, 21, Iterator(this.filename)) - interface.insertProperty(this, 22, Iterator(this.fullName)) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 21, 1) + interface.countProperty(this, 22, 1) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Return.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Return.scala index 7dc87e159..55b564af7 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Return.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Return.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1365,7 +1366,173 @@ object NewReturn { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_Return_argumentIndex extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewReturn => + dstCast(offset) = generated.argumentIndex + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Return_argumentName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewReturn => + generated.argumentName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Return_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewReturn => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Return_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewReturn => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Return_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewReturn => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Return_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewReturn => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewReturn extends NewNode(34.toShort) with ReturnBase with ExpressionNew { override type StoredNodeType = Return override def label: String = "RETURN" @@ -1392,13 +1559,13 @@ class NewReturn extends NewNode(34.toShort) with ReturnBase with ExpressionNew { def lineNumber(value: Int): this.type = { this.lineNumber = Option(value); this } def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 1, Iterator(this.argumentIndex)) - if (argumentName.nonEmpty) interface.insertProperty(this, 2, this.argumentName) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 1, 1) + interface.countProperty(this, 2, argumentName.size) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Tag.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Tag.scala index 19e6579d5..174bd66a2 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Tag.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Tag.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -97,7 +98,61 @@ object NewTag { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_Tag_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTag => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Tag_value extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTag => + dstCast(offset) = generated.value + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewTag extends NewNode(35.toShort) with TagBase { override type StoredNodeType = Tag override def label: String = "TAG" @@ -113,9 +168,9 @@ class NewTag extends NewNode(35.toShort) with TagBase { var value: String = "": String def name(value: String): this.type = { this.name = value; this } def value(value: String): this.type = { this.value = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 53, Iterator(this.value)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 39, 1) + interface.countProperty(this, 53, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TagNodePair.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TagNodePair.scala index 54fcad624..0d069a95c 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TagNodePair.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TagNodePair.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -61,7 +62,65 @@ object NewTagNodePair { def apply(): NewTagNodePair = new NewTagNodePair private val outNeighbors: Map[String, Set[String]] = Map() private val inNeighbors: Map[String, Set[String]] = Map() + + object InsertionHelpers { + object NewNodeInserter_TagNodePair_node extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[flatgraph.GNode]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTagNodePair => + dstCast(offset) = generated.node match { + case newV: flatgraph.DNode => newV.storedRef.get; case oldV: flatgraph.GNode => oldV; case null => null + } + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TagNodePair_tag extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[flatgraph.GNode]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTagNodePair => + dstCast(offset) = generated.tag match { + case newV: flatgraph.DNode => newV.storedRef.get; case oldV: flatgraph.GNode => oldV; case null => null + } + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewTagNodePair extends NewNode(36.toShort) with TagNodePairBase { override type StoredNodeType = TagNodePair override def label: String = "TAG_NODE_PAIR" @@ -77,9 +136,11 @@ class NewTagNodePair extends NewNode(36.toShort) with TagNodePairBase { var tag: TagBase = null def node(value: AbstractNode): this.type = { this.node = value; this } def tag(value: TagBase): this.type = { this.tag = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 57, Iterator(this.node)) - interface.insertProperty(this, 58, Iterator(this.tag)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 57, 1) + interface.visitContainedNode(node) + interface.countProperty(this, 58, 1) + interface.visitContainedNode(tag) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TemplateDom.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TemplateDom.scala index 0a670b320..4e207de3b 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TemplateDom.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TemplateDom.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1375,7 +1376,198 @@ object NewTemplateDom { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_TemplateDom_argumentIndex extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTemplateDom => + dstCast(offset) = generated.argumentIndex + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TemplateDom_argumentName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTemplateDom => + generated.argumentName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TemplateDom_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTemplateDom => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TemplateDom_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTemplateDom => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TemplateDom_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTemplateDom => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TemplateDom_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTemplateDom => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TemplateDom_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTemplateDom => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewTemplateDom extends NewNode(37.toShort) with TemplateDomBase with ExpressionNew { override type StoredNodeType = TemplateDom override def label: String = "TEMPLATE_DOM" @@ -1404,14 +1596,14 @@ class NewTemplateDom extends NewNode(37.toShort) with TemplateDomBase with Expre def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def name(value: String): this.type = { this.name = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 1, Iterator(this.argumentIndex)) - if (argumentName.nonEmpty) interface.insertProperty(this, 2, this.argumentName) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 1, 1) + interface.countProperty(this, 2, argumentName.size) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Type.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Type.scala index b7aa5eb83..4fa71993b 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Type.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Type.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -111,7 +112,86 @@ object NewType { "INHERITS_FROM" -> Set("TYPE_DECL"), "REF" -> Set("TYPE_ARGUMENT") ) + + object InsertionHelpers { + object NewNodeInserter_Type_fullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewType => + dstCast(offset) = generated.fullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Type_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewType => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Type_typeDeclFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewType => + dstCast(offset) = generated.typeDeclFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewType extends NewNode(38.toShort) with TypeBase { override type StoredNodeType = Type override def label: String = "TYPE" @@ -129,10 +209,10 @@ class NewType extends NewNode(38.toShort) with TypeBase { def fullName(value: String): this.type = { this.fullName = value; this } def name(value: String): this.type = { this.name = value; this } def typeDeclFullName(value: String): this.type = { this.typeDeclFullName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 22, Iterator(this.fullName)) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 51, Iterator(this.typeDeclFullName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 22, 1) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 51, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeArgument.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeArgument.scala index 733542f86..b694d8e39 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeArgument.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeArgument.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1330,7 +1331,119 @@ object NewTypeArgument { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_TypeArgument_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeArgument => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeArgument_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeArgument => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeArgument_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeArgument => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeArgument_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeArgument => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewTypeArgument extends NewNode(39.toShort) with TypeArgumentBase with AstNodeNew { override type StoredNodeType = TypeArgument override def label: String = "TYPE_ARGUMENT" @@ -1352,11 +1465,11 @@ class NewTypeArgument extends NewNode(39.toShort) with TypeArgumentBase with Ast def lineNumber(value: Int): this.type = { this.lineNumber = Option(value); this } def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeDecl.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeDecl.scala index 38085a488..3a27d099e 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeDecl.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeDecl.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1482,7 +1483,383 @@ object NewTypeDecl { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_TypeDecl_aliasTypeFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeDecl => + generated.aliasTypeFullName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeDecl_astParentFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeDecl => + dstCast(offset) = generated.astParentFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeDecl_astParentType extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeDecl => + dstCast(offset) = generated.astParentType + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeDecl_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeDecl => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeDecl_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeDecl => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeDecl_filename extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeDecl => + dstCast(offset) = generated.filename + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeDecl_fullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeDecl => + dstCast(offset) = generated.fullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeDecl_inheritsFromTypeFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeDecl => + for (item <- generated.inheritsFromTypeFullName) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeDecl_isExternal extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Boolean]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeDecl => + dstCast(offset) = generated.isExternal + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeDecl_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeDecl => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeDecl_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeDecl => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeDecl_offset extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeDecl => + generated.offset match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeDecl_offsetEnd extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeDecl => + generated.offsetEnd match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeDecl_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeDecl => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewTypeDecl extends NewNode(40.toShort) with TypeDeclBase with AstNodeNew { override type StoredNodeType = TypeDecl override def label: String = "TYPE_DECL" @@ -1529,21 +1906,21 @@ class NewTypeDecl extends NewNode(40.toShort) with TypeDeclBase with AstNodeNew def offsetEnd(value: Int): this.type = { this.offsetEnd = Option(value); this } def offsetEnd(value: Option[Int]): this.type = { this.offsetEnd = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - if (aliasTypeFullName.nonEmpty) interface.insertProperty(this, 0, this.aliasTypeFullName) - interface.insertProperty(this, 3, Iterator(this.astParentFullName)) - interface.insertProperty(this, 4, Iterator(this.astParentType)) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - interface.insertProperty(this, 21, Iterator(this.filename)) - interface.insertProperty(this, 22, Iterator(this.fullName)) - if (inheritsFromTypeFullName.nonEmpty) interface.insertProperty(this, 27, this.inheritsFromTypeFullName) - interface.insertProperty(this, 29, Iterator(this.isExternal)) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 39, Iterator(this.name)) - if (offset.nonEmpty) interface.insertProperty(this, 41, this.offset) - if (offsetEnd.nonEmpty) interface.insertProperty(this, 42, this.offsetEnd) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 0, aliasTypeFullName.size) + interface.countProperty(this, 3, 1) + interface.countProperty(this, 4, 1) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 21, 1) + interface.countProperty(this, 22, 1) + interface.countProperty(this, 27, inheritsFromTypeFullName.size) + interface.countProperty(this, 29, 1) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 41, offset.size) + interface.countProperty(this, 42, offsetEnd.size) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeParameter.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeParameter.scala index 769e07110..b08e742f4 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeParameter.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeParameter.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1340,7 +1341,144 @@ object NewTypeParameter { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_TypeParameter_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeParameter => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeParameter_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeParameter => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeParameter_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeParameter => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeParameter_name extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeParameter => + dstCast(offset) = generated.name + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeParameter_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeParameter => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewTypeParameter extends NewNode(41.toShort) with TypeParameterBase with AstNodeNew { override type StoredNodeType = TypeParameter override def label: String = "TYPE_PARAMETER" @@ -1364,12 +1502,12 @@ class NewTypeParameter extends NewNode(41.toShort) with TypeParameterBase with A def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } def name(value: String): this.type = { this.name = value; this } def order(value: Int): this.type = { this.order = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 39, Iterator(this.name)) - interface.insertProperty(this, 43, Iterator(this.order)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 39, 1) + interface.countProperty(this, 43, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeRef.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeRef.scala index a3f406cdd..3753bf21c 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeRef.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/TypeRef.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1410,7 +1411,252 @@ object NewTypeRef { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_TypeRef_argumentIndex extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeRef => + dstCast(offset) = generated.argumentIndex + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeRef_argumentName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeRef => + generated.argumentName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeRef_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeRef => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeRef_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeRef => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeRef_dynamicTypeHintFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeRef => + for (item <- generated.dynamicTypeHintFullName) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeRef_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeRef => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeRef_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeRef => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeRef_possibleTypes extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeRef => + for (item <- generated.possibleTypes) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_TypeRef_typeFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewTypeRef => + dstCast(offset) = generated.typeFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewTypeRef extends NewNode(42.toShort) with TypeRefBase with ExpressionNew { override type StoredNodeType = TypeRef override def label: String = "TYPE_REF" @@ -1445,16 +1691,16 @@ class NewTypeRef extends NewNode(42.toShort) with TypeRefBase with ExpressionNew def order(value: Int): this.type = { this.order = value; this } def possibleTypes(value: IterableOnce[String]): this.type = { this.possibleTypes = value.iterator.to(ArraySeq); this } def typeFullName(value: String): this.type = { this.typeFullName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 1, Iterator(this.argumentIndex)) - if (argumentName.nonEmpty) interface.insertProperty(this, 2, this.argumentName) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - if (dynamicTypeHintFullName.nonEmpty) interface.insertProperty(this, 18, this.dynamicTypeHintFullName) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 43, Iterator(this.order)) - if (possibleTypes.nonEmpty) interface.insertProperty(this, 47, this.possibleTypes) - interface.insertProperty(this, 52, Iterator(this.typeFullName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 1, 1) + interface.countProperty(this, 2, argumentName.size) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 18, dynamicTypeHintFullName.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 47, possibleTypes.size) + interface.countProperty(this, 52, 1) } override def copy(): this.type = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Unknown.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Unknown.scala index ff45d9eb5..9c53ce0ff 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Unknown.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/Unknown.scala @@ -2,6 +2,7 @@ package io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.codepropertygraph.generated.language.* import scala.collection.immutable.{IndexedSeq, ArraySeq} +import scala.collection.mutable /** Node base type for compiletime-only checks to improve type safety. EMT stands for: "erased marker trait", i.e. it is * erased at runtime @@ -1436,7 +1437,302 @@ object NewUnknown { "UNKNOWN" ) ) + + object InsertionHelpers { + object NewNodeInserter_Unknown_argumentIndex extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewUnknown => + dstCast(offset) = generated.argumentIndex + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Unknown_argumentName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewUnknown => + generated.argumentName match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Unknown_code extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewUnknown => + dstCast(offset) = generated.code + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Unknown_columnNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewUnknown => + generated.columnNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Unknown_containedRef extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewUnknown => + dstCast(offset) = generated.containedRef + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Unknown_dynamicTypeHintFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewUnknown => + for (item <- generated.dynamicTypeHintFullName) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Unknown_lineNumber extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewUnknown => + generated.lineNumber match { + case Some(item) => + dstCast(offset) = item + offset += 1 + case _ => + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Unknown_order extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[Int]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewUnknown => + dstCast(offset) = generated.order + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Unknown_parserTypeName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewUnknown => + dstCast(offset) = generated.parserTypeName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Unknown_possibleTypes extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewUnknown => + for (item <- generated.possibleTypes) { + dstCast(offset) = item + offset += 1 + } + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + object NewNodeInserter_Unknown_typeFullName extends flatgraph.NewNodePropertyInsertionHelper { + override def insertNewNodeProperties( + newNodes: mutable.ArrayBuffer[flatgraph.DNode], + dst: AnyRef, + offsets: Array[Int] + ): Unit = { + if (newNodes.isEmpty) return + val dstCast = dst.asInstanceOf[Array[String]] + val seq = newNodes.head.storedRef.get.seq() + var offset = offsets(seq) + var idx = 0 + while (idx < newNodes.length) { + val nn = newNodes(idx) + nn match { + case generated: NewUnknown => + dstCast(offset) = generated.typeFullName + offset += 1 + case _ => + } + assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") + idx += 1 + offsets(idx + seq) = offset + } + } + } + } } + class NewUnknown extends NewNode(43.toShort) with UnknownBase with ExpressionNew { override type StoredNodeType = Unknown override def label: String = "UNKNOWN" @@ -1475,18 +1771,18 @@ class NewUnknown extends NewNode(43.toShort) with UnknownBase with ExpressionNew def parserTypeName(value: String): this.type = { this.parserTypeName = value; this } def possibleTypes(value: IterableOnce[String]): this.type = { this.possibleTypes = value.iterator.to(ArraySeq); this } def typeFullName(value: String): this.type = { this.typeFullName = value; this } - override def flattenProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { - interface.insertProperty(this, 1, Iterator(this.argumentIndex)) - if (argumentName.nonEmpty) interface.insertProperty(this, 2, this.argumentName) - interface.insertProperty(this, 10, Iterator(this.code)) - if (columnNumber.nonEmpty) interface.insertProperty(this, 11, this.columnNumber) - interface.insertProperty(this, 13, Iterator(this.containedRef)) - if (dynamicTypeHintFullName.nonEmpty) interface.insertProperty(this, 18, this.dynamicTypeHintFullName) - if (lineNumber.nonEmpty) interface.insertProperty(this, 34, this.lineNumber) - interface.insertProperty(this, 43, Iterator(this.order)) - interface.insertProperty(this, 46, Iterator(this.parserTypeName)) - if (possibleTypes.nonEmpty) interface.insertProperty(this, 47, this.possibleTypes) - interface.insertProperty(this, 52, Iterator(this.typeFullName)) + override def countAndVisitProperties(interface: flatgraph.BatchedUpdateInterface): Unit = { + interface.countProperty(this, 1, 1) + interface.countProperty(this, 2, argumentName.size) + interface.countProperty(this, 10, 1) + interface.countProperty(this, 11, columnNumber.size) + interface.countProperty(this, 13, 1) + interface.countProperty(this, 18, dynamicTypeHintFullName.size) + interface.countProperty(this, 34, lineNumber.size) + interface.countProperty(this, 43, 1) + interface.countProperty(this, 46, 1) + interface.countProperty(this, 47, possibleTypes.size) + interface.countProperty(this, 52, 1) } override def copy(): this.type = {