From f81833cf998f8fb2b6d2c44149ed0df1279ac6c2 2022-02-15 12:23:01 From: mh Date: 2022-02-15 12:23:01 Subject: [PATCH] Fix bug in search key for type table --- diff --git a/ast_output.txt b/ast_output.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4cfcc96a73c34670daa8aaf4e0e5a1d4887450c --- /dev/null +++ b/ast_output.txt @@ -0,0 +1,1494 @@ +Root[0000]- Module: + - Pragmas: + - Imports: + - Definitions: +DefS[0007] - DefinitionStruct: + - Name: Holder + - PolyVar: T + - Fields: + - Field: + - Name: left + - Type: T[] + - Field: + - Name: right + - Type: T[] +DefF[0008] - DefinitionFunction: + - Name: create_array + - PolyVar: T + - ReturnParserType: T[] + - Parameters: +Var [0008] - Variable: + - Name: first_index + - Kind: Parameter + - ParserType: T + - RelativePos: -1 + - UniqueScopeID: 0 +Var [0009] - Variable: + - Name: last_index + - Kind: Parameter + - ParserType: T + - RelativePos: -1 + - UniqueScopeID: 1 + - Body: +SBl [0008] - Block: + - EndBlockID: 9 + - ScopeID: 2 + - Statements: +SMem[0000] - LocalMemory: + - Variable: +Var [0010] - Variable: + - Name: result + - Kind: Local + - ParserType: auto + - RelativePos: 0 + - UniqueScopeID: 2 + - InitialValue: +EAsi[0002] - AssignmentExpr: + - UniqueId: 0 + - Operation: Set + - Left: +EVar[0001] - VariableExpr: + - UniqueId: 1 + - Name: result + - Definition: Some(10) + - Parent: Expr(2, 0) + - Right: +ELit[0000] - LiteralExpr: + - UniqueId: 2 + - Value: Array + - Elements: + - Parent: Expr(2, 1) + - Parent: MemStmt(0) + - Next: 5 +SWhi[0005] - While: + - EndWhile: 6 + - InSync: -1 + - Condition: +EBin[0005] - BinaryExpr: + - UniqueId: 3 + - Operation: LessThan + - Left: +EVar[0003] - VariableExpr: + - UniqueId: 4 + - Name: first_index + - Definition: Some(8) + - Parent: Expr(5, 0) + - Right: +EVar[0004] - VariableExpr: + - UniqueId: 5 + - Name: last_index + - Definition: Some(9) + - Parent: Expr(5, 1) + - Parent: WhileStmt(5) + - Body: +SBl [0003] - Block: + - EndBlockID: 4 + - ScopeID: 0 + - Statements: +SExp[0001] - ExpressionStatement: +EAsi[0011] - AssignmentExpr: + - UniqueId: 6 + - Operation: Set + - Left: +EVar[0006] - VariableExpr: + - UniqueId: 7 + - Name: result + - Definition: Some(10) + - Parent: Expr(11, 0) + - Right: +EBin[0010] - BinaryExpr: + - UniqueId: 8 + - Operation: Concatenate + - Left: +EVar[0007] - VariableExpr: + - UniqueId: 9 + - Name: result + - Definition: Some(10) + - Parent: Expr(10, 0) + - Right: +ELit[0009] - LiteralExpr: + - UniqueId: 10 + - Value: Array + - Elements: +EVar[0008] - VariableExpr: + - UniqueId: 11 + - Name: first_index + - Definition: Some(8) + - Parent: Expr(9, 0) + - Parent: Expr(10, 1) + - Parent: Expr(11, 1) + - Parent: ExprStmt(1) + - Next: 2 +SExp[0002] - ExpressionStatement: +EAsi[0014] - AssignmentExpr: + - UniqueId: 12 + - Operation: Added + - Left: +EVar[0012] - VariableExpr: + - UniqueId: 13 + - Name: first_index + - Definition: Some(8) + - Parent: Expr(14, 0) + - Right: +ELit[0013] - LiteralExpr: + - UniqueId: 14 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(14, 1) + - Parent: ExprStmt(2) + - Next: 4 +SRet[0007] - Return: + - Expressions: +EVar[0015] - VariableExpr: + - UniqueId: 15 + - Name: result + - Definition: Some(10) + - Parent: ReturnStmt(7) +DefF[0009] - DefinitionFunction: + - Name: create_holder + - PolyVar: T + - ReturnParserType: Holder + - Parameters: +Var [0011] - Variable: + - Name: left_first + - Kind: Parameter + - ParserType: T + - RelativePos: -1 + - UniqueScopeID: 0 +Var [0012] - Variable: + - Name: left_last + - Kind: Parameter + - ParserType: T + - RelativePos: -1 + - UniqueScopeID: 1 +Var [0013] - Variable: + - Name: right_first + - Kind: Parameter + - ParserType: T + - RelativePos: -1 + - UniqueScopeID: 2 +Var [0014] - Variable: + - Name: right_last + - Kind: Parameter + - ParserType: T + - RelativePos: -1 + - UniqueScopeID: 3 + - Body: +SBl [0011] - Block: + - EndBlockID: 12 + - ScopeID: 4 + - Statements: +SRet[0010] - Return: + - Expressions: +ELit[0022] - LiteralExpr: + - UniqueId: 0 + - Value: Struct + - ParserType: Holder + - Definition: 7 + - Field: + - Name: left + - Index: 0 + - ParserType: +ECll[0018] - CallExpr: + - UniqueId: 1 + - BuiltIn: false + - Variant: Function + - MethodName: create_array + - ParserType: create_array + - Arguments: +EVar[0016] - VariableExpr: + - UniqueId: 2 + - Name: left_first + - Definition: Some(11) + - Parent: Expr(18, 0) +EVar[0017] - VariableExpr: + - UniqueId: 3 + - Name: left_last + - Definition: Some(12) + - Parent: Expr(18, 1) + - Parent: Expr(22, 0) + - Field: + - Name: right + - Index: 1 + - ParserType: +ECll[0021] - CallExpr: + - UniqueId: 4 + - BuiltIn: false + - Variant: Function + - MethodName: create_array + - ParserType: create_array + - Arguments: +EVar[0019] - VariableExpr: + - UniqueId: 5 + - Name: right_first + - Definition: Some(13) + - Parent: Expr(21, 0) +EVar[0020] - VariableExpr: + - UniqueId: 6 + - Name: right_last + - Definition: Some(14) + - Parent: Expr(21, 1) + - Parent: Expr(22, 1) + - Parent: ReturnStmt(10) +DefF[0010] - DefinitionFunction: + - Name: slicing_magic + - PolyVar: T + - ReturnParserType: T[] + - Parameters: +Var [0015] - Variable: + - Name: holder + - Kind: Parameter + - ParserType: Holder + - RelativePos: -1 + - UniqueScopeID: 0 +Var [0016] - Variable: + - Name: left_base + - Kind: Parameter + - ParserType: u32 + - RelativePos: -1 + - UniqueScopeID: 1 +Var [0017] - Variable: + - Name: left_amount + - Kind: Parameter + - ParserType: u32 + - RelativePos: -1 + - UniqueScopeID: 2 +Var [0018] - Variable: + - Name: right_base + - Kind: Parameter + - ParserType: u32 + - RelativePos: -1 + - UniqueScopeID: 3 +Var [0019] - Variable: + - Name: right_amount + - Kind: Parameter + - ParserType: u32 + - RelativePos: -1 + - UniqueScopeID: 4 + - Body: +SBl [0016] - Block: + - EndBlockID: 17 + - ScopeID: 6 + - Statements: +SMem[0013] - LocalMemory: + - Variable: +Var [0020] - Variable: + - Name: left + - Kind: Local + - ParserType: auto + - RelativePos: 0 + - UniqueScopeID: 5 + - InitialValue: +EAsi[0031] - AssignmentExpr: + - UniqueId: 0 + - Operation: Set + - Left: +EVar[0030] - VariableExpr: + - UniqueId: 1 + - Name: left + - Definition: Some(20) + - Parent: Expr(31, 0) + - Right: +ESli[0029] - SlicingExpr: + - UniqueId: 2 + - Subject: +ESel[0024] - SelectExpr: + - UniqueId: 3 + - Subject: +EVar[0023] - VariableExpr: + - UniqueId: 4 + - Name: holder + - Definition: Some(15) + - Parent: Expr(24, 0) + - StructField: left + - Parent: Expr(29, 0) + - FromIndex: +EVar[0025] - VariableExpr: + - UniqueId: 5 + - Name: left_base + - Definition: Some(16) + - Parent: Expr(29, 1) + - ToIndex: +EBin[0028] - BinaryExpr: + - UniqueId: 6 + - Operation: Add + - Left: +EVar[0026] - VariableExpr: + - UniqueId: 7 + - Name: left_base + - Definition: Some(16) + - Parent: Expr(28, 0) + - Right: +EVar[0027] - VariableExpr: + - UniqueId: 8 + - Name: left_amount + - Definition: Some(17) + - Parent: Expr(28, 1) + - Parent: Expr(29, 2) + - Parent: Expr(31, 1) + - Parent: MemStmt(13) + - Next: 14 +SMem[0014] - LocalMemory: + - Variable: +Var [0021] - Variable: + - Name: right + - Kind: Local + - ParserType: auto + - RelativePos: 1 + - UniqueScopeID: 6 + - InitialValue: +EAsi[0040] - AssignmentExpr: + - UniqueId: 9 + - Operation: Set + - Left: +EVar[0039] - VariableExpr: + - UniqueId: 10 + - Name: right + - Definition: Some(21) + - Parent: Expr(40, 0) + - Right: +ESli[0038] - SlicingExpr: + - UniqueId: 11 + - Subject: +ESel[0033] - SelectExpr: + - UniqueId: 12 + - Subject: +EVar[0032] - VariableExpr: + - UniqueId: 13 + - Name: holder + - Definition: Some(15) + - Parent: Expr(33, 0) + - StructField: right + - Parent: Expr(38, 0) + - FromIndex: +EVar[0034] - VariableExpr: + - UniqueId: 14 + - Name: right_base + - Definition: Some(18) + - Parent: Expr(38, 1) + - ToIndex: +EBin[0037] - BinaryExpr: + - UniqueId: 15 + - Operation: Add + - Left: +EVar[0035] - VariableExpr: + - UniqueId: 16 + - Name: right_base + - Definition: Some(18) + - Parent: Expr(37, 0) + - Right: +EVar[0036] - VariableExpr: + - UniqueId: 17 + - Name: right_amount + - Definition: Some(19) + - Parent: Expr(37, 1) + - Parent: Expr(38, 2) + - Parent: Expr(40, 1) + - Parent: MemStmt(14) + - Next: 15 +SRet[0015] - Return: + - Expressions: +EBin[0049] - BinaryExpr: + - UniqueId: 18 + - Operation: Concatenate + - Left: +ESli[0044] - SlicingExpr: + - UniqueId: 19 + - Subject: +EVar[0041] - VariableExpr: + - UniqueId: 20 + - Name: left + - Definition: Some(20) + - Parent: Expr(44, 0) + - FromIndex: +ELit[0042] - LiteralExpr: + - UniqueId: 21 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(44, 1) + - ToIndex: +ELit[0043] - LiteralExpr: + - UniqueId: 22 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(44, 2) + - Parent: Expr(49, 0) + - Right: +ESli[0048] - SlicingExpr: + - UniqueId: 23 + - Subject: +EVar[0045] - VariableExpr: + - UniqueId: 24 + - Name: right + - Definition: Some(21) + - Parent: Expr(48, 0) + - FromIndex: +ELit[0046] - LiteralExpr: + - UniqueId: 25 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(48, 1) + - ToIndex: +ELit[0047] - LiteralExpr: + - UniqueId: 26 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(48, 2) + - Parent: Expr(49, 1) + - Parent: ReturnStmt(15) +DefF[0011] - DefinitionFunction: + - Name: foo + - ReturnParserType: bool + - Parameters: + - Body: +SBl [0031] - Block: + - EndBlockID: 32 + - ScopeID: 8 + - Statements: +SMem[0018] - LocalMemory: + - Variable: +Var [0022] - Variable: + - Name: created_u08 + - Kind: Local + - ParserType: auto + - RelativePos: 0 + - UniqueScopeID: 0 + - InitialValue: +EAsi[0056] - AssignmentExpr: + - UniqueId: 0 + - Operation: Set + - Left: +EVar[0055] - VariableExpr: + - UniqueId: 1 + - Name: created_u08 + - Definition: Some(22) + - Parent: Expr(56, 0) + - Right: +ECll[0054] - CallExpr: + - UniqueId: 2 + - BuiltIn: false + - Variant: Function + - MethodName: create_holder + - ParserType: create_holder + - Arguments: +ELit[0050] - LiteralExpr: + - UniqueId: 3 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(54, 0) +ELit[0051] - LiteralExpr: + - UniqueId: 4 + - Value: LiteralInteger { unsigned_value: 5, negated: false } + - Parent: Expr(54, 1) +ELit[0052] - LiteralExpr: + - UniqueId: 5 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(54, 2) +ELit[0053] - LiteralExpr: + - UniqueId: 6 + - Value: LiteralInteger { unsigned_value: 8, negated: false } + - Parent: Expr(54, 3) + - Parent: Expr(56, 1) + - Parent: MemStmt(18) + - Next: 19 +SMem[0019] - LocalMemory: + - Variable: +Var [0023] - Variable: + - Name: created_u16 + - Kind: Local + - ParserType: auto + - RelativePos: 1 + - UniqueScopeID: 1 + - InitialValue: +EAsi[0063] - AssignmentExpr: + - UniqueId: 7 + - Operation: Set + - Left: +EVar[0062] - VariableExpr: + - UniqueId: 8 + - Name: created_u16 + - Definition: Some(23) + - Parent: Expr(63, 0) + - Right: +ECll[0061] - CallExpr: + - UniqueId: 9 + - BuiltIn: false + - Variant: Function + - MethodName: create_holder + - ParserType: create_holder + - Arguments: +ELit[0057] - LiteralExpr: + - UniqueId: 10 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(61, 0) +ELit[0058] - LiteralExpr: + - UniqueId: 11 + - Value: LiteralInteger { unsigned_value: 5, negated: false } + - Parent: Expr(61, 1) +ELit[0059] - LiteralExpr: + - UniqueId: 12 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(61, 2) +ELit[0060] - LiteralExpr: + - UniqueId: 13 + - Value: LiteralInteger { unsigned_value: 8, negated: false } + - Parent: Expr(61, 3) + - Parent: Expr(63, 1) + - Parent: MemStmt(19) + - Next: 20 +SMem[0020] - LocalMemory: + - Variable: +Var [0024] - Variable: + - Name: created_u32 + - Kind: Local + - ParserType: auto + - RelativePos: 2 + - UniqueScopeID: 2 + - InitialValue: +EAsi[0070] - AssignmentExpr: + - UniqueId: 14 + - Operation: Set + - Left: +EVar[0069] - VariableExpr: + - UniqueId: 15 + - Name: created_u32 + - Definition: Some(24) + - Parent: Expr(70, 0) + - Right: +ECll[0068] - CallExpr: + - UniqueId: 16 + - BuiltIn: false + - Variant: Function + - MethodName: create_holder + - ParserType: create_holder + - Arguments: +ELit[0064] - LiteralExpr: + - UniqueId: 17 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(68, 0) +ELit[0065] - LiteralExpr: + - UniqueId: 18 + - Value: LiteralInteger { unsigned_value: 5, negated: false } + - Parent: Expr(68, 1) +ELit[0066] - LiteralExpr: + - UniqueId: 19 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(68, 2) +ELit[0067] - LiteralExpr: + - UniqueId: 20 + - Value: LiteralInteger { unsigned_value: 8, negated: false } + - Parent: Expr(68, 3) + - Parent: Expr(70, 1) + - Parent: MemStmt(20) + - Next: 21 +SMem[0021] - LocalMemory: + - Variable: +Var [0025] - Variable: + - Name: created_u64 + - Kind: Local + - ParserType: auto + - RelativePos: 3 + - UniqueScopeID: 3 + - InitialValue: +EAsi[0077] - AssignmentExpr: + - UniqueId: 21 + - Operation: Set + - Left: +EVar[0076] - VariableExpr: + - UniqueId: 22 + - Name: created_u64 + - Definition: Some(25) + - Parent: Expr(77, 0) + - Right: +ECll[0075] - CallExpr: + - UniqueId: 23 + - BuiltIn: false + - Variant: Function + - MethodName: create_holder + - ParserType: create_holder + - Arguments: +ELit[0071] - LiteralExpr: + - UniqueId: 24 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(75, 0) +ELit[0072] - LiteralExpr: + - UniqueId: 25 + - Value: LiteralInteger { unsigned_value: 5, negated: false } + - Parent: Expr(75, 1) +ELit[0073] - LiteralExpr: + - UniqueId: 26 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(75, 2) +ELit[0074] - LiteralExpr: + - UniqueId: 27 + - Value: LiteralInteger { unsigned_value: 8, negated: false } + - Parent: Expr(75, 3) + - Parent: Expr(77, 1) + - Parent: MemStmt(21) + - Next: 22 +SMem[0022] - LocalMemory: + - Variable: +Var [0026] - Variable: + - Name: result_u08 + - Kind: Local + - ParserType: auto + - RelativePos: 4 + - UniqueScopeID: 4 + - InitialValue: +EAsi[0085] - AssignmentExpr: + - UniqueId: 28 + - Operation: Set + - Left: +EVar[0084] - VariableExpr: + - UniqueId: 29 + - Name: result_u08 + - Definition: Some(26) + - Parent: Expr(85, 0) + - Right: +ECll[0083] - CallExpr: + - UniqueId: 30 + - BuiltIn: false + - Variant: Function + - MethodName: slicing_magic + - ParserType: slicing_magic + - Arguments: +EVar[0078] - VariableExpr: + - UniqueId: 31 + - Name: created_u08 + - Definition: Some(22) + - Parent: Expr(83, 0) +ELit[0079] - LiteralExpr: + - UniqueId: 32 + - Value: LiteralInteger { unsigned_value: 3, negated: false } + - Parent: Expr(83, 1) +ELit[0080] - LiteralExpr: + - UniqueId: 33 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(83, 2) +ELit[0081] - LiteralExpr: + - UniqueId: 34 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(83, 3) +ELit[0082] - LiteralExpr: + - UniqueId: 35 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(83, 4) + - Parent: Expr(85, 1) + - Parent: MemStmt(22) + - Next: 23 +SMem[0023] - LocalMemory: + - Variable: +Var [0027] - Variable: + - Name: result_u16 + - Kind: Local + - ParserType: auto + - RelativePos: 5 + - UniqueScopeID: 5 + - InitialValue: +EAsi[0093] - AssignmentExpr: + - UniqueId: 36 + - Operation: Set + - Left: +EVar[0092] - VariableExpr: + - UniqueId: 37 + - Name: result_u16 + - Definition: Some(27) + - Parent: Expr(93, 0) + - Right: +ECll[0091] - CallExpr: + - UniqueId: 38 + - BuiltIn: false + - Variant: Function + - MethodName: slicing_magic + - ParserType: slicing_magic + - Arguments: +EVar[0086] - VariableExpr: + - UniqueId: 39 + - Name: created_u16 + - Definition: Some(23) + - Parent: Expr(91, 0) +ELit[0087] - LiteralExpr: + - UniqueId: 40 + - Value: LiteralInteger { unsigned_value: 3, negated: false } + - Parent: Expr(91, 1) +ELit[0088] - LiteralExpr: + - UniqueId: 41 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(91, 2) +ELit[0089] - LiteralExpr: + - UniqueId: 42 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(91, 3) +ELit[0090] - LiteralExpr: + - UniqueId: 43 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(91, 4) + - Parent: Expr(93, 1) + - Parent: MemStmt(23) + - Next: 24 +SMem[0024] - LocalMemory: + - Variable: +Var [0028] - Variable: + - Name: result_u32 + - Kind: Local + - ParserType: auto + - RelativePos: 6 + - UniqueScopeID: 6 + - InitialValue: +EAsi[0101] - AssignmentExpr: + - UniqueId: 44 + - Operation: Set + - Left: +EVar[0100] - VariableExpr: + - UniqueId: 45 + - Name: result_u32 + - Definition: Some(28) + - Parent: Expr(101, 0) + - Right: +ECll[0099] - CallExpr: + - UniqueId: 46 + - BuiltIn: false + - Variant: Function + - MethodName: slicing_magic + - ParserType: slicing_magic + - Arguments: +EVar[0094] - VariableExpr: + - UniqueId: 47 + - Name: created_u32 + - Definition: Some(24) + - Parent: Expr(99, 0) +ELit[0095] - LiteralExpr: + - UniqueId: 48 + - Value: LiteralInteger { unsigned_value: 3, negated: false } + - Parent: Expr(99, 1) +ELit[0096] - LiteralExpr: + - UniqueId: 49 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(99, 2) +ELit[0097] - LiteralExpr: + - UniqueId: 50 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(99, 3) +ELit[0098] - LiteralExpr: + - UniqueId: 51 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(99, 4) + - Parent: Expr(101, 1) + - Parent: MemStmt(24) + - Next: 25 +SMem[0025] - LocalMemory: + - Variable: +Var [0029] - Variable: + - Name: result_u64 + - Kind: Local + - ParserType: auto + - RelativePos: 7 + - UniqueScopeID: 7 + - InitialValue: +EAsi[0109] - AssignmentExpr: + - UniqueId: 52 + - Operation: Set + - Left: +EVar[0108] - VariableExpr: + - UniqueId: 53 + - Name: result_u64 + - Definition: Some(29) + - Parent: Expr(109, 0) + - Right: +ECll[0107] - CallExpr: + - UniqueId: 54 + - BuiltIn: false + - Variant: Function + - MethodName: slicing_magic + - ParserType: slicing_magic + - Arguments: +EVar[0102] - VariableExpr: + - UniqueId: 55 + - Name: created_u64 + - Definition: Some(25) + - Parent: Expr(107, 0) +ELit[0103] - LiteralExpr: + - UniqueId: 56 + - Value: LiteralInteger { unsigned_value: 3, negated: false } + - Parent: Expr(107, 1) +ELit[0104] - LiteralExpr: + - UniqueId: 57 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(107, 2) +ELit[0105] - LiteralExpr: + - UniqueId: 58 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(107, 3) +ELit[0106] - LiteralExpr: + - UniqueId: 59 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(107, 4) + - Parent: Expr(109, 1) + - Parent: MemStmt(25) + - Next: 26 +SMem[0026] - LocalMemory: + - Variable: +Var [0030] - Variable: + - Name: result_s08 + - Kind: Local + - ParserType: auto + - RelativePos: 8 + - UniqueScopeID: 8 + - InitialValue: +EAsi[0121] - AssignmentExpr: + - UniqueId: 60 + - Operation: Set + - Left: +EVar[0120] - VariableExpr: + - UniqueId: 61 + - Name: result_s08 + - Definition: Some(30) + - Parent: Expr(121, 0) + - Right: +ECll[0119] - CallExpr: + - UniqueId: 62 + - BuiltIn: false + - Variant: Function + - MethodName: slicing_magic + - ParserType: slicing_magic + - Arguments: +ECll[0114] - CallExpr: + - UniqueId: 63 + - BuiltIn: false + - Variant: Function + - MethodName: create_holder + - ParserType: create_holder + - Arguments: +ELit[0110] - LiteralExpr: + - UniqueId: 64 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(114, 0) +ELit[0111] - LiteralExpr: + - UniqueId: 65 + - Value: LiteralInteger { unsigned_value: 5, negated: false } + - Parent: Expr(114, 1) +ELit[0112] - LiteralExpr: + - UniqueId: 66 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(114, 2) +ELit[0113] - LiteralExpr: + - UniqueId: 67 + - Value: LiteralInteger { unsigned_value: 8, negated: false } + - Parent: Expr(114, 3) + - Parent: Expr(119, 0) +ELit[0115] - LiteralExpr: + - UniqueId: 68 + - Value: LiteralInteger { unsigned_value: 3, negated: false } + - Parent: Expr(119, 1) +ELit[0116] - LiteralExpr: + - UniqueId: 69 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(119, 2) +ELit[0117] - LiteralExpr: + - UniqueId: 70 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(119, 3) +ELit[0118] - LiteralExpr: + - UniqueId: 71 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(119, 4) + - Parent: Expr(121, 1) + - Parent: MemStmt(26) + - Next: 27 +SMem[0027] - LocalMemory: + - Variable: +Var [0031] - Variable: + - Name: result_s16 + - Kind: Local + - ParserType: auto + - RelativePos: 9 + - UniqueScopeID: 9 + - InitialValue: +EAsi[0133] - AssignmentExpr: + - UniqueId: 72 + - Operation: Set + - Left: +EVar[0132] - VariableExpr: + - UniqueId: 73 + - Name: result_s16 + - Definition: Some(31) + - Parent: Expr(133, 0) + - Right: +ECll[0131] - CallExpr: + - UniqueId: 74 + - BuiltIn: false + - Variant: Function + - MethodName: slicing_magic + - ParserType: slicing_magic + - Arguments: +ECll[0126] - CallExpr: + - UniqueId: 75 + - BuiltIn: false + - Variant: Function + - MethodName: create_holder + - ParserType: create_holder + - Arguments: +ELit[0122] - LiteralExpr: + - UniqueId: 76 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(126, 0) +ELit[0123] - LiteralExpr: + - UniqueId: 77 + - Value: LiteralInteger { unsigned_value: 5, negated: false } + - Parent: Expr(126, 1) +ELit[0124] - LiteralExpr: + - UniqueId: 78 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(126, 2) +ELit[0125] - LiteralExpr: + - UniqueId: 79 + - Value: LiteralInteger { unsigned_value: 8, negated: false } + - Parent: Expr(126, 3) + - Parent: Expr(131, 0) +ELit[0127] - LiteralExpr: + - UniqueId: 80 + - Value: LiteralInteger { unsigned_value: 3, negated: false } + - Parent: Expr(131, 1) +ELit[0128] - LiteralExpr: + - UniqueId: 81 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(131, 2) +ELit[0129] - LiteralExpr: + - UniqueId: 82 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(131, 3) +ELit[0130] - LiteralExpr: + - UniqueId: 83 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(131, 4) + - Parent: Expr(133, 1) + - Parent: MemStmt(27) + - Next: 28 +SMem[0028] - LocalMemory: + - Variable: +Var [0032] - Variable: + - Name: result_s32 + - Kind: Local + - ParserType: auto + - RelativePos: 10 + - UniqueScopeID: 10 + - InitialValue: +EAsi[0145] - AssignmentExpr: + - UniqueId: 84 + - Operation: Set + - Left: +EVar[0144] - VariableExpr: + - UniqueId: 85 + - Name: result_s32 + - Definition: Some(32) + - Parent: Expr(145, 0) + - Right: +ECll[0143] - CallExpr: + - UniqueId: 86 + - BuiltIn: false + - Variant: Function + - MethodName: slicing_magic + - ParserType: slicing_magic + - Arguments: +ECll[0138] - CallExpr: + - UniqueId: 87 + - BuiltIn: false + - Variant: Function + - MethodName: create_holder + - ParserType: create_holder + - Arguments: +ELit[0134] - LiteralExpr: + - UniqueId: 88 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(138, 0) +ELit[0135] - LiteralExpr: + - UniqueId: 89 + - Value: LiteralInteger { unsigned_value: 5, negated: false } + - Parent: Expr(138, 1) +ELit[0136] - LiteralExpr: + - UniqueId: 90 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(138, 2) +ELit[0137] - LiteralExpr: + - UniqueId: 91 + - Value: LiteralInteger { unsigned_value: 8, negated: false } + - Parent: Expr(138, 3) + - Parent: Expr(143, 0) +ELit[0139] - LiteralExpr: + - UniqueId: 92 + - Value: LiteralInteger { unsigned_value: 3, negated: false } + - Parent: Expr(143, 1) +ELit[0140] - LiteralExpr: + - UniqueId: 93 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(143, 2) +ELit[0141] - LiteralExpr: + - UniqueId: 94 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(143, 3) +ELit[0142] - LiteralExpr: + - UniqueId: 95 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(143, 4) + - Parent: Expr(145, 1) + - Parent: MemStmt(28) + - Next: 29 +SMem[0029] - LocalMemory: + - Variable: +Var [0033] - Variable: + - Name: result_s64 + - Kind: Local + - ParserType: auto + - RelativePos: 11 + - UniqueScopeID: 11 + - InitialValue: +EAsi[0157] - AssignmentExpr: + - UniqueId: 96 + - Operation: Set + - Left: +EVar[0156] - VariableExpr: + - UniqueId: 97 + - Name: result_s64 + - Definition: Some(33) + - Parent: Expr(157, 0) + - Right: +ECll[0155] - CallExpr: + - UniqueId: 98 + - BuiltIn: false + - Variant: Function + - MethodName: slicing_magic + - ParserType: slicing_magic + - Arguments: +ECll[0150] - CallExpr: + - UniqueId: 99 + - BuiltIn: false + - Variant: Function + - MethodName: create_holder + - ParserType: create_holder + - Arguments: +ELit[0146] - LiteralExpr: + - UniqueId: 100 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(150, 0) +ELit[0147] - LiteralExpr: + - UniqueId: 101 + - Value: LiteralInteger { unsigned_value: 5, negated: false } + - Parent: Expr(150, 1) +ELit[0148] - LiteralExpr: + - UniqueId: 102 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(150, 2) +ELit[0149] - LiteralExpr: + - UniqueId: 103 + - Value: LiteralInteger { unsigned_value: 8, negated: false } + - Parent: Expr(150, 3) + - Parent: Expr(155, 0) +ELit[0151] - LiteralExpr: + - UniqueId: 104 + - Value: LiteralInteger { unsigned_value: 3, negated: false } + - Parent: Expr(155, 1) +ELit[0152] - LiteralExpr: + - UniqueId: 105 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(155, 2) +ELit[0153] - LiteralExpr: + - UniqueId: 106 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(155, 3) +ELit[0154] - LiteralExpr: + - UniqueId: 107 + - Value: LiteralInteger { unsigned_value: 2, negated: false } + - Parent: Expr(155, 4) + - Parent: Expr(157, 1) + - Parent: MemStmt(29) + - Next: 30 +SRet[0030] - Return: + - Expressions: +EBin[0236] - BinaryExpr: + - UniqueId: 108 + - Operation: LogicalAnd + - Left: +EBin[0226] - BinaryExpr: + - UniqueId: 109 + - Operation: LogicalAnd + - Left: +EBin[0216] - BinaryExpr: + - UniqueId: 110 + - Operation: LogicalAnd + - Left: +EBin[0206] - BinaryExpr: + - UniqueId: 111 + - Operation: LogicalAnd + - Left: +EBin[0196] - BinaryExpr: + - UniqueId: 112 + - Operation: LogicalAnd + - Left: +EBin[0186] - BinaryExpr: + - UniqueId: 113 + - Operation: LogicalAnd + - Left: +EBin[0176] - BinaryExpr: + - UniqueId: 114 + - Operation: LogicalAnd + - Left: +EBin[0166] - BinaryExpr: + - UniqueId: 115 + - Operation: Equality + - Left: +EBin[0164] - BinaryExpr: + - UniqueId: 116 + - Operation: Add + - Left: +EIdx[0160] - IndexingExpr: + - UniqueId: 117 + - Subject: +EVar[0158] - VariableExpr: + - UniqueId: 118 + - Name: result_u08 + - Definition: Some(26) + - Parent: Expr(160, 0) + - Index: +ELit[0159] - LiteralExpr: + - UniqueId: 119 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(160, 1) + - Parent: Expr(164, 0) + - Right: +EIdx[0163] - IndexingExpr: + - UniqueId: 120 + - Subject: +EVar[0161] - VariableExpr: + - UniqueId: 121 + - Name: result_u08 + - Definition: Some(26) + - Parent: Expr(163, 0) + - Index: +ELit[0162] - LiteralExpr: + - UniqueId: 122 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(163, 1) + - Parent: Expr(164, 1) + - Parent: Expr(166, 0) + - Right: +ELit[0165] - LiteralExpr: + - UniqueId: 123 + - Value: LiteralInteger { unsigned_value: 6, negated: false } + - Parent: Expr(166, 1) + - Parent: Expr(176, 0) + - Right: +EBin[0175] - BinaryExpr: + - UniqueId: 124 + - Operation: Equality + - Left: +EBin[0173] - BinaryExpr: + - UniqueId: 125 + - Operation: Add + - Left: +EIdx[0169] - IndexingExpr: + - UniqueId: 126 + - Subject: +EVar[0167] - VariableExpr: + - UniqueId: 127 + - Name: result_u16 + - Definition: Some(27) + - Parent: Expr(169, 0) + - Index: +ELit[0168] - LiteralExpr: + - UniqueId: 128 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(169, 1) + - Parent: Expr(173, 0) + - Right: +EIdx[0172] - IndexingExpr: + - UniqueId: 129 + - Subject: +EVar[0170] - VariableExpr: + - UniqueId: 130 + - Name: result_u16 + - Definition: Some(27) + - Parent: Expr(172, 0) + - Index: +ELit[0171] - LiteralExpr: + - UniqueId: 131 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(172, 1) + - Parent: Expr(173, 1) + - Parent: Expr(175, 0) + - Right: +ELit[0174] - LiteralExpr: + - UniqueId: 132 + - Value: LiteralInteger { unsigned_value: 6, negated: false } + - Parent: Expr(175, 1) + - Parent: Expr(176, 1) + - Parent: Expr(186, 0) + - Right: +EBin[0185] - BinaryExpr: + - UniqueId: 133 + - Operation: Equality + - Left: +EBin[0183] - BinaryExpr: + - UniqueId: 134 + - Operation: Add + - Left: +EIdx[0179] - IndexingExpr: + - UniqueId: 135 + - Subject: +EVar[0177] - VariableExpr: + - UniqueId: 136 + - Name: result_u32 + - Definition: Some(28) + - Parent: Expr(179, 0) + - Index: +ELit[0178] - LiteralExpr: + - UniqueId: 137 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(179, 1) + - Parent: Expr(183, 0) + - Right: +EIdx[0182] - IndexingExpr: + - UniqueId: 138 + - Subject: +EVar[0180] - VariableExpr: + - UniqueId: 139 + - Name: result_u32 + - Definition: Some(28) + - Parent: Expr(182, 0) + - Index: +ELit[0181] - LiteralExpr: + - UniqueId: 140 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(182, 1) + - Parent: Expr(183, 1) + - Parent: Expr(185, 0) + - Right: +ELit[0184] - LiteralExpr: + - UniqueId: 141 + - Value: LiteralInteger { unsigned_value: 6, negated: false } + - Parent: Expr(185, 1) + - Parent: Expr(186, 1) + - Parent: Expr(196, 0) + - Right: +EBin[0195] - BinaryExpr: + - UniqueId: 142 + - Operation: Equality + - Left: +EBin[0193] - BinaryExpr: + - UniqueId: 143 + - Operation: Add + - Left: +EIdx[0189] - IndexingExpr: + - UniqueId: 144 + - Subject: +EVar[0187] - VariableExpr: + - UniqueId: 145 + - Name: result_u64 + - Definition: Some(29) + - Parent: Expr(189, 0) + - Index: +ELit[0188] - LiteralExpr: + - UniqueId: 146 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(189, 1) + - Parent: Expr(193, 0) + - Right: +EIdx[0192] - IndexingExpr: + - UniqueId: 147 + - Subject: +EVar[0190] - VariableExpr: + - UniqueId: 148 + - Name: result_u64 + - Definition: Some(29) + - Parent: Expr(192, 0) + - Index: +ELit[0191] - LiteralExpr: + - UniqueId: 149 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(192, 1) + - Parent: Expr(193, 1) + - Parent: Expr(195, 0) + - Right: +ELit[0194] - LiteralExpr: + - UniqueId: 150 + - Value: LiteralInteger { unsigned_value: 6, negated: false } + - Parent: Expr(195, 1) + - Parent: Expr(196, 1) + - Parent: Expr(206, 0) + - Right: +EBin[0205] - BinaryExpr: + - UniqueId: 151 + - Operation: Equality + - Left: +EBin[0203] - BinaryExpr: + - UniqueId: 152 + - Operation: Add + - Left: +EIdx[0199] - IndexingExpr: + - UniqueId: 153 + - Subject: +EVar[0197] - VariableExpr: + - UniqueId: 154 + - Name: result_s08 + - Definition: Some(30) + - Parent: Expr(199, 0) + - Index: +ELit[0198] - LiteralExpr: + - UniqueId: 155 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(199, 1) + - Parent: Expr(203, 0) + - Right: +EIdx[0202] - IndexingExpr: + - UniqueId: 156 + - Subject: +EVar[0200] - VariableExpr: + - UniqueId: 157 + - Name: result_s08 + - Definition: Some(30) + - Parent: Expr(202, 0) + - Index: +ELit[0201] - LiteralExpr: + - UniqueId: 158 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(202, 1) + - Parent: Expr(203, 1) + - Parent: Expr(205, 0) + - Right: +ELit[0204] - LiteralExpr: + - UniqueId: 159 + - Value: LiteralInteger { unsigned_value: 6, negated: false } + - Parent: Expr(205, 1) + - Parent: Expr(206, 1) + - Parent: Expr(216, 0) + - Right: +EBin[0215] - BinaryExpr: + - UniqueId: 160 + - Operation: Equality + - Left: +EBin[0213] - BinaryExpr: + - UniqueId: 161 + - Operation: Add + - Left: +EIdx[0209] - IndexingExpr: + - UniqueId: 162 + - Subject: +EVar[0207] - VariableExpr: + - UniqueId: 163 + - Name: result_s16 + - Definition: Some(31) + - Parent: Expr(209, 0) + - Index: +ELit[0208] - LiteralExpr: + - UniqueId: 164 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(209, 1) + - Parent: Expr(213, 0) + - Right: +EIdx[0212] - IndexingExpr: + - UniqueId: 165 + - Subject: +EVar[0210] - VariableExpr: + - UniqueId: 166 + - Name: result_s16 + - Definition: Some(31) + - Parent: Expr(212, 0) + - Index: +ELit[0211] - LiteralExpr: + - UniqueId: 167 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(212, 1) + - Parent: Expr(213, 1) + - Parent: Expr(215, 0) + - Right: +ELit[0214] - LiteralExpr: + - UniqueId: 168 + - Value: LiteralInteger { unsigned_value: 6, negated: false } + - Parent: Expr(215, 1) + - Parent: Expr(216, 1) + - Parent: Expr(226, 0) + - Right: +EBin[0225] - BinaryExpr: + - UniqueId: 169 + - Operation: Equality + - Left: +EBin[0223] - BinaryExpr: + - UniqueId: 170 + - Operation: Add + - Left: +EIdx[0219] - IndexingExpr: + - UniqueId: 171 + - Subject: +EVar[0217] - VariableExpr: + - UniqueId: 172 + - Name: result_s32 + - Definition: Some(32) + - Parent: Expr(219, 0) + - Index: +ELit[0218] - LiteralExpr: + - UniqueId: 173 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(219, 1) + - Parent: Expr(223, 0) + - Right: +EIdx[0222] - IndexingExpr: + - UniqueId: 174 + - Subject: +EVar[0220] - VariableExpr: + - UniqueId: 175 + - Name: result_s32 + - Definition: Some(32) + - Parent: Expr(222, 0) + - Index: +ELit[0221] - LiteralExpr: + - UniqueId: 176 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(222, 1) + - Parent: Expr(223, 1) + - Parent: Expr(225, 0) + - Right: +ELit[0224] - LiteralExpr: + - UniqueId: 177 + - Value: LiteralInteger { unsigned_value: 6, negated: false } + - Parent: Expr(225, 1) + - Parent: Expr(226, 1) + - Parent: Expr(236, 0) + - Right: +EBin[0235] - BinaryExpr: + - UniqueId: 178 + - Operation: Equality + - Left: +EBin[0233] - BinaryExpr: + - UniqueId: 179 + - Operation: Add + - Left: +EIdx[0229] - IndexingExpr: + - UniqueId: 180 + - Subject: +EVar[0227] - VariableExpr: + - UniqueId: 181 + - Name: result_s64 + - Definition: Some(33) + - Parent: Expr(229, 0) + - Index: +ELit[0228] - LiteralExpr: + - UniqueId: 182 + - Value: LiteralInteger { unsigned_value: 0, negated: false } + - Parent: Expr(229, 1) + - Parent: Expr(233, 0) + - Right: +EIdx[0232] - IndexingExpr: + - UniqueId: 183 + - Subject: +EVar[0230] - VariableExpr: + - UniqueId: 184 + - Name: result_s64 + - Definition: Some(33) + - Parent: Expr(232, 0) + - Index: +ELit[0231] - LiteralExpr: + - UniqueId: 185 + - Value: LiteralInteger { unsigned_value: 1, negated: false } + - Parent: Expr(232, 1) + - Parent: Expr(233, 1) + - Parent: Expr(235, 0) + - Right: +ELit[0234] - LiteralExpr: + - UniqueId: 186 + - Value: LiteralInteger { unsigned_value: 6, negated: false } + - Parent: Expr(235, 1) + - Parent: Expr(236, 1) + - Parent: ReturnStmt(30) diff --git a/src/protocol/ast_printer.rs b/src/protocol/ast_printer.rs index ef616a9504825f992232a4087d7898e01352722f..67f99b1686f2b8397b4f6e911ab8f9312f1feee1 100644 --- a/src/protocol/ast_printer.rs +++ b/src/protocol/ast_printer.rs @@ -591,6 +591,7 @@ impl ASTWriter { Expression::Assignment(expr) => { self.kv(indent).with_id(PREFIX_ASSIGNMENT_EXPR_ID, expr.this.0.index) .with_s_key("AssignmentExpr"); + self.kv(indent2).with_s_key("UniqueId").with_disp_val(&expr.unique_id_in_definition); self.kv(indent2).with_s_key("Operation").with_debug_val(&expr.operation); self.kv(indent2).with_s_key("Left"); self.write_expr(heap, expr.left, indent3); @@ -602,6 +603,7 @@ impl ASTWriter { Expression::Binding(expr) => { self.kv(indent).with_id(PREFIX_BINARY_EXPR_ID, expr.this.0.index) .with_s_key("BindingExpr"); + self.kv(indent2).with_s_key("UniqueId").with_disp_val(&expr.unique_id_in_definition); self.kv(indent2).with_s_key("BindToExpression"); self.write_expr(heap, expr.bound_to, indent3); self.kv(indent2).with_s_key("BindFromExpression"); @@ -612,6 +614,7 @@ impl ASTWriter { Expression::Conditional(expr) => { self.kv(indent).with_id(PREFIX_CONDITIONAL_EXPR_ID, expr.this.0.index) .with_s_key("ConditionalExpr"); + self.kv(indent2).with_s_key("UniqueId").with_disp_val(&expr.unique_id_in_definition); self.kv(indent2).with_s_key("Condition"); self.write_expr(heap, expr.test, indent3); self.kv(indent2).with_s_key("TrueExpression"); @@ -624,6 +627,7 @@ impl ASTWriter { Expression::Binary(expr) => { self.kv(indent).with_id(PREFIX_BINARY_EXPR_ID, expr.this.0.index) .with_s_key("BinaryExpr"); + self.kv(indent2).with_s_key("UniqueId").with_disp_val(&expr.unique_id_in_definition); self.kv(indent2).with_s_key("Operation").with_debug_val(&expr.operation); self.kv(indent2).with_s_key("Left"); self.write_expr(heap, expr.left, indent3); @@ -635,6 +639,7 @@ impl ASTWriter { Expression::Unary(expr) => { self.kv(indent).with_id(PREFIX_UNARY_EXPR_ID, expr.this.0.index) .with_s_key("UnaryExpr"); + self.kv(indent2).with_s_key("UniqueId").with_disp_val(&expr.unique_id_in_definition); self.kv(indent2).with_s_key("Operation").with_debug_val(&expr.operation); self.kv(indent2).with_s_key("Argument"); self.write_expr(heap, expr.expression, indent3); @@ -644,6 +649,7 @@ impl ASTWriter { Expression::Indexing(expr) => { self.kv(indent).with_id(PREFIX_INDEXING_EXPR_ID, expr.this.0.index) .with_s_key("IndexingExpr"); + self.kv(indent2).with_s_key("UniqueId").with_disp_val(&expr.unique_id_in_definition); self.kv(indent2).with_s_key("Subject"); self.write_expr(heap, expr.subject, indent3); self.kv(indent2).with_s_key("Index"); @@ -654,6 +660,7 @@ impl ASTWriter { Expression::Slicing(expr) => { self.kv(indent).with_id(PREFIX_SLICING_EXPR_ID, expr.this.0.index) .with_s_key("SlicingExpr"); + self.kv(indent2).with_s_key("UniqueId").with_disp_val(&expr.unique_id_in_definition); self.kv(indent2).with_s_key("Subject"); self.write_expr(heap, expr.subject, indent3); self.kv(indent2).with_s_key("FromIndex"); @@ -666,6 +673,7 @@ impl ASTWriter { Expression::Select(expr) => { self.kv(indent).with_id(PREFIX_SELECT_EXPR_ID, expr.this.0.index) .with_s_key("SelectExpr"); + self.kv(indent2).with_s_key("UniqueId").with_disp_val(&expr.unique_id_in_definition); self.kv(indent2).with_s_key("Subject"); self.write_expr(heap, expr.subject, indent3); @@ -685,6 +693,7 @@ impl ASTWriter { self.kv(indent).with_id(PREFIX_LITERAL_EXPR_ID, expr.this.0.index) .with_s_key("LiteralExpr"); + self.kv(indent2).with_s_key("UniqueId").with_disp_val(&expr.unique_id_in_definition); let val = self.kv(indent2).with_s_key("Value"); match &expr.value { Literal::Null => { val.with_s_val("null"); }, @@ -760,6 +769,7 @@ impl ASTWriter { Expression::Cast(expr) => { self.kv(indent).with_id(PREFIX_CAST_EXPR_ID, expr.this.0.index) .with_s_key("CallExpr"); + self.kv(indent2).with_s_key("UniqueId").with_disp_val(&expr.unique_id_in_definition); self.kv(indent2).with_s_key("ToType") .with_custom_val(|t| write_parser_type(t, heap, &expr.to_type)); self.kv(indent2).with_s_key("Subject"); @@ -771,6 +781,7 @@ impl ASTWriter { self.kv(indent).with_id(PREFIX_CALL_EXPR_ID, expr.this.0.index) .with_s_key("CallExpr"); + self.kv(indent2).with_s_key("UniqueId").with_disp_val(&expr.unique_id_in_definition); let definition = &heap[expr.definition]; match definition { Definition::Component(definition) => { @@ -800,6 +811,7 @@ impl ASTWriter { Expression::Variable(expr) => { self.kv(indent).with_id(PREFIX_VARIABLE_EXPR_ID, expr.this.0.index) .with_s_key("VariableExpr"); + self.kv(indent2).with_s_key("UniqueId").with_disp_val(&expr.unique_id_in_definition); self.kv(indent2).with_s_key("Name").with_identifier_val(&expr.identifier); self.kv(indent2).with_s_key("Definition") .with_opt_disp_val(expr.declaration.as_ref().map(|v| &v.index)); diff --git a/src/protocol/parser/type_table.rs b/src/protocol/parser/type_table.rs index d44a4f7b45d41f6ec57a0570073bc28c40a86d28..97feb153fed8dacc202aa2241ae3e217899818c7 100644 --- a/src/protocol/parser/type_table.rs +++ b/src/protocol/parser/type_table.rs @@ -440,8 +440,8 @@ impl MonoSearchKey { /// after calling this function fn set_top_type(&mut self, type_part: ConcreteTypePart) { self.parts.clear(); - self.parts.push((self.change_bit | Self::KEY_IN_USE, type_part)); - self.change_bit ^= Self::KEY_CHANGE_BIT; + self.parts.push((Self::KEY_IN_USE, type_part)); + self.change_bit = Self::KEY_CHANGE_BIT; } fn push_subtype(&mut self, concrete_type: &[ConcreteTypePart], in_use: bool) { @@ -488,7 +488,7 @@ impl MonoSearchKey { index += 1; } - return self.parts.len(); + return index; } } @@ -533,7 +533,7 @@ impl PartialEq for MonoSearchKey { for _ in 0..delta_self { let (_, self_part) = self.parts[self_index]; - let (_, other_part) = self.parts[other_index]; + let (_, other_part) = other.parts[other_index]; if self_part != other_part { return false; @@ -729,6 +729,7 @@ impl TypeTable { pub(crate) fn get_procedure_monomorph_type_id(&self, definition_id: &DefinitionId, type_parts: &[ConcreteTypePart]) -> Option { // Cannot use internal search key due to mutability issues. But this // method should end up being deprecated at some point anyway. + debug_assert_eq!(get_concrete_type_definition(type_parts).unwrap(), *definition_id); let base_type = self.definition_lookup.get(definition_id).unwrap(); let mut search_key = MonoSearchKey::with_capacity(type_parts.len()); search_key.set(type_parts, &base_type.poly_vars); @@ -761,6 +762,7 @@ impl TypeTable { /// going to be performing typechecking on it, and we don't want to /// check the same monomorph twice) pub(crate) fn reserve_procedure_monomorph_type_id(&mut self, definition_id: &DefinitionId, concrete_type: ConcreteType) -> TypeId { + debug_assert_eq!(get_concrete_type_definition(&concrete_type.parts).unwrap(), *definition_id); let type_id = TypeId(self.mono_types.len() as i64); let base_type = self.definition_lookup.get_mut(definition_id).unwrap(); self.mono_search_key.set(&concrete_type.parts, &base_type.poly_vars);