Commit b836674
committed
Improve cross-language namebinding
Previously to enable cross-language scoping, we converted scoping types
from one language to another. For example, when embedding a Python method
into PHP, we renamed it to `function` so PHP's scoping rules could
reference it. This was restricitive as not every scope type has a true
representation in the other language. For example, in Python `method` can
be referenced by `variables`, which is not possible in PHP. Thus converting
`method` to `function` would disallow `method` to be referenced by a PHP
`variable`.
This commit changes how we treat namebinding information from language
boxes. When embedding Python into PHP, for example, Python's scoping rules
are merged into PHP's as is, keeping their specific types. We then extend
PHP's scoping rules, allowing them to reference Python types. For example,
a PHP `FunctionCall` now references `function` (PHP) and `method` (Python).1 parent 763146e commit b836674
7 files changed
Lines changed: 48 additions & 41 deletions
File tree
- lib/eco
- grammars
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
| 242 | + | |
| 243 | + | |
257 | 244 | | |
258 | | - | |
259 | | - | |
260 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
261 | 248 | | |
262 | 249 | | |
263 | 250 | | |
264 | 251 | | |
265 | 252 | | |
266 | 253 | | |
267 | 254 | | |
268 | | - | |
| 255 | + | |
269 | 256 | | |
270 | | - | |
271 | | - | |
272 | | - | |
| 257 | + | |
273 | 258 | | |
274 | 259 | | |
275 | 260 | | |
276 | 261 | | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
285 | 272 | | |
286 | 273 | | |
287 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1385 | 1385 | | |
1386 | 1386 | | |
1387 | 1387 | | |
1388 | | - | |
1389 | | - | |
1390 | | - | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
1391 | 1392 | | |
1392 | 1393 | | |
1393 | 1394 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| 56 | + | |
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| |||
118 | 121 | | |
119 | 122 | | |
120 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
121 | 127 | | |
122 | 128 | | |
123 | 129 | | |
| |||
194 | 200 | | |
195 | 201 | | |
196 | 202 | | |
| 203 | + | |
197 | 204 | | |
198 | 205 | | |
199 | 206 | | |
| |||
Binary file not shown.
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
150 | | - | |
151 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
544 | 544 | | |
545 | 545 | | |
546 | 546 | | |
547 | | - | |
548 | | - | |
| 547 | + | |
549 | 548 | | |
550 | | - | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
551 | 553 | | |
552 | 554 | | |
553 | 555 | | |
| |||
604 | 606 | | |
605 | 607 | | |
606 | 608 | | |
607 | | - | |
608 | | - | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
609 | 620 | | |
610 | 621 | | |
| 622 | + | |
611 | 623 | | |
612 | 624 | | |
613 | 625 | | |
| |||
0 commit comments