mirror of
https://github.com/facebookarchive/prepack.git
synced 2024-10-26 23:32:02 +03:00
Some shallow cleanup of the operation descriptor. (#2471)
Summary: Release notes: None Pull Request resolved: https://github.com/facebook/prepack/pull/2471 Differential Revision: D9482778 Pulled By: NTillmann fbshipit-source-id: 1eea1f3f0e6ddc383a2f214bfd53f5a99b7c1c4e
This commit is contained in:
parent
01edb5044b
commit
6299ab8272
36
flow-typed/npm/babel-types_vx.x.x.js
vendored
36
flow-typed/npm/babel-types_vx.x.x.js
vendored
@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
|
|
||||||
declare module "@babel/types" {
|
declare module "@babel/types" {
|
||||||
declare type BabelNodeObjectMethodKind = "get" | "set" | "method";
|
declare type BabelObjectMethodKind = "get" | "set" | "method";
|
||||||
declare type BabelNodeLogicalOperator = "||" | "&&";
|
declare type BabelLogicalOperator = "||" | "&&";
|
||||||
declare type BabelNodeAssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=";
|
declare type BabelAssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=";
|
||||||
declare type BabelBinaryOperator = "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=";
|
declare type BabelBinaryOperator = "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=";
|
||||||
declare type BabelUnaryOperator = "void" | "delete" | "!" | "+" | "-" | "++" | "--" | "~" | "typeof";
|
declare type BabelUnaryOperator = "void" | "delete" | "!" | "+" | "-" | "++" | "--" | "~" | "typeof";
|
||||||
declare type BabelUpdateOperator = "++" | "--";
|
declare type BabelUpdateOperator = "++" | "--";
|
||||||
@ -206,7 +206,7 @@ declare module "@babel/types" {
|
|||||||
|
|
||||||
declare class BabelNodeAssignmentExpression extends BabelNode {
|
declare class BabelNodeAssignmentExpression extends BabelNode {
|
||||||
type: "AssignmentExpression";
|
type: "AssignmentExpression";
|
||||||
operator: BabelNodeAssignmentOperator;
|
operator: BabelAssignmentOperator;
|
||||||
left: BabelNodeLVal;
|
left: BabelNodeLVal;
|
||||||
right: BabelNodeExpression;
|
right: BabelNodeExpression;
|
||||||
}
|
}
|
||||||
@ -373,7 +373,7 @@ declare module "@babel/types" {
|
|||||||
|
|
||||||
declare class BabelNodeLogicalExpression extends BabelNode {
|
declare class BabelNodeLogicalExpression extends BabelNode {
|
||||||
type: "LogicalExpression";
|
type: "LogicalExpression";
|
||||||
operator: BabelNodeLogicalOperator;
|
operator: BabelLogicalOperator;
|
||||||
left: BabelNodeExpression;
|
left: BabelNodeExpression;
|
||||||
right: BabelNodeExpression;
|
right: BabelNodeExpression;
|
||||||
}
|
}
|
||||||
@ -405,7 +405,7 @@ declare module "@babel/types" {
|
|||||||
|
|
||||||
declare class BabelNodeObjectMethod extends BabelNode {
|
declare class BabelNodeObjectMethod extends BabelNode {
|
||||||
type: "ObjectMethod";
|
type: "ObjectMethod";
|
||||||
kind: BabelNodeObjectMethodKind;
|
kind: BabelObjectMethodKind;
|
||||||
computed: boolean;
|
computed: boolean;
|
||||||
key: BabelNodeExpression;
|
key: BabelNodeExpression;
|
||||||
decorators: Array<BabelNodeDecorator>;
|
decorators: Array<BabelNodeDecorator>;
|
||||||
@ -1065,7 +1065,7 @@ declare module "@babel/types" {
|
|||||||
declare function arrayPattern(elements: Array<BabelNodeExpression>, typeAnnotation: any, decorators?: Array<BabelNodeDecorator>): BabelNodeArrayPattern;
|
declare function arrayPattern(elements: Array<BabelNodeExpression>, typeAnnotation: any, decorators?: Array<BabelNodeDecorator>): BabelNodeArrayPattern;
|
||||||
declare function arrayTypeAnnotation(elementType: any): BabelNodeArrayTypeAnnotation;
|
declare function arrayTypeAnnotation(elementType: any): BabelNodeArrayTypeAnnotation;
|
||||||
declare function arrowFunctionExpression(params: Array<BabelNodeLVal>, body: BabelNodeBlockStatement | BabelNodeExpression, async?: boolean, returnType?: any, typeParameters?: any): BabelNodeArrowFunctionExpression;
|
declare function arrowFunctionExpression(params: Array<BabelNodeLVal>, body: BabelNodeBlockStatement | BabelNodeExpression, async?: boolean, returnType?: any, typeParameters?: any): BabelNodeArrowFunctionExpression;
|
||||||
declare function assignmentExpression(operator: BabelNodeAssignmentOperator, left: BabelNodeLVal, right: BabelNodeExpression): BabelNodeAssignmentExpression;
|
declare function assignmentExpression(operator: BabelAssignmentOperator, left: BabelNodeLVal, right: BabelNodeExpression): BabelNodeAssignmentExpression;
|
||||||
declare function assignmentPattern(left: BabelNodeIdentifier, right: BabelNodeExpression, decorators?: any): BabelNodeAssignmentPattern;
|
declare function assignmentPattern(left: BabelNodeIdentifier, right: BabelNodeExpression, decorators?: any): BabelNodeAssignmentPattern;
|
||||||
declare function awaitExpression(argument: BabelNodeExpression): BabelNodeAwaitExpression;
|
declare function awaitExpression(argument: BabelNodeExpression): BabelNodeAwaitExpression;
|
||||||
declare function binaryExpression(operator: BabelBinaryOperator, left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeBinaryExpression;
|
declare function binaryExpression(operator: BabelBinaryOperator, left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeBinaryExpression;
|
||||||
@ -1139,7 +1139,7 @@ declare module "@babel/types" {
|
|||||||
declare function jSXSpreadAttribute(argument: BabelNodeExpression): BabelNodeJSXSpreadAttribute;
|
declare function jSXSpreadAttribute(argument: BabelNodeExpression): BabelNodeJSXSpreadAttribute;
|
||||||
declare function jSXText(value: string): BabelNodeJSXText;
|
declare function jSXText(value: string): BabelNodeJSXText;
|
||||||
declare function labeledStatement(label: BabelNodeIdentifier, body: BabelNodeStatement): BabelNodeLabeledStatement;
|
declare function labeledStatement(label: BabelNodeIdentifier, body: BabelNodeStatement): BabelNodeLabeledStatement;
|
||||||
declare function logicalExpression(operator: BabelNodeLogicalOperator, left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeLogicalExpression;
|
declare function logicalExpression(operator: BabelLogicalOperator, left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeLogicalExpression;
|
||||||
declare function memberExpression(object: BabelNodeExpression, property: BabelNodeExpression | BabelNodeIdentifier, computed?: boolean): BabelNodeMemberExpression;
|
declare function memberExpression(object: BabelNodeExpression, property: BabelNodeExpression | BabelNodeIdentifier, computed?: boolean): BabelNodeMemberExpression;
|
||||||
declare function metaProperty(meta: string, property: string): BabelNodeMetaProperty;
|
declare function metaProperty(meta: string, property: string): BabelNodeMetaProperty;
|
||||||
declare function mixedTypeAnnotation(): BabelNodeMixedTypeAnnotation;
|
declare function mixedTypeAnnotation(): BabelNodeMixedTypeAnnotation;
|
||||||
@ -1152,7 +1152,7 @@ declare module "@babel/types" {
|
|||||||
declare function numericLiteral(value: number): BabelNodeNumericLiteral;
|
declare function numericLiteral(value: number): BabelNodeNumericLiteral;
|
||||||
declare function numericLiteralTypeAnnotation(): BabelNodeNumericLiteralTypeAnnotation;
|
declare function numericLiteralTypeAnnotation(): BabelNodeNumericLiteralTypeAnnotation;
|
||||||
declare function objectExpression(properties: Array<BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeSpreadElement>): BabelNodeObjectExpression;
|
declare function objectExpression(properties: Array<BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeSpreadElement>): BabelNodeObjectExpression;
|
||||||
declare function objectMethod(kind: BabelNodeObjectMethodKind, key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeLiteral, params: Array<BabelNodeLVal>, body: BabelNodeBlockStatement, computed?: boolean, async?: boolean, decorators?: any, generator?: boolean, returnType?: any, typeParameters?: any): BabelNodeObjectMethod;
|
declare function objectMethod(kind: BabelObjectMethodKind, key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeLiteral, params: Array<BabelNodeLVal>, body: BabelNodeBlockStatement, computed?: boolean, async?: boolean, decorators?: any, generator?: boolean, returnType?: any, typeParameters?: any): BabelNodeObjectMethod;
|
||||||
declare function objectPattern(properties: Array<BabelNodeRestProperty | BabelNodeProperty>, typeAnnotation: any, decorators?: Array<BabelNodeDecorator>): BabelNodeObjectPattern;
|
declare function objectPattern(properties: Array<BabelNodeRestProperty | BabelNodeProperty>, typeAnnotation: any, decorators?: Array<BabelNodeDecorator>): BabelNodeObjectPattern;
|
||||||
declare function objectProperty(key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeLiteral, value: BabelNodeExpression, computed?: boolean, shorthand?: boolean, decorators: ?Array<BabelNodeDecorator>): BabelNodeObjectProperty;
|
declare function objectProperty(key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeLiteral, value: BabelNodeExpression, computed?: boolean, shorthand?: boolean, decorators: ?Array<BabelNodeDecorator>): BabelNodeObjectProperty;
|
||||||
declare function objectTypeAnnotation(properties: any, indexers: any, callProperties: any): BabelNodeObjectTypeAnnotation;
|
declare function objectTypeAnnotation(properties: any, indexers: any, callProperties: any): BabelNodeObjectTypeAnnotation;
|
||||||
@ -1390,9 +1390,9 @@ declare module "@babel/types" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module "babel-types" {
|
declare module "babel-types" {
|
||||||
declare type BabelNodeObjectMethodKind = "get" | "set" | "method";
|
declare type BabelObjectMethodKind = "get" | "set" | "method";
|
||||||
declare type BabelNodeLogicalOperator = "||" | "&&";
|
declare type BabelLogicalOperator = "||" | "&&";
|
||||||
declare type BabelNodeAssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=";
|
declare type BabelAssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=";
|
||||||
declare type BabelBinaryOperator = "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=";
|
declare type BabelBinaryOperator = "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=";
|
||||||
declare type BabelUnaryOperator = "void" | "delete" | "!" | "+" | "-" | "++" | "--" | "~" | "typeof";
|
declare type BabelUnaryOperator = "void" | "delete" | "!" | "+" | "-" | "++" | "--" | "~" | "typeof";
|
||||||
declare type BabelUpdateOperator = "++" | "--";
|
declare type BabelUpdateOperator = "++" | "--";
|
||||||
@ -1579,7 +1579,7 @@ declare module "babel-types" {
|
|||||||
|
|
||||||
declare class BabelNodeAssignmentExpression extends BabelNode {
|
declare class BabelNodeAssignmentExpression extends BabelNode {
|
||||||
type: "AssignmentExpression";
|
type: "AssignmentExpression";
|
||||||
operator: BabelNodeAssignmentOperator;
|
operator: BabelAssignmentOperator;
|
||||||
left: BabelNodeLVal;
|
left: BabelNodeLVal;
|
||||||
right: BabelNodeExpression;
|
right: BabelNodeExpression;
|
||||||
}
|
}
|
||||||
@ -1746,7 +1746,7 @@ declare module "babel-types" {
|
|||||||
|
|
||||||
declare class BabelNodeLogicalExpression extends BabelNode {
|
declare class BabelNodeLogicalExpression extends BabelNode {
|
||||||
type: "LogicalExpression";
|
type: "LogicalExpression";
|
||||||
operator: BabelNodeLogicalOperator;
|
operator: BabelLogicalOperator;
|
||||||
left: BabelNodeExpression;
|
left: BabelNodeExpression;
|
||||||
right: BabelNodeExpression;
|
right: BabelNodeExpression;
|
||||||
}
|
}
|
||||||
@ -1778,7 +1778,7 @@ declare module "babel-types" {
|
|||||||
|
|
||||||
declare class BabelNodeObjectMethod extends BabelNode {
|
declare class BabelNodeObjectMethod extends BabelNode {
|
||||||
type: "ObjectMethod";
|
type: "ObjectMethod";
|
||||||
kind: BabelNodeObjectMethodKind;
|
kind: BabelObjectMethodKind;
|
||||||
computed: boolean;
|
computed: boolean;
|
||||||
key: BabelNodeExpression;
|
key: BabelNodeExpression;
|
||||||
decorators: Array<BabelNodeDecorator>;
|
decorators: Array<BabelNodeDecorator>;
|
||||||
@ -2438,7 +2438,7 @@ declare module "babel-types" {
|
|||||||
declare function arrayPattern(elements: Array<BabelNodeExpression>, typeAnnotation: any, decorators?: Array<BabelNodeDecorator>): BabelNodeArrayPattern;
|
declare function arrayPattern(elements: Array<BabelNodeExpression>, typeAnnotation: any, decorators?: Array<BabelNodeDecorator>): BabelNodeArrayPattern;
|
||||||
declare function arrayTypeAnnotation(elementType: any): BabelNodeArrayTypeAnnotation;
|
declare function arrayTypeAnnotation(elementType: any): BabelNodeArrayTypeAnnotation;
|
||||||
declare function arrowFunctionExpression(params: Array<BabelNodeLVal>, body: BabelNodeBlockStatement | BabelNodeExpression, async?: boolean, returnType?: any, typeParameters?: any): BabelNodeArrowFunctionExpression;
|
declare function arrowFunctionExpression(params: Array<BabelNodeLVal>, body: BabelNodeBlockStatement | BabelNodeExpression, async?: boolean, returnType?: any, typeParameters?: any): BabelNodeArrowFunctionExpression;
|
||||||
declare function assignmentExpression(operator: BabelNodeAssignmentOperator, left: BabelNodeLVal, right: BabelNodeExpression): BabelNodeAssignmentExpression;
|
declare function assignmentExpression(operator: BabelAssignmentOperator, left: BabelNodeLVal, right: BabelNodeExpression): BabelNodeAssignmentExpression;
|
||||||
declare function assignmentPattern(left: BabelNodeIdentifier, right: BabelNodeExpression, decorators?: any): BabelNodeAssignmentPattern;
|
declare function assignmentPattern(left: BabelNodeIdentifier, right: BabelNodeExpression, decorators?: any): BabelNodeAssignmentPattern;
|
||||||
declare function awaitExpression(argument: BabelNodeExpression): BabelNodeAwaitExpression;
|
declare function awaitExpression(argument: BabelNodeExpression): BabelNodeAwaitExpression;
|
||||||
declare function binaryExpression(operator: BabelBinaryOperator, left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeBinaryExpression;
|
declare function binaryExpression(operator: BabelBinaryOperator, left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeBinaryExpression;
|
||||||
@ -2512,7 +2512,7 @@ declare module "babel-types" {
|
|||||||
declare function jSXSpreadAttribute(argument: BabelNodeExpression): BabelNodeJSXSpreadAttribute;
|
declare function jSXSpreadAttribute(argument: BabelNodeExpression): BabelNodeJSXSpreadAttribute;
|
||||||
declare function jSXText(value: string): BabelNodeJSXText;
|
declare function jSXText(value: string): BabelNodeJSXText;
|
||||||
declare function labeledStatement(label: BabelNodeIdentifier, body: BabelNodeStatement): BabelNodeLabeledStatement;
|
declare function labeledStatement(label: BabelNodeIdentifier, body: BabelNodeStatement): BabelNodeLabeledStatement;
|
||||||
declare function logicalExpression(operator: BabelNodeLogicalOperator, left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeLogicalExpression;
|
declare function logicalExpression(operator: BabelLogicalOperator, left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeLogicalExpression;
|
||||||
declare function memberExpression(object: BabelNodeExpression, property: BabelNodeExpression | BabelNodeIdentifier, computed?: boolean): BabelNodeMemberExpression;
|
declare function memberExpression(object: BabelNodeExpression, property: BabelNodeExpression | BabelNodeIdentifier, computed?: boolean): BabelNodeMemberExpression;
|
||||||
declare function metaProperty(meta: string, property: string): BabelNodeMetaProperty;
|
declare function metaProperty(meta: string, property: string): BabelNodeMetaProperty;
|
||||||
declare function mixedTypeAnnotation(): BabelNodeMixedTypeAnnotation;
|
declare function mixedTypeAnnotation(): BabelNodeMixedTypeAnnotation;
|
||||||
@ -2525,7 +2525,7 @@ declare module "babel-types" {
|
|||||||
declare function numericLiteral(value: number): BabelNodeNumericLiteral;
|
declare function numericLiteral(value: number): BabelNodeNumericLiteral;
|
||||||
declare function numericLiteralTypeAnnotation(): BabelNodeNumericLiteralTypeAnnotation;
|
declare function numericLiteralTypeAnnotation(): BabelNodeNumericLiteralTypeAnnotation;
|
||||||
declare function objectExpression(properties: Array<BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeSpreadElement>): BabelNodeObjectExpression;
|
declare function objectExpression(properties: Array<BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeSpreadElement>): BabelNodeObjectExpression;
|
||||||
declare function objectMethod(kind: BabelNodeObjectMethodKind, key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeLiteral, params: Array<BabelNodeLVal>, body: BabelNodeBlockStatement, computed?: boolean, async?: boolean, decorators?: any, generator?: boolean, returnType?: any, typeParameters?: any): BabelNodeObjectMethod;
|
declare function objectMethod(kind: BabelObjectMethodKind, key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeLiteral, params: Array<BabelNodeLVal>, body: BabelNodeBlockStatement, computed?: boolean, async?: boolean, decorators?: any, generator?: boolean, returnType?: any, typeParameters?: any): BabelNodeObjectMethod;
|
||||||
declare function objectPattern(properties: Array<BabelNodeRestProperty | BabelNodeProperty>, typeAnnotation: any, decorators?: Array<BabelNodeDecorator>): BabelNodeObjectPattern;
|
declare function objectPattern(properties: Array<BabelNodeRestProperty | BabelNodeProperty>, typeAnnotation: any, decorators?: Array<BabelNodeDecorator>): BabelNodeObjectPattern;
|
||||||
declare function objectProperty(key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeLiteral, value: BabelNodeExpression, computed?: boolean, shorthand?: boolean, decorators: ?Array<BabelNodeDecorator>): BabelNodeObjectProperty;
|
declare function objectProperty(key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeLiteral, value: BabelNodeExpression, computed?: boolean, shorthand?: boolean, decorators: ?Array<BabelNodeDecorator>): BabelNodeObjectProperty;
|
||||||
declare function objectTypeAnnotation(properties: any, indexers: any, callProperties: any): BabelNodeObjectTypeAnnotation;
|
declare function objectTypeAnnotation(properties: any, indexers: any, callProperties: any): BabelNodeObjectTypeAnnotation;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
/* @flow strict-local */
|
/* @flow strict-local */
|
||||||
|
|
||||||
import invariant from "../invariant.js";
|
import invariant from "../invariant.js";
|
||||||
import type { BabelBinaryOperator, BabelNodeLogicalOperator, BabelUnaryOperator } from "@babel/types";
|
import type { BabelBinaryOperator, BabelLogicalOperator, BabelUnaryOperator } from "@babel/types";
|
||||||
import {
|
import {
|
||||||
AbstractValue,
|
AbstractValue,
|
||||||
BooleanValue,
|
BooleanValue,
|
||||||
@ -130,7 +130,7 @@ export default class TypesDomain {
|
|||||||
return TypesDomain.topVal;
|
return TypesDomain.topVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
static logicalOp(op: BabelNodeLogicalOperator, left: TypesDomain, right: TypesDomain): TypesDomain {
|
static logicalOp(op: BabelLogicalOperator, left: TypesDomain, right: TypesDomain): TypesDomain {
|
||||||
return left.joinWith(right.getType());
|
return left.joinWith(right.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
/* @flow strict-local */
|
/* @flow strict-local */
|
||||||
|
|
||||||
import type { BabelBinaryOperator, BabelNodeLogicalOperator, BabelUnaryOperator } from "@babel/types";
|
import type { BabelBinaryOperator, BabelLogicalOperator, BabelUnaryOperator } from "@babel/types";
|
||||||
import { AbruptCompletion } from "../completions.js";
|
import { AbruptCompletion } from "../completions.js";
|
||||||
import { FatalError } from "../errors.js";
|
import { FatalError } from "../errors.js";
|
||||||
import invariant from "../invariant.js";
|
import invariant from "../invariant.js";
|
||||||
@ -307,7 +307,7 @@ export default class ValuesDomain {
|
|||||||
invariant(false, "unimplemented " + op);
|
invariant(false, "unimplemented " + op);
|
||||||
}
|
}
|
||||||
|
|
||||||
static logicalOp(realm: Realm, op: BabelNodeLogicalOperator, left: ValuesDomain, right: ValuesDomain): ValuesDomain {
|
static logicalOp(realm: Realm, op: BabelLogicalOperator, left: ValuesDomain, right: ValuesDomain): ValuesDomain {
|
||||||
let leftElements = left._elements;
|
let leftElements = left._elements;
|
||||||
let rightElements = right._elements;
|
let rightElements = right._elements;
|
||||||
// Return top if left and/or right are top or if the size of the value set would get to be quite large.
|
// Return top if left and/or right are top or if the size of the value set would get to be quite large.
|
||||||
@ -342,7 +342,7 @@ export default class ValuesDomain {
|
|||||||
// If that is not the desired behavior, mark the realm as read-only for the duration of the call.
|
// If that is not the desired behavior, mark the realm as read-only for the duration of the call.
|
||||||
static computeLogical(
|
static computeLogical(
|
||||||
realm: Realm,
|
realm: Realm,
|
||||||
op: BabelNodeLogicalOperator,
|
op: BabelLogicalOperator,
|
||||||
lval: ConcreteValue,
|
lval: ConcreteValue,
|
||||||
rval: ConcreteValue
|
rval: ConcreteValue
|
||||||
): ConcreteValue {
|
): ConcreteValue {
|
||||||
|
@ -302,7 +302,7 @@ export function computeBinary(
|
|||||||
realm,
|
realm,
|
||||||
resultType,
|
resultType,
|
||||||
[lval, rval],
|
[lval, rval],
|
||||||
createOperationDescriptor("BINARY_EXPRESSION", { op }),
|
createOperationDescriptor("BINARY_EXPRESSION", { binaryOperator: op }),
|
||||||
{ isPure: true }
|
{ isPure: true }
|
||||||
),
|
),
|
||||||
TypesDomain.topVal,
|
TypesDomain.topVal,
|
||||||
|
@ -50,7 +50,7 @@ export default function(
|
|||||||
realm,
|
realm,
|
||||||
NumberValue,
|
NumberValue,
|
||||||
[oldExpr],
|
[oldExpr],
|
||||||
createOperationDescriptor("UPDATE_INCREMENTOR", { op })
|
createOperationDescriptor("UPDATE_INCREMENTOR", { incrementor: op })
|
||||||
),
|
),
|
||||||
TypesDomain.topVal,
|
TypesDomain.topVal,
|
||||||
ValuesDomain.topVal
|
ValuesDomain.topVal
|
||||||
|
@ -1062,7 +1062,7 @@ export class Realm {
|
|||||||
value.types,
|
value.types,
|
||||||
value.values,
|
value.values,
|
||||||
[key.object, value],
|
[key.object, value],
|
||||||
createOperationDescriptor("LOGICAL_PROPERTY_ASSIGNMENT", { binding: key, value }),
|
createOperationDescriptor("LOGICAL_PROPERTY_ASSIGNMENT", { propertyBinding: key, value }),
|
||||||
{
|
{
|
||||||
skipInvariant: true,
|
skipInvariant: true,
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ import {
|
|||||||
voidExpression,
|
voidExpression,
|
||||||
} from "../utils/babelhelpers.js";
|
} from "../utils/babelhelpers.js";
|
||||||
import invariant from "../invariant.js";
|
import invariant from "../invariant.js";
|
||||||
import { type Binding } from "../environment.js";
|
|
||||||
import * as t from "@babel/types";
|
import * as t from "@babel/types";
|
||||||
import { AbstractValue, EmptyValue, ObjectValue, Value } from "../values/index.js";
|
import { AbstractValue, EmptyValue, ObjectValue, Value } from "../values/index.js";
|
||||||
import type {
|
import type {
|
||||||
@ -35,7 +34,6 @@ import type {
|
|||||||
BabelNodeStringLiteral,
|
BabelNodeStringLiteral,
|
||||||
} from "@babel/types";
|
} from "@babel/types";
|
||||||
import { Utils } from "../singletons.js";
|
import { Utils } from "../singletons.js";
|
||||||
import type { PropertyBinding } from "../types.js";
|
|
||||||
|
|
||||||
const labels = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
const labels = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
|
||||||
@ -338,7 +336,7 @@ export class ResidualOperationSerializer {
|
|||||||
return babelNode;
|
return babelNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeAssumeCall(data: OperationDescriptorData, [c, s]: Array<BabelNodeExpression>) {
|
_serializeAssumeCall({ }: OperationDescriptorData, [c, s]: Array<BabelNodeExpression>) {
|
||||||
let errorLiteral = s.type === "StringLiteral" ? s : t.stringLiteral("Assumption violated");
|
let errorLiteral = s.type === "StringLiteral" ? s : t.stringLiteral("Assumption violated");
|
||||||
return t.ifStatement(
|
return t.ifStatement(
|
||||||
t.unaryExpression("!", c),
|
t.unaryExpression("!", c),
|
||||||
@ -346,15 +344,15 @@ export class ResidualOperationSerializer {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeWidenPropertyAssignment(data: OperationDescriptorData, [o, propName, v]: Array<BabelNodeExpression>) {
|
_serializeWidenPropertyAssignment({ }: OperationDescriptorData, [o, propName, v]: Array<BabelNodeExpression>) {
|
||||||
return t.assignmentExpression("=", memberExpressionHelper(o, propName), v);
|
return t.assignmentExpression("=", memberExpressionHelper(o, propName), v);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeWidenAbstractProperty(data: OperationDescriptorData, [o, p]: Array<BabelNodeExpression>) {
|
_serializeWidenAbstractProperty({ }: OperationDescriptorData, [o, p]: Array<BabelNodeExpression>) {
|
||||||
return memberExpressionHelper(o, p);
|
return memberExpressionHelper(o, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeWidenProperty(data: OperationDescriptorData, [o, propName]: Array<BabelNodeExpression>) {
|
_serializeWidenProperty({ }: OperationDescriptorData, [o, propName]: Array<BabelNodeExpression>) {
|
||||||
return memberExpressionHelper(o, propName);
|
return memberExpressionHelper(o, propName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,7 +362,7 @@ export class ResidualOperationSerializer {
|
|||||||
: memberExpressionHelper(o, P);
|
: memberExpressionHelper(o, P);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeAbstractObjectGetProtoOf(data: OperationDescriptorData, [p]: Array<BabelNodeExpression>) {
|
_serializeAbstractObjectGetProtoOf({ }: OperationDescriptorData, [p]: Array<BabelNodeExpression>) {
|
||||||
invariant(this.realm.preludeGenerator !== undefined);
|
invariant(this.realm.preludeGenerator !== undefined);
|
||||||
let getPrototypeOf = this.realm.preludeGenerator.memoizeReference("Object.getPrototypeOf");
|
let getPrototypeOf = this.realm.preludeGenerator.memoizeReference("Object.getPrototypeOf");
|
||||||
return this.realm.isCompatibleWith(this.realm.MOBILE_JSC_VERSION) || this.realm.isCompatibleWith("mobile")
|
return this.realm.isCompatibleWith(this.realm.MOBILE_JSC_VERSION) || this.realm.isCompatibleWith("mobile")
|
||||||
@ -372,27 +370,27 @@ export class ResidualOperationSerializer {
|
|||||||
: t.callExpression(getPrototypeOf, [p]);
|
: t.callExpression(getPrototypeOf, [p]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeCannotBecomeObject(data: OperationDescriptorData, [n]: Array<BabelNodeExpression>) {
|
_serializeCannotBecomeObject({ }: OperationDescriptorData, [n]: Array<BabelNodeExpression>) {
|
||||||
let callFunc = t.identifier("global.__cannotBecomeObject");
|
let callFunc = t.identifier("global.__cannotBecomeObject");
|
||||||
return t.callExpression(callFunc, [n]);
|
return t.callExpression(callFunc, [n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeResidualCall(data: OperationDescriptorData, nodes: Array<BabelNodeExpression>) {
|
_serializeResidualCall({ }: OperationDescriptorData, nodes: Array<BabelNodeExpression>) {
|
||||||
return t.callExpression(nodes[0], ((nodes.slice(1): any): Array<BabelNodeExpression | BabelNodeSpreadElement>));
|
return t.callExpression(nodes[0], ((nodes.slice(1): any): Array<BabelNodeExpression | BabelNodeSpreadElement>));
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeModulesRequires(data: OperationDescriptorData, [propName]: Array<BabelNodeExpression>) {
|
_serializeModulesRequires({ }: OperationDescriptorData, [propName]: Array<BabelNodeExpression>) {
|
||||||
return t.callExpression(t.identifier("require"), [propName]);
|
return t.callExpression(t.identifier("require"), [propName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeConcreteModel(data: OperationDescriptorData, [valueNode, propName]: Array<BabelNodeExpression>) {
|
_serializeConcreteModel({ }: OperationDescriptorData, [valueNode, propName]: Array<BabelNodeExpression>) {
|
||||||
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
||||||
return t.expressionStatement(
|
return t.expressionStatement(
|
||||||
t.assignmentExpression("=", this.preludeGenerator.globalReference(propString, false), valueNode)
|
t.assignmentExpression("=", this.preludeGenerator.globalReference(propString, false), valueNode)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeConsoleLog(data: OperationDescriptorData, [propName, ...nodes]: Array<BabelNodeExpression>) {
|
_serializeConsoleLog({ }: OperationDescriptorData, [propName, ...nodes]: Array<BabelNodeExpression>) {
|
||||||
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
||||||
return t.expressionStatement(
|
return t.expressionStatement(
|
||||||
t.callExpression(t.memberExpression(t.identifier("console"), t.identifier(propString)), [...nodes])
|
t.callExpression(t.memberExpression(t.identifier("console"), t.identifier(propString)), [...nodes])
|
||||||
@ -431,13 +429,13 @@ export class ResidualOperationSerializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_serializeFullInvariant(
|
_serializeFullInvariant(
|
||||||
data: OperationDescriptorData,
|
{ }: OperationDescriptorData,
|
||||||
[propName, objectNode, valueNode]: Array<BabelNodeExpression>
|
[propName, objectNode, valueNode]: Array<BabelNodeExpression>
|
||||||
) {
|
) {
|
||||||
return t.binaryExpression("!==", memberExpressionHelper(objectNode, propName), valueNode);
|
return t.binaryExpression("!==", memberExpressionHelper(objectNode, propName), valueNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeFullInvariantFunction(data: OperationDescriptorData, [propName, objectNode]: Array<BabelNodeExpression>) {
|
_serializeFullInvariantFunction({ }: OperationDescriptorData, [propName, objectNode]: Array<BabelNodeExpression>) {
|
||||||
return t.binaryExpression(
|
return t.binaryExpression(
|
||||||
"!==",
|
"!==",
|
||||||
t.unaryExpression("typeof", memberExpressionHelper(objectNode, propName), true),
|
t.unaryExpression("typeof", memberExpressionHelper(objectNode, propName), true),
|
||||||
@ -466,7 +464,7 @@ export class ResidualOperationSerializer {
|
|||||||
return checks.reduce((expr, newCondition) => t.logicalExpression("&&", expr, newCondition));
|
return checks.reduce((expr, newCondition) => t.logicalExpression("&&", expr, newCondition));
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeInvariantAppend(data: OperationDescriptorData, [propName, objectNode]: Array<BabelNodeExpression>) {
|
_serializeInvariantAppend({ }: OperationDescriptorData, [propName, objectNode]: Array<BabelNodeExpression>) {
|
||||||
return memberExpressionHelper(objectNode, propName);
|
return memberExpressionHelper(objectNode, propName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,13 +489,13 @@ export class ResidualOperationSerializer {
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeUpdateIncrementor({ op }: OperationDescriptorData, [oldValNode]: Array<BabelNodeExpression>) {
|
_serializeUpdateIncrementor({ incrementor }: OperationDescriptorData, [oldValNode]: Array<BabelNodeExpression>) {
|
||||||
invariant(op !== undefined);
|
invariant(incrementor !== undefined);
|
||||||
return t.binaryExpression(op, oldValNode, t.numericLiteral(1));
|
return t.binaryExpression(incrementor, oldValNode, t.numericLiteral(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeDerivedAbstractInvariant(
|
_serializeDerivedAbstractInvariant(
|
||||||
data: OperationDescriptorData,
|
{ }: OperationDescriptorData,
|
||||||
[typeOfStringNode, typeofNode]: Array<BabelNodeExpression>
|
[typeOfStringNode, typeofNode]: Array<BabelNodeExpression>
|
||||||
) {
|
) {
|
||||||
let typeofString = ((typeOfStringNode: any): BabelNodeStringLiteral).value;
|
let typeofString = ((typeOfStringNode: any): BabelNodeStringLiteral).value;
|
||||||
@ -539,7 +537,7 @@ export class ResidualOperationSerializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_serializeReactRelayMockContainer(
|
_serializeReactRelayMockContainer(
|
||||||
data: OperationDescriptorData,
|
{ }: OperationDescriptorData,
|
||||||
[reactRelayIdent, propName, ...otherArgs]: Array<BabelNodeExpression>
|
[reactRelayIdent, propName, ...otherArgs]: Array<BabelNodeExpression>
|
||||||
) {
|
) {
|
||||||
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
||||||
@ -587,14 +585,17 @@ export class ResidualOperationSerializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_serializeLogicalPropertyAssignment(
|
_serializeLogicalPropertyAssignment(
|
||||||
{ binding: _binding, value }: OperationDescriptorData,
|
{ propertyBinding, value }: OperationDescriptorData,
|
||||||
[o, n]: Array<BabelNodeExpression>
|
[o, n]: Array<BabelNodeExpression>
|
||||||
) {
|
) {
|
||||||
invariant(value instanceof Value);
|
invariant(value instanceof Value);
|
||||||
invariant(_binding !== undefined);
|
invariant(propertyBinding !== undefined);
|
||||||
let binding = ((_binding: any): PropertyBinding);
|
if (
|
||||||
if (typeof binding.key === "string" && value.mightHaveBeenDeleted() && isSelfReferential(value, binding.pathNode)) {
|
typeof propertyBinding.key === "string" &&
|
||||||
let inTest = t.binaryExpression("in", t.stringLiteral(binding.key), o);
|
value.mightHaveBeenDeleted() &&
|
||||||
|
isSelfReferential(value, propertyBinding.pathNode)
|
||||||
|
) {
|
||||||
|
let inTest = t.binaryExpression("in", t.stringLiteral(propertyBinding.key), o);
|
||||||
let addEmpty = t.conditionalExpression(inTest, n, emptyExpression);
|
let addEmpty = t.conditionalExpression(inTest, n, emptyExpression);
|
||||||
n = t.logicalExpression("||", n, addEmpty);
|
n = t.logicalExpression("||", n, addEmpty);
|
||||||
}
|
}
|
||||||
@ -613,48 +614,48 @@ export class ResidualOperationSerializer {
|
|||||||
return t.expressionStatement(t.assignmentExpression("=", (id: any), v));
|
return t.expressionStatement(t.assignmentExpression("=", (id: any), v));
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeReactNativeStringLiteral(data: OperationDescriptorData, [propName]: Array<BabelNodeExpression>) {
|
_serializeReactNativeStringLiteral({ }: OperationDescriptorData, [propName]: Array<BabelNodeExpression>) {
|
||||||
return propName;
|
return propName;
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeReactCreateContextProvider(data: OperationDescriptorData, [consumerNode]: Array<BabelNodeExpression>) {
|
_serializeReactCreateContextProvider({ }: OperationDescriptorData, [consumerNode]: Array<BabelNodeExpression>) {
|
||||||
return t.memberExpression(consumerNode, t.identifier("Provider"));
|
return t.memberExpression(consumerNode, t.identifier("Provider"));
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeReactTemporalFunc(data: OperationDescriptorData, [renderNode, ..._args]: Array<BabelNodeExpression>) {
|
_serializeReactTemporalFunc({ }: OperationDescriptorData, [renderNode, ..._args]: Array<BabelNodeExpression>) {
|
||||||
return t.callExpression(renderNode, ((_args: any): Array<any>));
|
return t.callExpression(renderNode, ((_args: any): Array<any>));
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeCallAbstractFunc(data: OperationDescriptorData, nodes: Array<BabelNodeExpression>) {
|
_serializeCallAbstractFunc({ }: OperationDescriptorData, nodes: Array<BabelNodeExpression>) {
|
||||||
let fun_args = ((nodes.slice(1): any): Array<BabelNodeExpression | BabelNodeSpreadElement>);
|
let fun_args = ((nodes.slice(1): any): Array<BabelNodeExpression | BabelNodeSpreadElement>);
|
||||||
return t.callExpression(nodes[0], fun_args);
|
return t.callExpression(nodes[0], fun_args);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeCallAbstractFuncThis(data: OperationDescriptorData, nodes: Array<BabelNodeExpression>) {
|
_serializeCallAbstractFuncThis({ }: OperationDescriptorData, nodes: Array<BabelNodeExpression>) {
|
||||||
let fun_args = ((nodes.slice(1): any): Array<BabelNodeExpression | BabelNodeSpreadElement>);
|
let fun_args = ((nodes.slice(1): any): Array<BabelNodeExpression | BabelNodeSpreadElement>);
|
||||||
return t.callExpression(t.memberExpression(nodes[0], t.identifier("call")), fun_args);
|
return t.callExpression(t.memberExpression(nodes[0], t.identifier("call")), fun_args);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeDirectCallWithArgList(data: OperationDescriptorData, nodes: Array<BabelNodeExpression>) {
|
_serializeDirectCallWithArgList({ }: OperationDescriptorData, nodes: Array<BabelNodeExpression>) {
|
||||||
let fun_args = nodes.slice(1);
|
let fun_args = nodes.slice(1);
|
||||||
return t.callExpression(nodes[0], ((fun_args: any): Array<BabelNodeExpression | BabelNodeSpreadElement>));
|
return t.callExpression(nodes[0], ((fun_args: any): Array<BabelNodeExpression | BabelNodeSpreadElement>));
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeObjectProtoHasOwnProperty(
|
_serializeObjectProtoHasOwnProperty(
|
||||||
data: OperationDescriptorData,
|
{ }: OperationDescriptorData,
|
||||||
[methodNode, objectNode, nameNode]: Array<BabelNodeExpression>
|
[methodNode, objectNode, nameNode]: Array<BabelNodeExpression>
|
||||||
) {
|
) {
|
||||||
return t.callExpression(t.memberExpression(methodNode, t.identifier("call")), [objectNode, nameNode]);
|
return t.callExpression(t.memberExpression(methodNode, t.identifier("call")), [objectNode, nameNode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeRebuiltObject(data: OperationDescriptorData, [node, propName]: Array<BabelNodeExpression>) {
|
_serializeRebuiltObject({ }: OperationDescriptorData, [node, propName]: Array<BabelNodeExpression>) {
|
||||||
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
||||||
return t.isValidIdentifier(propString)
|
return t.isValidIdentifier(propString)
|
||||||
? t.memberExpression(node, t.identifier(propString), false)
|
? t.memberExpression(node, t.identifier(propString), false)
|
||||||
: t.memberExpression(node, propName, true);
|
: t.memberExpression(node, propName, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeGlobalDelete(data: OperationDescriptorData, [propName]: Array<BabelNodeExpression>) {
|
_serializeGlobalDelete({ }: OperationDescriptorData, [propName]: Array<BabelNodeExpression>) {
|
||||||
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
||||||
return t.expressionStatement(t.unaryExpression("delete", this.preludeGenerator.globalReference(propString, false)));
|
return t.expressionStatement(t.unaryExpression("delete", this.preludeGenerator.globalReference(propString, false)));
|
||||||
}
|
}
|
||||||
@ -671,74 +672,74 @@ export class ResidualOperationSerializer {
|
|||||||
return context.emitDefinePropertyBody(object, propString, desc);
|
return context.emitDefinePropertyBody(object, propString, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeFBMocksMagicGlobalFunction(data: OperationDescriptorData, [propName, ...args]: Array<BabelNodeExpression>) {
|
_serializeFBMocksMagicGlobalFunction({ }: OperationDescriptorData, [propName, ...args]: Array<BabelNodeExpression>) {
|
||||||
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
||||||
return t.callExpression(t.identifier(propString), ((args: any): Array<any>));
|
return t.callExpression(t.identifier(propString), ((args: any): Array<any>));
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeFBMocksBootloaderLoadModules(data: OperationDescriptorData, args: Array<BabelNodeExpression>) {
|
_serializeFBMocksBootloaderLoadModules({ }: OperationDescriptorData, args: Array<BabelNodeExpression>) {
|
||||||
return t.callExpression(
|
return t.callExpression(
|
||||||
t.memberExpression(t.identifier("Bootloader"), t.identifier("loadModules")),
|
t.memberExpression(t.identifier("Bootloader"), t.identifier("loadModules")),
|
||||||
((args: any): Array<any>)
|
((args: any): Array<any>)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeUnknownArrayGetPartial(data: OperationDescriptorData, [o, p]: Array<BabelNodeExpression>) {
|
_serializeUnknownArrayGetPartial({ }: OperationDescriptorData, [o, p]: Array<BabelNodeExpression>) {
|
||||||
return memberExpressionHelper(o, p);
|
return memberExpressionHelper(o, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeObjectGetPartial(data: OperationDescriptorData, [o, p]: Array<BabelNodeExpression>) {
|
_serializeObjectGetPartial({ }: OperationDescriptorData, [o, p]: Array<BabelNodeExpression>) {
|
||||||
return memberExpressionHelper(o, p);
|
return memberExpressionHelper(o, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeAbstractObjectGetPartial(data: OperationDescriptorData, [o, p]: Array<BabelNodeExpression>) {
|
_serializeAbstractObjectGetPartial({ }: OperationDescriptorData, [o, p]: Array<BabelNodeExpression>) {
|
||||||
return memberExpressionHelper(o, p);
|
return memberExpressionHelper(o, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeObjectSetPartial(
|
_serializeObjectSetPartial(
|
||||||
data: OperationDescriptorData,
|
{ }: OperationDescriptorData,
|
||||||
[objectNode, keyNode, valueNode]: Array<BabelNodeExpression>
|
[objectNode, keyNode, valueNode]: Array<BabelNodeExpression>
|
||||||
) {
|
) {
|
||||||
return t.expressionStatement(t.assignmentExpression("=", memberExpressionHelper(objectNode, keyNode), valueNode));
|
return t.expressionStatement(t.assignmentExpression("=", memberExpressionHelper(objectNode, keyNode), valueNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeIdentifier(data: OperationDescriptorData, nodes: Array<BabelNodeExpression>) {
|
_serializeIdentifier({ id }: OperationDescriptorData, nodes: Array<BabelNodeExpression>) {
|
||||||
invariant(typeof data.id === "string");
|
invariant(id !== undefined);
|
||||||
return t.identifier(data.id);
|
return t.identifier(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeCoerceToString(data: OperationDescriptorData, [p]: Array<BabelNodeExpression>) {
|
_serializeCoerceToString({ }: OperationDescriptorData, [p]: Array<BabelNodeExpression>) {
|
||||||
return t.binaryExpression("+", t.stringLiteral(""), p);
|
return t.binaryExpression("+", t.stringLiteral(""), p);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeBabelHelpersObjectWithoutProperties(
|
_serializeBabelHelpersObjectWithoutProperties(
|
||||||
data: OperationDescriptorData,
|
{ }: OperationDescriptorData,
|
||||||
[methodNode, objNode, propRemoveNode]: Array<BabelNodeExpression>
|
[methodNode, objNode, propRemoveNode]: Array<BabelNodeExpression>
|
||||||
) {
|
) {
|
||||||
return t.callExpression(methodNode, [objNode, propRemoveNode]);
|
return t.callExpression(methodNode, [objNode, propRemoveNode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeReactDefaultPropsHelper(data: OperationDescriptorData, [methodNode, ..._args]: Array<BabelNodeExpression>) {
|
_serializeReactDefaultPropsHelper({ }: OperationDescriptorData, [methodNode, ..._args]: Array<BabelNodeExpression>) {
|
||||||
return t.callExpression(methodNode, ((_args: any): Array<any>));
|
return t.callExpression(methodNode, ((_args: any): Array<any>));
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeUnknownArrayMethodCall(data: OperationDescriptorData, [methodNode, ..._args]: Array<BabelNodeExpression>) {
|
_serializeUnknownArrayMethodCall({ }: OperationDescriptorData, [methodNode, ..._args]: Array<BabelNodeExpression>) {
|
||||||
return t.callExpression(methodNode, ((_args: any): Array<any>));
|
return t.callExpression(methodNode, ((_args: any): Array<any>));
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeUnknownArrayLength(data: OperationDescriptorData, [o]: Array<BabelNodeExpression>) {
|
_serializeUnknownArrayLength({ }: OperationDescriptorData, [o]: Array<BabelNodeExpression>) {
|
||||||
return t.memberExpression(o, t.identifier("length"), false);
|
return t.memberExpression(o, t.identifier("length"), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeUnknownArrayMethodPropertyCall(
|
_serializeUnknownArrayMethodPropertyCall(
|
||||||
data: OperationDescriptorData,
|
{ }: OperationDescriptorData,
|
||||||
[objNode, propName, ..._args]: Array<BabelNodeExpression>
|
[objNode, propName, ..._args]: Array<BabelNodeExpression>
|
||||||
) {
|
) {
|
||||||
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
||||||
return t.callExpression(t.memberExpression(objNode, t.identifier(propString)), ((_args: any): Array<any>));
|
return t.callExpression(t.memberExpression(objNode, t.identifier(propString)), ((_args: any): Array<any>));
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeThrow(data: OperationDescriptorData, [argument]: Array<BabelNodeExpression>) {
|
_serializeThrow({ }: OperationDescriptorData, [argument]: Array<BabelNodeExpression>) {
|
||||||
return t.throwStatement(argument);
|
return t.throwStatement(argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -771,11 +772,11 @@ export class ResidualOperationSerializer {
|
|||||||
return t.templateLiteral(((quasis: any): Array<any>), valueNodes);
|
return t.templateLiteral(((quasis: any): Array<any>), valueNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeReactRenderValueHelper(data: OperationDescriptorData, [helperNode, valueNode]: Array<BabelNodeExpression>) {
|
_serializeReactRenderValueHelper({ }: OperationDescriptorData, [helperNode, valueNode]: Array<BabelNodeExpression>) {
|
||||||
return t.callExpression(helperNode, [valueNode]);
|
return t.callExpression(helperNode, [valueNode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializePropertyDelete(data: OperationDescriptorData, [objectNode, propName]: Array<BabelNodeExpression>) {
|
_serializePropertyDelete({ }: OperationDescriptorData, [objectNode, propName]: Array<BabelNodeExpression>) {
|
||||||
return t.expressionStatement(t.unaryExpression("delete", memberExpressionHelper(objectNode, propName)));
|
return t.expressionStatement(t.unaryExpression("delete", memberExpressionHelper(objectNode, propName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -786,18 +787,17 @@ export class ResidualOperationSerializer {
|
|||||||
) {
|
) {
|
||||||
invariant(binding !== undefined);
|
invariant(binding !== undefined);
|
||||||
invariant(context !== undefined);
|
invariant(context !== undefined);
|
||||||
return context.serializeBinding(((binding: any): Binding));
|
return context.serializeBinding(binding);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeForFunctionCall(data: OperationDescriptorData, [func, thisExpr]: Array<BabelNodeExpression>) {
|
_serializeForFunctionCall({ usesThis }: OperationDescriptorData, [func, thisExpr]: Array<BabelNodeExpression>) {
|
||||||
let { usesThis } = data;
|
|
||||||
return usesThis
|
return usesThis
|
||||||
? t.callExpression(t.memberExpression(func, t.identifier("call")), [thisExpr])
|
? t.callExpression(t.memberExpression(func, t.identifier("call")), [thisExpr])
|
||||||
: t.callExpression(func, []);
|
: t.callExpression(func, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeNewExpression(
|
_serializeNewExpression(
|
||||||
data: OperationDescriptorData,
|
{ }: OperationDescriptorData,
|
||||||
[constructorNode, ...argListNodes]: Array<BabelNodeExpression>
|
[constructorNode, ...argListNodes]: Array<BabelNodeExpression>
|
||||||
) {
|
) {
|
||||||
return t.newExpression(constructorNode, argListNodes);
|
return t.newExpression(constructorNode, argListNodes);
|
||||||
@ -814,7 +814,7 @@ export class ResidualOperationSerializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_serializeObjectProtoGetOwnPropertyDescriptor(
|
_serializeObjectProtoGetOwnPropertyDescriptor(
|
||||||
data: OperationDescriptorData,
|
{ }: OperationDescriptorData,
|
||||||
[funcNode, ...args]: Array<BabelNodeExpression>
|
[funcNode, ...args]: Array<BabelNodeExpression>
|
||||||
) {
|
) {
|
||||||
return t.callExpression(funcNode, ((args: any): Array<BabelNodeExpression | BabelNodeSpreadElement>));
|
return t.callExpression(funcNode, ((args: any): Array<BabelNodeExpression | BabelNodeSpreadElement>));
|
||||||
@ -869,46 +869,46 @@ export class ResidualOperationSerializer {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeGlobalAssignment(data: OperationDescriptorData, [valueNode, propName]: Array<BabelNodeExpression>) {
|
_serializeGlobalAssignment({ }: OperationDescriptorData, [valueNode, propName]: Array<BabelNodeExpression>) {
|
||||||
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
let propString = ((propName: any): BabelNodeStringLiteral).value;
|
||||||
return t.expressionStatement(
|
return t.expressionStatement(
|
||||||
t.assignmentExpression("=", this.preludeGenerator.globalReference(propString, false), valueNode)
|
t.assignmentExpression("=", this.preludeGenerator.globalReference(propString, false), valueNode)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeSingleArg(data: OperationDescriptorData, [o]: Array<BabelNodeExpression>) {
|
_serializeSingleArg({ }: OperationDescriptorData, [o]: Array<BabelNodeExpression>) {
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeAbstractProperty(data: OperationDescriptorData, [o, propName]: Array<BabelNodeExpression>) {
|
_serializeAbstractProperty({ }: OperationDescriptorData, [o, propName]: Array<BabelNodeExpression>) {
|
||||||
return memberExpressionHelper(o, propName);
|
return memberExpressionHelper(o, propName);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeUnaryExpression({ op, prefix }: OperationDescriptorData, [x, y]: Array<BabelNodeExpression>) {
|
_serializeUnaryExpression({ unaryOperator, prefix }: OperationDescriptorData, [x, y]: Array<BabelNodeExpression>) {
|
||||||
invariant(op !== undefined);
|
invariant(unaryOperator !== undefined);
|
||||||
return t.unaryExpression(op, x, prefix);
|
return t.unaryExpression(unaryOperator, x, prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeBinaryExpression({ op }: OperationDescriptorData, [x, y]: Array<BabelNodeExpression>) {
|
_serializeBinaryExpression({ binaryOperator }: OperationDescriptorData, [x, y]: Array<BabelNodeExpression>) {
|
||||||
invariant(op !== undefined);
|
invariant(binaryOperator !== undefined);
|
||||||
return t.binaryExpression(op, x, y);
|
return t.binaryExpression(binaryOperator, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeLogicalExpression({ op }: OperationDescriptorData, [x, y]: Array<BabelNodeExpression>) {
|
_serializeLogicalExpression({ logicalOperator }: OperationDescriptorData, [x, y]: Array<BabelNodeExpression>) {
|
||||||
invariant(op !== undefined);
|
invariant(logicalOperator !== undefined);
|
||||||
return t.logicalExpression(op, x, y);
|
return t.logicalExpression(logicalOperator, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeConditionalExpression(data: OperationDescriptorData, [c, x, y]: Array<BabelNodeExpression>) {
|
_serializeConditionalExpression({ }: OperationDescriptorData, [c, x, y]: Array<BabelNodeExpression>) {
|
||||||
return t.conditionalExpression(c, x, y);
|
return t.conditionalExpression(c, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeDerivedOperationDescriptor(
|
_serializeDerivedOperationDescriptor(
|
||||||
data: OperationDescriptorData,
|
{ id }: OperationDescriptorData,
|
||||||
babelNode: BabelNodeExpression
|
babelNode: BabelNodeExpression
|
||||||
): BabelNodeStatement {
|
): BabelNodeStatement {
|
||||||
invariant(typeof data.id === "string");
|
invariant(id !== undefined);
|
||||||
return t.variableDeclaration("var", [t.variableDeclarator(t.identifier(data.id), babelNode)]);
|
return t.variableDeclaration("var", [t.variableDeclarator(t.identifier(id), babelNode)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeVoidOperationDescriptor(babelNode: BabelNodeExpression) {
|
_serializeVoidOperationDescriptor(babelNode: BabelNodeExpression) {
|
||||||
@ -923,7 +923,7 @@ export class ResidualOperationSerializer {
|
|||||||
return template(this.preludeGenerator)(generatorArgs);
|
return template(this.preludeGenerator)(generatorArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
_serializeObjectAssign(data: OperationDescriptorData, [targetNode, ...sourceNodes]: Array<BabelNodeExpression>) {
|
_serializeObjectAssign({ }: OperationDescriptorData, [targetNode, ...sourceNodes]: Array<BabelNodeExpression>) {
|
||||||
return t.callExpression(this.preludeGenerator.memoizeReference("Object.assign"), [targetNode, ...sourceNodes]);
|
return t.callExpression(this.preludeGenerator.memoizeReference("Object.assign"), [targetNode, ...sourceNodes]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,9 @@ import type {
|
|||||||
BabelNodeVariableDeclaration,
|
BabelNodeVariableDeclaration,
|
||||||
BabelNodeBlockStatement,
|
BabelNodeBlockStatement,
|
||||||
BabelNodeLVal,
|
BabelNodeLVal,
|
||||||
|
BabelUnaryOperator,
|
||||||
|
BabelBinaryOperator,
|
||||||
|
BabelLogicalOperator,
|
||||||
} from "@babel/types";
|
} from "@babel/types";
|
||||||
import { concretize, Join, Utils } from "../singletons.js";
|
import { concretize, Join, Utils } from "../singletons.js";
|
||||||
import type { SerializerOptions } from "../options.js";
|
import type { SerializerOptions } from "../options.js";
|
||||||
@ -138,30 +141,34 @@ export type OperationDescriptor = {
|
|||||||
// TODO: gradually remove all these, currently it's a random bag of values
|
// TODO: gradually remove all these, currently it's a random bag of values
|
||||||
// that should be in args or in other places rather than here.
|
// that should be in args or in other places rather than here.
|
||||||
export type OperationDescriptorData = {
|
export type OperationDescriptorData = {
|
||||||
appendLastToInvariantOperationDescriptor?: OperationDescriptor,
|
appendLastToInvariantOperationDescriptor?: OperationDescriptor, // used by INVARIANT
|
||||||
binding?: Binding | PropertyBinding,
|
binding?: Binding, // used by GET_BINDING
|
||||||
boundName?: BabelNodeIdentifier,
|
propertyBinding?: PropertyBinding, // used by LOGICAL_PROPERTY_ASSIGNMENT
|
||||||
callTemplate?: () => BabelNodeExpression,
|
boundName?: BabelNodeIdentifier, // used by FOR_IN
|
||||||
concreteComparisons?: Array<Value>,
|
callTemplate?: () => BabelNodeExpression, // used by EMIT_CALL and EMIT_CALL_AND_CAPTURE_RESULT
|
||||||
desc?: Descriptor,
|
concreteComparisons?: Array<Value>, // used by FULL_INVARIANT_ABSTRACT
|
||||||
generator?: Generator,
|
desc?: Descriptor, // used by DEFINE_PROPERTY
|
||||||
generators?: Array<Generator>,
|
generator?: Generator, // used by DO_WHILE
|
||||||
id?: string,
|
generators?: Array<Generator>, // used by JOIN_GENERATORS
|
||||||
lh?: BabelNodeVariableDeclaration,
|
id?: string, // used by IDENTIFIER and DERIVED
|
||||||
op?: any, // TODO: This is a union of Babel operators, refactor to not use "any" at some point
|
lh?: BabelNodeVariableDeclaration, // used by FOR_IN
|
||||||
prefix?: boolean,
|
unaryOperator?: BabelUnaryOperator, // used by UNARY_EXPRESSION
|
||||||
path?: Value,
|
binaryOperator?: BabelBinaryOperator, // used by BINARY_EXPRESSION
|
||||||
propertyGetter?: SupportedGraphQLGetters,
|
logicalOperator?: BabelLogicalOperator, // used by LOGICAL_EXPRESSION
|
||||||
propRef?: ReferenceName | AbstractValue,
|
incrementor?: "+" | "-", // used by UPDATE_INCREMENTOR
|
||||||
object?: ObjectValue,
|
prefix?: boolean, // used by UNARY_EXPRESSION
|
||||||
quasis?: Array<any>,
|
path?: Value, // used by PROPERTY_ASSIGNMENT, CONDITIONAL_PROPERTY_ASSIGNMENT
|
||||||
state?: "MISSING" | "PRESENT" | "DEFINED",
|
propertyGetter?: SupportedGraphQLGetters, // used by ABSTRACT_OBJECT_GET
|
||||||
thisArg?: BaseValue | Value,
|
propRef?: ReferenceName | AbstractValue, // used by CALL_BAILOUT, and then only if string
|
||||||
template?: PreludeGenerator => ({}) => BabelNodeExpression,
|
object?: ObjectValue, // used by DEFINE_PROPERTY
|
||||||
typeComparisons?: Set<typeof Value>,
|
quasis?: Array<any>, // used by REACT_SSR_TEMPLATE_LITERAL
|
||||||
usesThis?: boolean,
|
state?: "MISSING" | "PRESENT" | "DEFINED", // used by PROPERTY_INVARIANT
|
||||||
value?: Value,
|
thisArg?: BaseValue | Value, // used by CALL_BAILOUT
|
||||||
violationConditionOperationDescriptor?: OperationDescriptor,
|
template?: PreludeGenerator => ({}) => BabelNodeExpression, // used by ABSTRACT_FROM_TEMPLATE
|
||||||
|
typeComparisons?: Set<typeof Value>, // used by FULL_INVARIANT_ABSTRACT
|
||||||
|
usesThis?: boolean, // used by FOR_STATEMENT_FUNC
|
||||||
|
value?: Value, // used by DO_WHILE, CONDITIONAL_PROPERTY_ASSIGNMENT, LOGICAL_PROPERTY_ASSIGNMENT, LOCAL_ASSIGNMENT, CONDITIONAL_THROW, EMIT_PROPERTY_ASSIGNMENT
|
||||||
|
violationConditionOperationDescriptor?: OperationDescriptor, // used by INVARIANT
|
||||||
};
|
};
|
||||||
|
|
||||||
export type OperationDescriptorKind = "DERIVED" | "VOID";
|
export type OperationDescriptorKind = "DERIVED" | "VOID";
|
||||||
@ -258,8 +265,7 @@ export class GeneratorEntry {
|
|||||||
export type TemporalOperationEntryArgs = {
|
export type TemporalOperationEntryArgs = {
|
||||||
declared?: AbstractValue | ObjectValue,
|
declared?: AbstractValue | ObjectValue,
|
||||||
args: Array<Value>,
|
args: Array<Value>,
|
||||||
// If we're just trying to add roots for the serializer to notice, we don't need an operationDescriptor.
|
operationDescriptor: OperationDescriptor,
|
||||||
operationDescriptor?: OperationDescriptor,
|
|
||||||
dependencies?: Array<Generator>,
|
dependencies?: Array<Generator>,
|
||||||
isPure?: boolean,
|
isPure?: boolean,
|
||||||
mutatesOnly?: Array<Value>,
|
mutatesOnly?: Array<Value>,
|
||||||
@ -275,12 +281,12 @@ export class TemporalOperationEntry extends GeneratorEntry {
|
|||||||
invariant(this.args.includes(arg));
|
invariant(this.args.includes(arg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
invariant(this.operationDescriptor !== undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
declared: void | AbstractValue | ObjectValue;
|
declared: void | AbstractValue | ObjectValue;
|
||||||
args: Array<Value>;
|
args: Array<Value>;
|
||||||
// If we're just trying to add roots for the serializer to notice, we don't need an operationDescriptor.
|
operationDescriptor: OperationDescriptor;
|
||||||
operationDescriptor: void | OperationDescriptor;
|
|
||||||
dependencies: void | Array<Generator>;
|
dependencies: void | Array<Generator>;
|
||||||
isPure: void | boolean;
|
isPure: void | boolean;
|
||||||
mutatesOnly: void | Array<Value>;
|
mutatesOnly: void | Array<Value>;
|
||||||
@ -328,24 +334,23 @@ export class TemporalOperationEntry extends GeneratorEntry {
|
|||||||
}
|
}
|
||||||
if (!omit) {
|
if (!omit) {
|
||||||
let nodes = this.args.map((boundArg, i) => context.serializeValue(boundArg));
|
let nodes = this.args.map((boundArg, i) => context.serializeValue(boundArg));
|
||||||
if (this.operationDescriptor !== undefined) {
|
let valuesToProcess = new Set();
|
||||||
let valuesToProcess = new Set();
|
let node = context.serializeOperationDescriptor(this.operationDescriptor, nodes, context, valuesToProcess);
|
||||||
let node = context.serializeOperationDescriptor(this.operationDescriptor, nodes, context, valuesToProcess);
|
if (node.type === "BlockStatement") {
|
||||||
if (node.type === "BlockStatement") {
|
let block: BabelNodeBlockStatement = (node: any);
|
||||||
let block: BabelNodeBlockStatement = (node: any);
|
let statements = block.body;
|
||||||
let statements = block.body;
|
if (statements.length === 0) return;
|
||||||
if (statements.length === 0) return;
|
if (statements.length === 1) {
|
||||||
if (statements.length === 1) {
|
node = statements[0];
|
||||||
node = statements[0];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let declared = this.declared;
|
|
||||||
if (declared !== undefined && context.options.debugScopes) {
|
|
||||||
context.emit(context.serializeDebugScopeComment(declared));
|
|
||||||
}
|
|
||||||
context.emit(node);
|
|
||||||
context.processValues(valuesToProcess);
|
|
||||||
}
|
}
|
||||||
|
let declared = this.declared;
|
||||||
|
if (declared !== undefined && context.options.debugScopes) {
|
||||||
|
context.emit(context.serializeDebugScopeComment(declared));
|
||||||
|
}
|
||||||
|
context.emit(node);
|
||||||
|
context.processValues(valuesToProcess);
|
||||||
|
|
||||||
if (this.declared !== undefined) context.declare(this.declared);
|
if (this.declared !== undefined) context.declare(this.declared);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
import type {
|
import type {
|
||||||
BabelBinaryOperator,
|
BabelBinaryOperator,
|
||||||
BabelNodeExpression,
|
BabelNodeExpression,
|
||||||
BabelNodeLogicalOperator,
|
BabelLogicalOperator,
|
||||||
BabelNodeSourceLocation,
|
BabelNodeSourceLocation,
|
||||||
BabelUnaryOperator,
|
BabelUnaryOperator,
|
||||||
} from "@babel/types";
|
} from "@babel/types";
|
||||||
@ -637,7 +637,7 @@ export default class AbstractValue extends Value {
|
|||||||
? ValuesDomain.topVal
|
? ValuesDomain.topVal
|
||||||
: ValuesDomain.binaryOp(realm, op, leftValues, rightValues);
|
: ValuesDomain.binaryOp(realm, op, leftValues, rightValues);
|
||||||
let [hash, args] = kind === undefined ? hashBinary(op, left, right) : hashCall(kind, left, right);
|
let [hash, args] = kind === undefined ? hashBinary(op, left, right) : hashCall(kind, left, right);
|
||||||
let operationDescriptor = createOperationDescriptor("BINARY_EXPRESSION", { op });
|
let operationDescriptor = createOperationDescriptor("BINARY_EXPRESSION", { binaryOperator: op });
|
||||||
let result = new AbstractValue(realm, resultTypes, resultValues, hash, args, operationDescriptor);
|
let result = new AbstractValue(realm, resultTypes, resultValues, hash, args, operationDescriptor);
|
||||||
result.kind = kind || op;
|
result.kind = kind || op;
|
||||||
result.expressionLocation = loc;
|
result.expressionLocation = loc;
|
||||||
@ -649,7 +649,7 @@ export default class AbstractValue extends Value {
|
|||||||
|
|
||||||
static createFromLogicalOp(
|
static createFromLogicalOp(
|
||||||
realm: Realm,
|
realm: Realm,
|
||||||
op: BabelNodeLogicalOperator,
|
op: BabelLogicalOperator,
|
||||||
left: Value,
|
left: Value,
|
||||||
right: Value,
|
right: Value,
|
||||||
loc?: ?BabelNodeSourceLocation,
|
loc?: ?BabelNodeSourceLocation,
|
||||||
@ -682,7 +682,7 @@ export default class AbstractValue extends Value {
|
|||||||
let Constructor = Value.isTypeCompatibleWith(resultTypes.getType(), ObjectValue)
|
let Constructor = Value.isTypeCompatibleWith(resultTypes.getType(), ObjectValue)
|
||||||
? AbstractObjectValue
|
? AbstractObjectValue
|
||||||
: AbstractValue;
|
: AbstractValue;
|
||||||
let operationDescriptor = createOperationDescriptor("LOGICAL_EXPRESSION", { op });
|
let operationDescriptor = createOperationDescriptor("LOGICAL_EXPRESSION", { logicalOperator: op });
|
||||||
let result = new Constructor(realm, resultTypes, resultValues, hash, args, operationDescriptor);
|
let result = new Constructor(realm, resultTypes, resultValues, hash, args, operationDescriptor);
|
||||||
result.kind = op;
|
result.kind = op;
|
||||||
result.expressionLocation = loc;
|
result.expressionLocation = loc;
|
||||||
@ -736,7 +736,7 @@ export default class AbstractValue extends Value {
|
|||||||
invariant(op !== "delete" && op !== "++" && op !== "--"); // The operation must be pure
|
invariant(op !== "delete" && op !== "++" && op !== "--"); // The operation must be pure
|
||||||
let resultTypes = TypesDomain.unaryOp(op, new TypesDomain(operand.getType()));
|
let resultTypes = TypesDomain.unaryOp(op, new TypesDomain(operand.getType()));
|
||||||
let resultValues = ValuesDomain.unaryOp(realm, op, operand.values);
|
let resultValues = ValuesDomain.unaryOp(realm, op, operand.values);
|
||||||
let operationDescriptor = createOperationDescriptor("UNARY_EXPRESSION", { op, prefix });
|
let operationDescriptor = createOperationDescriptor("UNARY_EXPRESSION", { unaryOperator: op, prefix });
|
||||||
let result = new AbstractValue(
|
let result = new AbstractValue(
|
||||||
realm,
|
realm,
|
||||||
resultTypes,
|
resultTypes,
|
||||||
|
Loading…
Reference in New Issue
Block a user