hclang 0.29.0 → 0.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,9 +13,12 @@ var _LiveLookupContext_lookupFrames, _LiveLookupContext_identityHandles, _Evalua
13
13
  import { Frame } from "./frame.js";
14
14
  import { FrameHandle } from "./frame-handle.js";
15
15
  /**
16
- * Whether `frame` is a resumed walk's view of its closure's scope, through
17
- * which a binding can be read and never written (spec a17).
16
+ * Whether `frame` is a read-only view of another scope, through which a
17
+ * binding can be read and never written: a named import's view of its caller
18
+ * (#441), or a resumed walk's view of its closure's scope (spec a17).
18
19
  */
20
+ export const isReadOnlyLookup = (frame) => frame instanceof LiveLookupContext;
21
+ /** Whether `frame` is a resumed walk's view of its closure's scope (a17). */
19
22
  export const isResumedLookup = (frame) => frame instanceof LiveLookupContext && frame.resumed;
20
23
  /** Live, read-only lookup through an ordered set of existing frame identities. */
21
24
  class LiveLookupContext extends Frame {
@@ -5,7 +5,7 @@ import { FrameHandle } from "./frame-handle.js";
5
5
  import { FrameLazy } from "./frame-lazy.js";
6
6
  import { FrameSymbol } from "./frame-symbol.js";
7
7
  import { NilContext } from "./context.js";
8
- import { EvaluationScope, isResumedLookup, } from "./evaluation-scope.js";
8
+ import { EvaluationScope, isReadOnlyLookup, isResumedLookup, } from "./evaluation-scope.js";
9
9
  import { completeAtEnd, includeOrReserve } from "./atom-syntax.js";
10
10
  import { authorizedReceiverWriteTarget } from "./bound-method.js";
11
11
  export class FrameAlias extends FrameAtom {
@@ -119,6 +119,12 @@ export class FrameAlias extends FrameAtom {
119
119
  if (isResumedLookup(found.out)) {
120
120
  return Frame.error(`$!.resumed-write @${key}`);
121
121
  }
122
+ // A named import reads its caller and never writes it. The write used to
123
+ // land on the read-only projection, answering as though it had written
124
+ // while nothing read it again (#441).
125
+ if (isReadOnlyLookup(found.out)) {
126
+ return Frame.error(`$!.read-only-scope @${key}`);
127
+ }
122
128
  return FrameSymbol.for(found.key).setter(found.out);
123
129
  }
124
130
  }
@@ -1 +1 @@
1
- export const VERSION = "0.29.0";
1
+ export const VERSION = "0.29.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hclang",
3
- "version": "0.29.0",
3
+ "version": "0.29.1",
4
4
  "description": "Homoiconic C command-line interpreter and REPL",
5
5
  "keywords": [
6
6
  "language",