diff --git a/driver/normalizer/annotation.go b/driver/normalizer/annotation.go index 238e986d..4985e1c8 100644 --- a/driver/normalizer/annotation.go +++ b/driver/normalizer/annotation.go @@ -262,8 +262,9 @@ var AnnotationRules = On(Any).Self( // "If that sounds awkward is because it is" (their words) On(HasInternalType(pyast.If)).Roles(If).Children( On(HasInternalType("If.body")).Roles(IfBody), + On(HasInternalRole("test")).Roles(IfCondition), On(HasInternalType("If.orelse")).Roles(IfElse), - On(HasInternalType(pyast.Compare)).Roles(IfCondition, BinaryExpression).Children( + On(HasInternalType(pyast.Compare)).Roles(BinaryExpression).Children( On(HasInternalType("Compare.ops")).Roles(BinaryExpressionOp), On(HasInternalType("Compare.comparators")).Roles(BinaryExpressionRight), On(HasInternalRole("left")).Roles(BinaryExpressionLeft), diff --git a/tests/if.py.native b/tests/if.py.native index ffba2524..52b6f62b 100644 --- a/tests/if.py.native +++ b/tests/if.py.native @@ -9,16 +9,118 @@ "ast_type": "If", "body": [ { - "ast_type": "Assign", + "ast_type": "Expr", "col_offset": 5, "lineno": 2, + "value": { + "args": [ + { + "LiteralValue": true, + "ast_type": "BoolLiteral", + "col_offset": 11, + "lineno": 2 + } + ], + "ast_type": "Call", + "col_offset": 5, + "func": { + "ast_type": "Name", + "col_offset": 5, + "ctx": "Load", + "id": "print", + "lineno": 2 + }, + "keywords": [], + "lineno": 2 + } + } + ], + "col_offset": 1, + "lineno": 1, + "orelse": [], + "test": { + "LiteralValue": true, + "ast_type": "BoolLiteral", + "col_offset": 4, + "lineno": 1 + } + }, + { + "ast_type": "If", + "body": [ + { + "ast_type": "Expr", + "col_offset": 5, + "lineno": 5, + "value": { + "args": [ + { + "LiteralValue": true, + "ast_type": "BoolLiteral", + "col_offset": 11, + "lineno": 5 + } + ], + "ast_type": "Call", + "col_offset": 5, + "func": { + "ast_type": "Name", + "col_offset": 5, + "ctx": "Load", + "id": "print", + "lineno": 5 + }, + "keywords": [], + "lineno": 5 + } + } + ], + "col_offset": 1, + "lineno": 4, + "orelse": [], + "test": { + "args": [], + "ast_type": "Call", + "col_offset": 4, + "func": { + "ast_type": "Name", + "col_offset": 4, + "ctx": "Load", + "id": "functionCall", + "lineno": 4, + "noops_previous": { + "ast_type": "PreviousNoops", + "col_offset": 1, + "end_lineno": 3, + "lineno": 3, + "lines": [ + { + "ast_type": "NoopLine", + "col_offset": 1, + "lineno": 3, + "noop_line": "\n" + } + ] + } + }, + "keywords": [], + "lineno": 4 + } + }, + { + "ast_type": "If", + "body": [ + { + "ast_type": "Assign", + "col_offset": 5, + "lineno": 8, "targets": [ { "ast_type": "Name", "col_offset": 5, "ctx": "Store", "id": "a", - "lineno": 2 + "lineno": 8 } ], "value": { @@ -26,20 +128,20 @@ "NumType": "float", "ast_type": "NumLiteral", "col_offset": 9, - "lineno": 2 + "lineno": 8 } }, { "ast_type": "Assign", "col_offset": 5, - "lineno": 3, + "lineno": 9, "targets": [ { "ast_type": "Name", "col_offset": 5, "ctx": "Store", "id": "x", - "lineno": 3 + "lineno": 9 } ], "value": { @@ -47,12 +149,12 @@ "NumType": "float", "ast_type": "NumLiteral", "col_offset": 9, - "lineno": 3 + "lineno": 9 } } ], "col_offset": 1, - "lineno": 1, + "lineno": 7, "orelse": [ { "ast_type": "If", @@ -60,14 +162,14 @@ { "ast_type": "Assign", "col_offset": 5, - "lineno": 5, + "lineno": 11, "targets": [ { "ast_type": "Name", "col_offset": 5, "ctx": "Store", "id": "c", - "lineno": 5 + "lineno": 11 } ], "value": { @@ -75,20 +177,20 @@ "NumType": "float", "ast_type": "NumLiteral", "col_offset": 9, - "lineno": 5 + "lineno": 11 } }, { "ast_type": "Assign", "col_offset": 5, - "lineno": 6, + "lineno": 12, "targets": [ { "ast_type": "Name", "col_offset": 5, "ctx": "Store", "id": "j", - "lineno": 6 + "lineno": 12 } ], "value": { @@ -96,24 +198,24 @@ "NumType": "float", "ast_type": "NumLiteral", "col_offset": 9, - "lineno": 6 + "lineno": 12 } } ], "col_offset": 6, - "lineno": 4, + "lineno": 10, "orelse": [ { "ast_type": "Assign", "col_offset": 5, - "lineno": 8, + "lineno": 14, "targets": [ { "ast_type": "Name", "col_offset": 5, "ctx": "Store", "id": "b", - "lineno": 8 + "lineno": 14 } ], "value": { @@ -121,20 +223,20 @@ "NumType": "float", "ast_type": "NumLiteral", "col_offset": 9, - "lineno": 8 + "lineno": 14 } }, { "ast_type": "Assign", "col_offset": 5, - "lineno": 9, + "lineno": 15, "targets": [ { "ast_type": "Name", "col_offset": 5, "ctx": "Store", "id": "p", - "lineno": 9 + "lineno": 15 } ], "value": { @@ -142,7 +244,7 @@ "NumType": "float", "ast_type": "NumLiteral", "col_offset": 9, - "lineno": 9 + "lineno": 15 } } ], @@ -155,7 +257,7 @@ "col_offset": 11, "ctx": "Load", "id": "c", - "lineno": 4 + "lineno": 10 } ], "left": { @@ -163,13 +265,13 @@ "col_offset": 6, "ctx": "Load", "id": "b", - "lineno": 4 + "lineno": 10 }, - "lineno": 4, + "lineno": 10, "ops": [ { "ast_type": "Eq", - "lineno": 4 + "lineno": 10 } ] } @@ -184,7 +286,7 @@ "col_offset": 8, "ctx": "Load", "id": "b", - "lineno": 1 + "lineno": 7 } ], "left": { @@ -192,13 +294,27 @@ "col_offset": 4, "ctx": "Load", "id": "a", - "lineno": 1 + "lineno": 7, + "noops_previous": { + "ast_type": "PreviousNoops", + "col_offset": 1, + "end_lineno": 6, + "lineno": 6, + "lines": [ + { + "ast_type": "NoopLine", + "col_offset": 1, + "lineno": 6, + "noop_line": "\n" + } + ] + } }, - "lineno": 1, + "lineno": 7, "ops": [ { "ast_type": "Gt", - "lineno": 1 + "lineno": 7 } ] } @@ -209,11 +325,11 @@ { "ast_type": "Pass", "col_offset": 5, - "lineno": 12 + "lineno": 18 } ], "col_offset": 1, - "lineno": 11, + "lineno": 17, "orelse": [], "test": { "ast_type": "Compare", @@ -224,21 +340,21 @@ "col_offset": 8, "ctx": "Load", "id": "b", - "lineno": 11 + "lineno": 17 }, { "ast_type": "Name", "col_offset": 12, "ctx": "Load", "id": "c", - "lineno": 11 + "lineno": 17 }, { "ast_type": "Name", "col_offset": 16, "ctx": "Load", "id": "d", - "lineno": 11 + "lineno": 17 } ], "left": { @@ -246,35 +362,35 @@ "col_offset": 4, "ctx": "Load", "id": "a", - "lineno": 11, + "lineno": 17, "noops_previous": { "ast_type": "PreviousNoops", "col_offset": 1, - "end_lineno": 10, - "lineno": 10, + "end_lineno": 16, + "lineno": 16, "lines": [ { "ast_type": "NoopLine", "col_offset": 1, - "lineno": 10, + "lineno": 16, "noop_line": "\n" } ] } }, - "lineno": 11, + "lineno": 17, "ops": [ { "ast_type": "Gt", - "lineno": 11 + "lineno": 17 }, { "ast_type": "Gt", - "lineno": 11 + "lineno": 17 }, { "ast_type": "Gt", - "lineno": 11 + "lineno": 17 } ] } diff --git a/tests/if.py.source b/tests/if.py.source index 256eaf1c..10b6bc70 100644 --- a/tests/if.py.source +++ b/tests/if.py.source @@ -1,3 +1,9 @@ +if True: + print(True) + +if functionCall(): + print(True) + if a > b: a = 1.1 x = 1.2 diff --git a/tests/if.py.uast b/tests/if.py.uast index 068cc830..2386d270 100644 --- a/tests/if.py.uast +++ b/tests/if.py.uast @@ -26,11 +26,216 @@ Module { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { +. . . . . . 0: Expr { +. . . . . . . Roles: Expression +. . . . . . . StartPosition: { +. . . . . . . . Offset: 0 +. . . . . . . . Line: 2 +. . . . . . . . Col: 5 +. . . . . . . } +. . . . . . . Children: { +. . . . . . . . 0: Call { +. . . . . . . . . Roles: Call +. . . . . . . . . StartPosition: { +. . . . . . . . . . Offset: 0 +. . . . . . . . . . Line: 2 +. . . . . . . . . . Col: 5 +. . . . . . . . . } +. . . . . . . . . Properties: { +. . . . . . . . . . internalRole: value +. . . . . . . . . } +. . . . . . . . . Children: { +. . . . . . . . . . 0: BoolLiteral { +. . . . . . . . . . . Roles: BooleanLiteral,CallPositionalArgument +. . . . . . . . . . . TOKEN "true" +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 0 +. . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . Col: 11 +. . . . . . . . . . . } +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . internalRole: args +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . . 1: Name { +. . . . . . . . . . . Roles: CallCallee,CallCallee,SimpleIdentifier +. . . . . . . . . . . TOKEN "print" +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 0 +. . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . Col: 5 +. . . . . . . . . . . } +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . ctx: Load +. . . . . . . . . . . . internalRole: func +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . } +. . . . . . . . } +. . . . . . . } +. . . . . . } +. . . . . } +. . . . } +. . . . 1: BoolLiteral { +. . . . . Roles: BooleanLiteral,IfCondition +. . . . . TOKEN "true" +. . . . . StartPosition: { +. . . . . . Offset: 0 +. . . . . . Line: 1 +. . . . . . Col: 4 +. . . . . } +. . . . . Properties: { +. . . . . . internalRole: test +. . . . . } +. . . . } +. . . } +. . } +. . 1: If { +. . . Roles: If +. . . StartPosition: { +. . . . Offset: 0 +. . . . Line: 4 +. . . . Col: 1 +. . . } +. . . Properties: { +. . . . internalRole: body +. . . } +. . . Children: { +. . . . 0: If.body { +. . . . . Roles: IfBody +. . . . . Properties: { +. . . . . . promotedPropertyList: true +. . . . . } +. . . . . Children: { +. . . . . . 0: Expr { +. . . . . . . Roles: Expression +. . . . . . . StartPosition: { +. . . . . . . . Offset: 0 +. . . . . . . . Line: 5 +. . . . . . . . Col: 5 +. . . . . . . } +. . . . . . . Children: { +. . . . . . . . 0: Call { +. . . . . . . . . Roles: Call +. . . . . . . . . StartPosition: { +. . . . . . . . . . Offset: 0 +. . . . . . . . . . Line: 5 +. . . . . . . . . . Col: 5 +. . . . . . . . . } +. . . . . . . . . Properties: { +. . . . . . . . . . internalRole: value +. . . . . . . . . } +. . . . . . . . . Children: { +. . . . . . . . . . 0: BoolLiteral { +. . . . . . . . . . . Roles: BooleanLiteral,CallPositionalArgument +. . . . . . . . . . . TOKEN "true" +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 0 +. . . . . . . . . . . . Line: 5 +. . . . . . . . . . . . Col: 11 +. . . . . . . . . . . } +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . internalRole: args +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . . 1: Name { +. . . . . . . . . . . Roles: CallCallee,CallCallee,SimpleIdentifier +. . . . . . . . . . . TOKEN "print" +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 0 +. . . . . . . . . . . . Line: 5 +. . . . . . . . . . . . Col: 5 +. . . . . . . . . . . } +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . ctx: Load +. . . . . . . . . . . . internalRole: func +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . } +. . . . . . . . } +. . . . . . . } +. . . . . . } +. . . . . } +. . . . } +. . . . 1: Call { +. . . . . Roles: Call,IfCondition +. . . . . StartPosition: { +. . . . . . Offset: 0 +. . . . . . Line: 4 +. . . . . . Col: 4 +. . . . . } +. . . . . Properties: { +. . . . . . internalRole: test +. . . . . } +. . . . . Children: { +. . . . . . 0: Name { +. . . . . . . Roles: CallCallee,CallCallee,SimpleIdentifier +. . . . . . . TOKEN "functionCall" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 0 +. . . . . . . . Line: 4 +. . . . . . . . Col: 4 +. . . . . . . } +. . . . . . . Properties: { +. . . . . . . . ctx: Load +. . . . . . . . internalRole: func +. . . . . . . } +. . . . . . . Children: { +. . . . . . . . 0: PreviousNoops { +. . . . . . . . . Roles: Whitespace +. . . . . . . . . StartPosition: { +. . . . . . . . . . Offset: 0 +. . . . . . . . . . Line: 3 +. . . . . . . . . . Col: 1 +. . . . . . . . . } +. . . . . . . . . Properties: { +. . . . . . . . . . end_lineno: 3 +. . . . . . . . . . internalRole: noops_previous +. . . . . . . . . } +. . . . . . . . . Children: { +. . . . . . . . . . 0: NoopLine { +. . . . . . . . . . . Roles: Comment +. . . . . . . . . . . TOKEN " +" +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 0 +. . . . . . . . . . . . Line: 3 +. . . . . . . . . . . . Col: 1 +. . . . . . . . . . . } +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . internalRole: lines +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . } +. . . . . . . . } +. . . . . . . } +. . . . . . } +. . . . . } +. . . . } +. . . } +. . } +. . 2: If { +. . . Roles: If +. . . StartPosition: { +. . . . Offset: 0 +. . . . Line: 7 +. . . . Col: 1 +. . . } +. . . Properties: { +. . . . internalRole: body +. . . } +. . . Children: { +. . . . 0: If.body { +. . . . . Roles: IfBody +. . . . . Properties: { +. . . . . . promotedPropertyList: true +. . . . . } +. . . . . Children: { . . . . . . 0: Assign { . . . . . . . Roles: Assignment . . . . . . . StartPosition: { . . . . . . . . Offset: 0 -. . . . . . . . Line: 2 +. . . . . . . . Line: 8 . . . . . . . . Col: 5 . . . . . . . } . . . . . . . Children: { @@ -39,7 +244,7 @@ Module { . . . . . . . . . TOKEN "a" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 -. . . . . . . . . . Line: 2 +. . . . . . . . . . Line: 8 . . . . . . . . . . Col: 5 . . . . . . . . . } . . . . . . . . . Properties: { @@ -52,7 +257,7 @@ Module { . . . . . . . . . TOKEN "1.1" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 -. . . . . . . . . . Line: 2 +. . . . . . . . . . Line: 8 . . . . . . . . . . Col: 9 . . . . . . . . . } . . . . . . . . . Properties: { @@ -66,7 +271,7 @@ Module { . . . . . . . Roles: Assignment . . . . . . . StartPosition: { . . . . . . . . Offset: 0 -. . . . . . . . Line: 3 +. . . . . . . . Line: 9 . . . . . . . . Col: 5 . . . . . . . } . . . . . . . Children: { @@ -75,7 +280,7 @@ Module { . . . . . . . . . TOKEN "x" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 -. . . . . . . . . . Line: 3 +. . . . . . . . . . Line: 9 . . . . . . . . . . Col: 5 . . . . . . . . . } . . . . . . . . . Properties: { @@ -88,7 +293,7 @@ Module { . . . . . . . . . TOKEN "1.2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 -. . . . . . . . . . Line: 3 +. . . . . . . . . . Line: 9 . . . . . . . . . . Col: 9 . . . . . . . . . } . . . . . . . . . Properties: { @@ -110,7 +315,7 @@ Module { . . . . . . . Roles: If . . . . . . . StartPosition: { . . . . . . . . Offset: 0 -. . . . . . . . Line: 4 +. . . . . . . . Line: 10 . . . . . . . . Col: 6 . . . . . . . } . . . . . . . Children: { @@ -124,7 +329,7 @@ Module { . . . . . . . . . . . Roles: Assignment . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . Line: 5 +. . . . . . . . . . . . Line: 11 . . . . . . . . . . . . Col: 5 . . . . . . . . . . . } . . . . . . . . . . . Children: { @@ -133,7 +338,7 @@ Module { . . . . . . . . . . . . . TOKEN "c" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . . . Line: 5 +. . . . . . . . . . . . . . Line: 11 . . . . . . . . . . . . . . Col: 5 . . . . . . . . . . . . . } . . . . . . . . . . . . . Properties: { @@ -146,7 +351,7 @@ Module { . . . . . . . . . . . . . TOKEN "2.1" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . . . Line: 5 +. . . . . . . . . . . . . . Line: 11 . . . . . . . . . . . . . . Col: 9 . . . . . . . . . . . . . } . . . . . . . . . . . . . Properties: { @@ -160,7 +365,7 @@ Module { . . . . . . . . . . . Roles: Assignment . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . Line: 6 +. . . . . . . . . . . . Line: 12 . . . . . . . . . . . . Col: 5 . . . . . . . . . . . } . . . . . . . . . . . Children: { @@ -169,7 +374,7 @@ Module { . . . . . . . . . . . . . TOKEN "j" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . . . Line: 6 +. . . . . . . . . . . . . . Line: 12 . . . . . . . . . . . . . . Col: 5 . . . . . . . . . . . . . } . . . . . . . . . . . . . Properties: { @@ -182,7 +387,7 @@ Module { . . . . . . . . . . . . . TOKEN "2.2" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . . . Line: 6 +. . . . . . . . . . . . . . Line: 12 . . . . . . . . . . . . . . Col: 9 . . . . . . . . . . . . . } . . . . . . . . . . . . . Properties: { @@ -204,7 +409,7 @@ Module { . . . . . . . . . . . Roles: Assignment . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . Line: 8 +. . . . . . . . . . . . Line: 14 . . . . . . . . . . . . Col: 5 . . . . . . . . . . . } . . . . . . . . . . . Children: { @@ -213,7 +418,7 @@ Module { . . . . . . . . . . . . . TOKEN "b" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . . . Line: 8 +. . . . . . . . . . . . . . Line: 14 . . . . . . . . . . . . . . Col: 5 . . . . . . . . . . . . . } . . . . . . . . . . . . . Properties: { @@ -226,7 +431,7 @@ Module { . . . . . . . . . . . . . TOKEN "3.1" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . . . Line: 8 +. . . . . . . . . . . . . . Line: 14 . . . . . . . . . . . . . . Col: 9 . . . . . . . . . . . . . } . . . . . . . . . . . . . Properties: { @@ -240,7 +445,7 @@ Module { . . . . . . . . . . . Roles: Assignment . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . Line: 9 +. . . . . . . . . . . . Line: 15 . . . . . . . . . . . . Col: 5 . . . . . . . . . . . } . . . . . . . . . . . Children: { @@ -249,7 +454,7 @@ Module { . . . . . . . . . . . . . TOKEN "p" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . . . Line: 9 +. . . . . . . . . . . . . . Line: 15 . . . . . . . . . . . . . . Col: 5 . . . . . . . . . . . . . } . . . . . . . . . . . . . Properties: { @@ -262,7 +467,7 @@ Module { . . . . . . . . . . . . . TOKEN "3.2" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . . . Line: 9 +. . . . . . . . . . . . . . Line: 15 . . . . . . . . . . . . . . Col: 9 . . . . . . . . . . . . . } . . . . . . . . . . . . . Properties: { @@ -278,7 +483,7 @@ Module { . . . . . . . . . Roles: IfCondition,BinaryExpression . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 -. . . . . . . . . . Line: 4 +. . . . . . . . . . Line: 10 . . . . . . . . . . Col: 6 . . . . . . . . . } . . . . . . . . . Properties: { @@ -296,7 +501,7 @@ Module { . . . . . . . . . . . . . TOKEN "c" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . . . Line: 4 +. . . . . . . . . . . . . . Line: 10 . . . . . . . . . . . . . . Col: 11 . . . . . . . . . . . . . } . . . . . . . . . . . . . Properties: { @@ -310,7 +515,7 @@ Module { . . . . . . . . . . . TOKEN "b" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . Line: 4 +. . . . . . . . . . . . Line: 10 . . . . . . . . . . . . Col: 6 . . . . . . . . . . . } . . . . . . . . . . . Properties: { @@ -329,7 +534,7 @@ Module { . . . . . . . . . . . . . TOKEN "==" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . . . Line: 4 +. . . . . . . . . . . . . . Line: 10 . . . . . . . . . . . . . . Col: 0 . . . . . . . . . . . . . } . . . . . . . . . . . . } @@ -345,7 +550,7 @@ Module { . . . . . Roles: IfCondition,BinaryExpression . . . . . StartPosition: { . . . . . . Offset: 0 -. . . . . . Line: 1 +. . . . . . Line: 7 . . . . . . Col: 4 . . . . . } . . . . . Properties: { @@ -363,7 +568,7 @@ Module { . . . . . . . . . TOKEN "b" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 -. . . . . . . . . . Line: 1 +. . . . . . . . . . Line: 7 . . . . . . . . . . Col: 8 . . . . . . . . . } . . . . . . . . . Properties: { @@ -377,13 +582,42 @@ Module { . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 0 -. . . . . . . . Line: 1 +. . . . . . . . Line: 7 . . . . . . . . Col: 4 . . . . . . . } . . . . . . . Properties: { . . . . . . . . ctx: Load . . . . . . . . internalRole: left . . . . . . . } +. . . . . . . Children: { +. . . . . . . . 0: PreviousNoops { +. . . . . . . . . Roles: Whitespace +. . . . . . . . . StartPosition: { +. . . . . . . . . . Offset: 0 +. . . . . . . . . . Line: 6 +. . . . . . . . . . Col: 1 +. . . . . . . . . } +. . . . . . . . . Properties: { +. . . . . . . . . . end_lineno: 6 +. . . . . . . . . . internalRole: noops_previous +. . . . . . . . . } +. . . . . . . . . Children: { +. . . . . . . . . . 0: NoopLine { +. . . . . . . . . . . Roles: Comment +. . . . . . . . . . . TOKEN " +" +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 0 +. . . . . . . . . . . . Line: 6 +. . . . . . . . . . . . Col: 1 +. . . . . . . . . . . } +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . internalRole: lines +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . } +. . . . . . . . } +. . . . . . . } . . . . . . } . . . . . . 2: Compare.ops { . . . . . . . Roles: BinaryExpressionOp @@ -396,7 +630,7 @@ Module { . . . . . . . . . TOKEN ">" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 -. . . . . . . . . . Line: 1 +. . . . . . . . . . Line: 7 . . . . . . . . . . Col: 0 . . . . . . . . . } . . . . . . . . } @@ -406,11 +640,11 @@ Module { . . . . } . . . } . . } -. . 1: If { +. . 3: If { . . . Roles: If . . . StartPosition: { . . . . Offset: 0 -. . . . Line: 11 +. . . . Line: 17 . . . . Col: 1 . . . } . . . Properties: { @@ -427,7 +661,7 @@ Module { . . . . . . . Roles: Noop . . . . . . . StartPosition: { . . . . . . . . Offset: 0 -. . . . . . . . Line: 12 +. . . . . . . . Line: 18 . . . . . . . . Col: 5 . . . . . . . } . . . . . . } @@ -437,7 +671,7 @@ Module { . . . . . Roles: IfCondition,BinaryExpression . . . . . StartPosition: { . . . . . . Offset: 0 -. . . . . . Line: 11 +. . . . . . Line: 17 . . . . . . Col: 4 . . . . . } . . . . . Properties: { @@ -455,7 +689,7 @@ Module { . . . . . . . . . TOKEN "b" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 -. . . . . . . . . . Line: 11 +. . . . . . . . . . Line: 17 . . . . . . . . . . Col: 8 . . . . . . . . . } . . . . . . . . . Properties: { @@ -467,7 +701,7 @@ Module { . . . . . . . . . TOKEN "c" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 -. . . . . . . . . . Line: 11 +. . . . . . . . . . Line: 17 . . . . . . . . . . Col: 12 . . . . . . . . . } . . . . . . . . . Properties: { @@ -479,7 +713,7 @@ Module { . . . . . . . . . TOKEN "d" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 -. . . . . . . . . . Line: 11 +. . . . . . . . . . Line: 17 . . . . . . . . . . Col: 16 . . . . . . . . . } . . . . . . . . . Properties: { @@ -493,7 +727,7 @@ Module { . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 0 -. . . . . . . . Line: 11 +. . . . . . . . Line: 17 . . . . . . . . Col: 4 . . . . . . . } . . . . . . . Properties: { @@ -505,11 +739,11 @@ Module { . . . . . . . . . Roles: Whitespace . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 -. . . . . . . . . . Line: 10 +. . . . . . . . . . Line: 16 . . . . . . . . . . Col: 1 . . . . . . . . . } . . . . . . . . . Properties: { -. . . . . . . . . . end_lineno: 10 +. . . . . . . . . . end_lineno: 16 . . . . . . . . . . internalRole: noops_previous . . . . . . . . . } . . . . . . . . . Children: { @@ -519,7 +753,7 @@ Module { " . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 0 -. . . . . . . . . . . . Line: 10 +. . . . . . . . . . . . Line: 16 . . . . . . . . . . . . Col: 1 . . . . . . . . . . . } . . . . . . . . . . . Properties: { @@ -541,7 +775,7 @@ Module { . . . . . . . . . TOKEN ">" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 -. . . . . . . . . . Line: 11 +. . . . . . . . . . Line: 17 . . . . . . . . . . Col: 0 . . . . . . . . . } . . . . . . . . } @@ -550,7 +784,7 @@ Module { . . . . . . . . . TOKEN ">" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 -. . . . . . . . . . Line: 11 +. . . . . . . . . . Line: 17 . . . . . . . . . . Col: 0 . . . . . . . . . } . . . . . . . . } @@ -559,7 +793,7 @@ Module { . . . . . . . . . TOKEN ">" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 -. . . . . . . . . . Line: 11 +. . . . . . . . . . Line: 17 . . . . . . . . . . Col: 0 . . . . . . . . . } . . . . . . . . }