Commit 93d1813
Replace invoke_method with get_attribute for language-agnostic proxy attribute access
Removes the now-unused invoke_method from ScriptSyntax and introduces
get_attribute to handle attribute access in a language-specific way.
Key changes:
- Added ScriptSyntax.get_attribute(obj, attr) method
- PythonSyntax: Returns "obj.attr" (gets field or bound method)
- GroovySyntax: Returns try/catch block that attempts field access
first, falls back to method reference (&) on MissingPropertyException
- ProxyObject.__getattr__: Now uses syntax.get_attribute() instead of
hardcoded string formatting
- Removed invoke_method from both PythonSyntax and GroovySyntax (dead code)
Groovy attribute access behavior:
- obj.field (field only) → returns field value
- obj.method (method only) → returns MethodClosure proxy
- obj.foo (both field and method) → returns field (method inaccessible)
- Workaround for conflicts: service.call("obj.method", args)
This design maintains the elegant chaining behavior for Python while
properly handling Groovy's different semantics for fields vs methods.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 1f2207f commit 93d1813
2 files changed
+24
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | | - | |
| 92 | + | |
95 | 93 | | |
96 | | - | |
| 94 | + | |
97 | 95 | | |
98 | | - | |
99 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
103 | | - | |
104 | | - | |
| 102 | + | |
105 | 103 | | |
106 | 104 | | |
107 | | - | |
| 105 | + | |
108 | 106 | | |
109 | 107 | | |
110 | 108 | | |
| |||
148 | 146 | | |
149 | 147 | | |
150 | 148 | | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
156 | 153 | | |
157 | 154 | | |
158 | 155 | | |
| |||
185 | 182 | | |
186 | 183 | | |
187 | 184 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | | - | |
| 102 | + | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
| |||
0 commit comments