Remove the now dead vestiges of ErasedAbruptCompletion (#2237)

Summary:
Release note: none

This just removes code that became redundant because of earlier PRs. To put it another way: ErasedAbruptCompletion is now gone!!!
Pull Request resolved: https://github.com/facebook/prepack/pull/2237

Differential Revision: D8811164

Pulled By: hermanventer

fbshipit-source-id: c7ca973f5ab6f3f7b5d4d78f70e2a3590cbe52e6
This commit is contained in:
Herman Venter 2018-07-11 15:09:22 -07:00 committed by Facebook Github Bot
parent 5f7256f17e
commit ca8a08b47f
5 changed files with 13 additions and 23 deletions

View File

@ -85,11 +85,6 @@ export class ReturnCompletion extends AbruptCompletion {
}
}
// An erased abrupt completion arises when an abrupt completion reaches a join point.
// Ideally we should use a SimpleNormalCompletion in its place, but that can only
// happen after ForkedAbruptCompletion and PossiblyNormalCompletion are unified.
export class ErasedAbruptCompletion extends AbruptCompletion {}
export class ForkedAbruptCompletion extends AbruptCompletion {
constructor(
realm: Realm,

View File

@ -13,7 +13,6 @@ import type { Effects, Realm } from "../realm.js";
import { type LexicalEnvironment } from "../environment.js";
import {
AbruptCompletion,
ErasedAbruptCompletion,
ForkedAbruptCompletion,
PossiblyNormalCompletion,
ThrowCompletion,
@ -113,7 +112,6 @@ export default function(ast: BabelNodeTryStatement, strictCode: boolean, env: Le
},
"composeNestedThrowEffectsWithHandler/1"
);
c.updateConsequentKeepingCurrentEffects(new ErasedAbruptCompletion(realm.intrinsics.empty));
}
priorEffects.pop();
let alternate = c.alternate;
@ -130,7 +128,6 @@ export default function(ast: BabelNodeTryStatement, strictCode: boolean, env: Le
},
"composeNestedThrowEffectsWithHandler/2"
);
c.updateAlternateKeepingCurrentEffects(new ErasedAbruptCompletion(realm.intrinsics.empty));
}
priorEffects.pop();
return Join.joinForkOrChoose(realm, c.joinCondition, consequentEffects, alternateEffects);

View File

@ -55,7 +55,6 @@ import { cloneDescriptor, Construct } from "./methods/index.js";
import {
AbruptCompletion,
Completion,
ErasedAbruptCompletion,
ForkedAbruptCompletion,
PossiblyNormalCompletion,
SimpleNormalCompletion,
@ -1312,14 +1311,14 @@ export class Realm {
function allPathsAreAbrupt(c: Completion): boolean {
if (c instanceof ForkedAbruptCompletion) return allPathsAreAbrupt(c.consequent) && allPathsAreAbrupt(c.alternate);
if (c instanceof AbruptCompletion) return !(c instanceof ErasedAbruptCompletion);
if (c instanceof AbruptCompletion) return true;
return false;
}
function allPathsAreNormal(c: Completion): boolean {
if (c instanceof PossiblyNormalCompletion || c instanceof ForkedAbruptCompletion)
return allPathsAreNormal(c.consequent) && allPathsAreNormal(c.alternate);
if (c instanceof AbruptCompletion) return c instanceof ErasedAbruptCompletion;
if (c instanceof AbruptCompletion) return false;
return true;
}

View File

@ -1,13 +1,15 @@
// does not contain:unnecessaryIndirection
(function () {
(function() {
let c1 = global.__abstract ? __abstract("boolean", "(true)") : true;
let c2 = global.__abstract ? __abstract("boolean", "(!false)") : true;
var a = {unnecessaryIndirection:1};
var b = {unnecessaryIndirection:2};
var c = {unnecessaryIndirection:3};
var a = { unnecessaryIndirection: 1 };
var b = { unnecessaryIndirection: 2 };
var c = { unnecessaryIndirection: 3 };
var obj1 = c1 ? a : b;
var obj2 = c2 ? obj1 : c;
obj2.unnecessaryIndirection = 5;
global.result = a.unnecessaryIndirection;
inspect = function() { return global.result; };
inspect = function() {
return global.result;
};
})();

View File

@ -1,15 +1,12 @@
(function () {
(function() {
let c = global.__abstract ? __abstract("boolean", "(true)") : true;
var a = {x:1};
var a = { x: 1 };
var b = {};
var obj = c ? a : b;
obj.x = 2;
global.result = a.x;
global.residualObject = b;
inspect = function() {
return (
global.result + ' ' +
global.residualObject.x + ' ' +
global.residualObject.hasOwnProperty('x')
); };
return global.result + " " + global.residualObject.x + " " + global.residualObject.hasOwnProperty("x");
};
})();