ses 0.17.0 → 0.18.0

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.
@@ -144,20 +144,20 @@ function isImmutableDataProperty(obj, name) {
144
144
  * safe and only prevent performance optimization.
145
145
  *
146
146
  * @param {Object} globalObject
147
- * @param {Object} globalLexicals
147
+ * @param {Object} moduleLexicals
148
148
  */
149
- export const getScopeConstants = (globalObject, globalLexicals = {}) => {
149
+ export const getScopeConstants = (globalObject, moduleLexicals = {}) => {
150
150
  // getOwnPropertyNames() does ignore Symbols so we don't need to
151
151
  // filter them out.
152
152
  const globalObjectNames = getOwnPropertyNames(globalObject);
153
- const globalLexicalNames = getOwnPropertyNames(globalLexicals);
153
+ const moduleLexicalNames = getOwnPropertyNames(moduleLexicals);
154
154
 
155
155
  // Collect all valid & immutable identifiers from the endowments.
156
- const globalLexicalConstants = arrayFilter(
157
- globalLexicalNames,
156
+ const moduleLexicalConstants = arrayFilter(
157
+ moduleLexicalNames,
158
158
  name =>
159
159
  isValidIdentifierName(name) &&
160
- isImmutableDataProperty(globalLexicals, name),
160
+ isImmutableDataProperty(moduleLexicals, name),
161
161
  );
162
162
 
163
163
  // Collect all valid & immutable identifiers from the global that
@@ -167,13 +167,13 @@ export const getScopeConstants = (globalObject, globalLexicals = {}) => {
167
167
  name =>
168
168
  // Can't define a constant: it would prevent a
169
169
  // lookup on the endowments.
170
- !arrayIncludes(globalLexicalNames, name) &&
170
+ !arrayIncludes(moduleLexicalNames, name) &&
171
171
  isValidIdentifierName(name) &&
172
172
  isImmutableDataProperty(globalObject, name),
173
173
  );
174
174
 
175
175
  return {
176
176
  globalObjectConstants,
177
- globalLexicalConstants,
177
+ moduleLexicalConstants,
178
178
  };
179
179
  };
@@ -11,7 +11,7 @@ import {
11
11
  } from './commons.js';
12
12
  import { assert } from './error/assert.js';
13
13
 
14
- const { details: d, quote: q } = assert;
14
+ const { Fail, quote: q } = assert;
15
15
 
16
16
  /**
17
17
  * alwaysThrowHandler
@@ -24,10 +24,7 @@ export const alwaysThrowHandler = new Proxy(
24
24
  immutableObject,
25
25
  freeze({
26
26
  get(_shadow, prop) {
27
- // eslint-disable-next-line @endo/no-polymorphic-call
28
- assert.fail(
29
- d`Please report unexpected scope handler trap: ${q(String(prop))}`,
30
- );
27
+ Fail`Please report unexpected scope handler trap: ${q(String(prop))}`;
31
28
  },
32
29
  }),
33
30
  );
@@ -9,7 +9,7 @@ import {
9
9
  } from './commons.js';
10
10
  import { assert } from './error/assert.js';
11
11
 
12
- const { details: d, quote: q } = assert;
12
+ const { Fail, quote: q } = assert;
13
13
 
14
14
  const localePattern = /^(\w*[a-z])Locale([A-Z]\w*)$/;
15
15
 
@@ -31,7 +31,7 @@ const tamedMethods = {
31
31
  if (s > that) {
32
32
  return 1;
33
33
  }
34
- assert(s === that, d`expected ${q(s)} and ${q(that)} to compare`);
34
+ s === that || Fail`expected ${q(s)} and ${q(that)} to compare`;
35
35
  return 0;
36
36
  },
37
37
 
@@ -61,16 +61,12 @@ export default function tameLocaleMethods(intrinsics, localeTaming = 'safe') {
61
61
  for (const methodName of getOwnPropertyNames(intrinsic)) {
62
62
  const match = regexpExec(localePattern, methodName);
63
63
  if (match) {
64
- assert(
65
- typeof intrinsic[methodName] === 'function',
66
- d`expected ${q(methodName)} to be a function`,
67
- );
64
+ typeof intrinsic[methodName] === 'function' ||
65
+ Fail`expected ${q(methodName)} to be a function`;
68
66
  const nonLocaleMethodName = `${match[1]}${match[2]}`;
69
67
  const method = intrinsic[nonLocaleMethodName];
70
- assert(
71
- typeof method === 'function',
72
- d`function ${q(nonLocaleMethodName)} not found`,
73
- );
68
+ typeof method === 'function' ||
69
+ Fail`function ${q(nonLocaleMethodName)} not found`;
74
70
  defineProperty(intrinsic, methodName, { value: method });
75
71
  }
76
72
  }