File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
com.oracle.graal.python.test/src/tests
com.oracle.graal.python/src/com/oracle/graal/python/parser Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -88,3 +88,13 @@ def test_lambda_no_args_with_nested_lambdas():
88
88
89
89
def test_byte_numeric_escapes ():
90
90
assert eval ('b"PK\\ 005\\ 006\\ 00\\ 11\\ 22\\ 08"' ) == b'PK\x05 \x06 \x00 \t \x12 \x00 8'
91
+
92
+
93
+ def test_decorator_cell ():
94
+ foo = lambda x : "just a string, not %s" % x .__name__
95
+ def run_me ():
96
+ @foo
97
+ def func ():
98
+ pass
99
+ return func
100
+ assert run_me () == "just a string, not func" , run_me ()
Original file line number Diff line number Diff line change @@ -100,11 +100,14 @@ public T visitEval_input(Python3Parser.Eval_inputContext ctx) {
100
100
}
101
101
}
102
102
103
+ @ Override
104
+ public T visitDecorator (Python3Parser .DecoratorContext ctx ) {
105
+ registerPossibleCell (ctx .dotted_name ().NAME (0 ).getText ());
106
+ return super .visitDecorator (ctx );
107
+ }
108
+
103
109
@ Override
104
110
public T visitFuncdef (Python3Parser .FuncdefContext ctx ) {
105
- if (ctx .parent instanceof Python3Parser .DecoratedContext ) {
106
- // TODO: get the decorators
107
- }
108
111
environment .createLocal (ctx .NAME ().getText ());
109
112
ArgListCompiler <T > argListCompiler = new ArgListCompiler <>(errors );
110
113
argListCompilers .add (argListCompiler );
You can’t perform that action at this time.
0 commit comments