1.1 --- a/templates/ops.c Mon Mar 20 17:24:28 2017 +0100
1.2 +++ b/templates/ops.c Mon Mar 20 17:58:38 2017 +0100
1.3 @@ -308,6 +308,11 @@
1.4 return value.value ? value : callable;
1.5 }
1.6
1.7 +__attr (*__get_function_unchecked(__attr target))(__attr[])
1.8 +{
1.9 + return __load_via_object(__unwrap_callable(target).value, __fn__).fn;
1.10 +}
1.11 +
1.12 __attr (*__get_function(__ref context, __attr target))(__attr[])
1.13 {
1.14 target = __unwrap_callable(target);
2.1 --- a/templates/ops.h Mon Mar 20 17:24:28 2017 +0100
2.2 +++ b/templates/ops.h Mon Mar 20 17:58:38 2017 +0100
2.3 @@ -108,6 +108,7 @@
2.4 /* Context testing for invocations. */
2.5
2.6 __attr __unwrap_callable(__attr callable);
2.7 +__attr (*__get_function_unchecked(__attr target))(__attr[]);
2.8 __attr (*__get_function(__ref context, __attr target))(__attr[]);
2.9 __attr (*__check_and_get_function(__ref context, __attr target))(__attr[]);
2.10
3.1 --- a/translator.py Mon Mar 20 17:24:28 2017 +0100
3.2 +++ b/translator.py Mon Mar 20 17:58:38 2017 +0100
3.3 @@ -1262,6 +1262,8 @@
3.4 if have_access_context:
3.5 stages.append("__get_function(%s, %s)" % (
3.6 context_identity, target_var))
3.7 + elif context_var == target_var:
3.8 + stages.append("__get_function_unchecked(%s)" % target_var)
3.9 else:
3.10 stages.append("__get_function(__CONTEXT_AS_VALUE(%s).value, %s)" % (
3.11 context_var, target_var))