Skip to content

Commit

Permalink
Rename uninitializedLocation to PENDING_LOCATION and make const.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn committed Aug 4, 2023
1 parent 7b52c8c commit 82331fb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/transform/src/emit.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ exports.Emitter = Emitter;
// so because no code can realistically have about 1.8e+308 locations before
// hitting memory limit of the machine it's running on. For comparison, the
// estimated number of atoms in the observable universe is around 1e+80.
let uninitializedLocation = Number.MAX_VALUE;
const PENDING_LOCATION = Number.MAX_VALUE;
Ep.loc = function() {
const l = util.getTypes().numericLiteral(uninitializedLocation)
const l = util.getTypes().numericLiteral(PENDING_LOCATION)
this.insertedLocs.add(l);
return l;
}
Expand All @@ -81,7 +81,7 @@ Ep.getContextId = function() {
Ep.mark = function(loc) {
util.getTypes().assertLiteral(loc);
let index = this.listing.length;
if (loc.value === uninitializedLocation) {
if (loc.value === PENDING_LOCATION) {
loc.value = index;
} else {
// Locations can be marked redundantly, but their values cannot change
Expand Down Expand Up @@ -649,7 +649,7 @@ Ep.explodeStatement = function(path, labelId) {
);

self.mark(after);
if (defaultLoc.value === uninitializedLocation) {
if (defaultLoc.value === PENDING_LOCATION) {
self.mark(defaultLoc);
assert.strictEqual(after.value, defaultLoc.value);
}
Expand Down Expand Up @@ -890,7 +890,7 @@ Ep.updateContextPrevLoc = function(loc) {
if (loc) {
t.assertLiteral(loc);

if (loc.value === uninitializedLocation) {
if (loc.value === PENDING_LOCATION) {
// If an uninitialized location literal was passed in, set its value
// to the current this.listing.length.
loc.value = this.listing.length;
Expand Down

0 comments on commit 82331fb

Please sign in to comment.