File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
com.oracle.graal.python.test/src/tests
com.oracle.graal.python/src/com/oracle/graal/python/parser/sst Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -121,3 +121,9 @@ def test_underscore_in_numbers():
121
121
assert eval ('0b1_1' ) == 0b11
122
122
assert eval ('0o1_7' ) == 0o17
123
123
assert eval ('0x1_f' ) == 0x1f
124
+
125
+
126
+ def test_annotation_scope ():
127
+ def foo (object : object ):
128
+ pass
129
+ assert foo .__annotations__ ['object' ] == object
Original file line number Diff line number Diff line change @@ -783,6 +783,12 @@ public PNode visit(FunctionDefSSTNode node) {
783
783
returnTarget = new ReturnTargetNode (body , nodeFactory .createReadLocal (scopeEnvironment .getReturnSlot ()));
784
784
}
785
785
786
+ SourceSection sourceSection = createSourceSection (node .startOffset , node .endOffset );
787
+ returnTarget .assignSourceSection (sourceSection );
788
+
789
+ scopeEnvironment .setCurrentScope (node .functionScope .getParent ());
790
+ ExpressionNode [] defaults = node .argBuilder .getDefaultParameterValues (this );
791
+ FunctionDefinitionNode .KwDefaultExpressionNode [] kwDefaults = node .argBuilder .getKwDefaultParameterValues (this );
786
792
Map <String , SSTNode > sstAnnotations = node .argBuilder .getAnnotatedArgs ();
787
793
Map <String , ExpressionNode > annotations = null ;
788
794
if (sstAnnotations != null && !sstAnnotations .isEmpty ()) {
@@ -792,12 +798,6 @@ public PNode visit(FunctionDefSSTNode node) {
792
798
annotations .put (argName , (ExpressionNode ) sstType .accept (this ));
793
799
}
794
800
}
795
- SourceSection sourceSection = createSourceSection (node .startOffset , node .endOffset );
796
- returnTarget .assignSourceSection (sourceSection );
797
-
798
- scopeEnvironment .setCurrentScope (node .functionScope .getParent ());
799
- ExpressionNode [] defaults = node .argBuilder .getDefaultParameterValues (this );
800
- FunctionDefinitionNode .KwDefaultExpressionNode [] kwDefaults = node .argBuilder .getKwDefaultParameterValues (this );
801
801
scopeEnvironment .setCurrentScope (node .functionScope );
802
802
803
803
/**
You can’t perform that action at this time.
0 commit comments