Skip to content

Commit 07d7232

Browse files
committed
PS: Add a single upgrade script that upgrades the old dbscheme to the current dbscheme, and add a single downgrade script that downgrades the current dbscheme to the old dbscheme. IMPORTANT: the .gitattributes ensure that we keep CLRF (i.e., windows) line-endings on the old dbscheme scripts so that they match what is produced by the extractor.
1 parent a489bfd commit 07d7232

File tree

5 files changed

+68
-67
lines changed

5 files changed

+68
-67
lines changed

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,8 @@
8888
# swift prebuilt resources
8989
/swift/third_party/resources/*.zip filter=lfs diff=lfs merge=lfs -text
9090
/swift/third_party/resources/*.tar.zst filter=lfs diff=lfs merge=lfs -text
91+
92+
# This upgrade script must use windows line-endings to be compatible with old
93+
# databases.
94+
/powershell/ql/lib/upgrades/ce269c61feda10a8ca0d16519085f7e55741a694/old.dbscheme eol=crlf
95+
/powershell/downgrades/802d5b9f407fb0dac894df1c0b4584f2215e1512/semmlecode.powershell.dbscheme eol=crlf

powershell/downgrades/802d5b9f407fb0dac894df1c0b4584f2215e1512/semmlecode.powershell.dbscheme

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ containerparent(
4141
unique int child: @container ref
4242
);
4343

44-
is_in_psmodule_path(
45-
int file: @file ref
46-
);
47-
4844
/* Comments */
4945
comment_entity(
5046
unique int id: @comment_entity,
@@ -68,15 +64,15 @@ extractor_messages(
6864
);
6965

7066
parent(
71-
int child: @ast ref,
72-
int parent: @ast ref
67+
int parent: @ast ref,
68+
int child: @ast ref
7369
);
7470

7571
/* AST Nodes */
7672
// This is all the kinds of nodes that can inherit from Ast
7773
// https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.ast?view=powershellsdk-7.3.0
7874
@ast = @not_implemented | @attribute_base | @catch_clause | @command_element |
79-
@member | @named_block | @param_block | @parameter | @redirection | @script_block | @statement | @statement_block | @named_attribute_argument;
75+
@member | @named_block | @param_block | @parameter | @redirection | @script_block | @statement | @statement_block;
8076
// https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.attributebaseast?view=powershellsdk-7.2.0
8177
@attribute_base = @attribute | @type_constraint;
8278

@@ -86,7 +82,7 @@ parent(
8682
// https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.commandbaseast?view=powershellsdk-7.3.0
8783
@command_base = @command | @command_expression;
8884
// https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.chainableast?view=powershellsdk-7.3.0
89-
@chainable = @command_base | @pipeline | @pipeline_chain;
85+
@chainable = @pipeline | @pipeline_chain;
9086
//https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.pipelinebaseast?view=powershellsdk-7.3.0
9187
@pipeline_base = @chainable | @error_statement | @assignment_statement;
9288
// https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.statementast?view=powershellsdk-7.3.0
@@ -413,13 +409,13 @@ if_statement(
413409
if_statement_clause(
414410
int id: @if_statement ref,
415411
int index: int ref,
416-
int item1: @pipeline_base ref,
417-
int item2: @statement_block ref
412+
int item1: @ast ref,
413+
int item2: @ast ref
418414
)
419415

420416
if_statement_else(
421417
int id: @if_statement ref,
422-
int elseItem: @statement_block ref
418+
int elseItem: @ast ref
423419
)
424420

425421
if_statement_location(
@@ -471,7 +467,7 @@ statement_block_trap(
471467
// https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.subexpressionast?view=powershellsdk-7.3.0
472468
sub_expression(
473469
unique int id: @sub_expression,
474-
int subExpression: @statement_block ref
470+
int subExpression: @ast ref
475471
)
476472

477473
sub_expression_location(
@@ -631,7 +627,7 @@ exit_statement(
631627

632628
exit_statement_pipeline(
633629
int id: @exit_statement ref,
634-
int expression: @pipeline_base ref
630+
int expression: @ast ref
635631
)
636632

637633
exit_statement_location(
@@ -818,7 +814,7 @@ continue_statement_location(
818814

819815
statement_label(
820816
int id: @labelled_statement ref,
821-
int label: @expression ref
817+
int label: @ast ref
822818
)
823819

824820
// ReturnStatementAst
@@ -829,7 +825,7 @@ return_statement(
829825

830826
return_statement_pipeline(
831827
int id: @return_statement ref,
832-
int pipeline: @pipeline_base ref
828+
int pipeline: @ast ref
833829
)
834830

835831
return_statement_location(
@@ -841,12 +837,12 @@ return_statement_location(
841837
// https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.dowhilestatementast?view=powershellsdk-7.3.0
842838
do_while_statement(
843839
unique int id: @do_while_statement,
844-
int body: @statement_block ref
840+
int body: @ast ref
845841
)
846842

847843
do_while_statement_condition(
848844
int id: @do_while_statement ref,
849-
int condition: @pipeline_base ref
845+
int condition: @ast ref
850846
)
851847

852848
do_while_statement_location(
@@ -858,12 +854,12 @@ do_while_statement_location(
858854
// https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.dountilstatementast?view=powershellsdk-7.3.0
859855
do_until_statement(
860856
unique int id: @do_until_statement,
861-
int body: @statement_block ref
857+
int body: @ast ref
862858
)
863859

864860
do_until_statement_condition(
865861
int id: @do_until_statement ref,
866-
int condition: @pipeline_base ref
862+
int condition: @ast ref
867863
)
868864

869865
do_until_statement_location(
@@ -875,12 +871,12 @@ do_until_statement_location(
875871
// https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.whilestatementast?view=powershellsdk-7.3.0
876872
while_statement(
877873
unique int id: @while_statement,
878-
int body: @statement_block ref
874+
int body: @ast ref
879875
)
880876

881877
while_statement_condition(
882878
int id: @while_statement ref,
883-
int condition: @pipeline_base ref
879+
int condition: @ast ref
884880
)
885881

886882
while_statement_location(
@@ -892,9 +888,9 @@ while_statement_location(
892888
// https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.foreachstatementast?view=powershellsdk-7.3.0
893889
foreach_statement(
894890
unique int id: @foreach_statement,
895-
int variable: @variable_expression ref,
896-
int condition: @pipeline_base ref,
897-
int body: @statement_block ref,
891+
int variable: @ast ref,
892+
int condition: @ast ref,
893+
int body: @ast ref,
898894
int flags: int ref
899895
)
900896

@@ -907,7 +903,7 @@ foreach_statement_location(
907903
// https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.forstatementast?view=powershellsdk-7.3.0
908904
for_statement(
909905
unique int id: @for_statement,
910-
int body: @statement_block ref
906+
int body: @ast ref
911907
)
912908

913909
for_statement_location(
@@ -917,17 +913,17 @@ for_statement_location(
917913

918914
for_statement_condition(
919915
int id: @for_statement ref,
920-
int condition: @pipeline_base ref
916+
int condition: @ast ref
921917
)
922918

923919
for_statement_initializer(
924920
int id: @for_statement ref,
925-
int initializer: @pipeline_base ref
921+
int initializer: @ast ref
926922
)
927923

928924
for_statement_iterator(
929925
int id: @for_statement ref,
930-
int iterator: @pipeline_base ref
926+
int iterator: @ast ref
931927
)
932928

933929
// ExpandableStringExpressionAst
@@ -992,14 +988,14 @@ unary_expression_location(
992988
// https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.catchclauseast?view=powershellsdk-7.3.0
993989
catch_clause(
994990
unique int id: @catch_clause,
995-
int body: @statement_block ref,
991+
int body: @ast ref,
996992
boolean isCatchAll: boolean ref
997993
)
998994

999995
catch_clause_catch_type(
1000996
int id: @catch_clause ref,
1001997
int index: int ref,
1002-
int catch_type: @type_constraint ref
998+
int catch_type: @ast ref
1003999
)
10041000

10051001
catch_clause_location(
@@ -1028,7 +1024,7 @@ throw_statement_pipeline(
10281024
// https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.trystatementast?view=powershellsdk-7.3.0
10291025
try_statement(
10301026
unique int id: @try_statement,
1031-
int body: @statement_block ref
1027+
int body: @ast ref
10321028
)
10331029

10341030
try_statement_catch_clause(
@@ -1103,9 +1099,9 @@ token_location(
11031099
// https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.configurationdefinitionast?view=powershellsdk-7.3.0
11041100
configuration_definition(
11051101
unique int id: @configuration_definition,
1106-
int body: @script_block_expression ref,
1102+
int body: @ast ref,
11071103
int configurationType: int ref,
1108-
int name: @expression ref
1104+
int name: @ast ref
11091105
)
11101106

11111107
configuration_definition_location(
@@ -1117,7 +1113,7 @@ configuration_definition_location(
11171113
// https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.language.datastatementast?view=powershellsdk-7.3.0
11181114
data_statement(
11191115
unique int id: @data_statement,
1120-
int body: @statement_block ref
1116+
int body: @ast ref
11211117
)
11221118

11231119
data_statement_variable(
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
description: Remove psmodule file extraction
2-
compatibility: partial
1+
description: Unknown
2+
compatibility: partial

0 commit comments

Comments
 (0)