How to use the isAssignmentExpression function from @babel/types

Find comprehensive JavaScript @babel/types.isAssignmentExpression code examples handpicked from public code repositorys.

106
107
108
109
110
111
112
113
114
115
  }
});
if (!t.isIfStatement(alternate) && alternate) {
  alternate.body.map(({ expression }) => {
    if (
      t.isAssignmentExpression(expression) &&
      expression.operator === '='
    ) {
      const varName = expression.left.name;
      const rightNode = expression.right;
fork icon663
star icon0
watch icon1

+ 7 other calls in file

219
220
221
222
223
224
225
226
227
228
for (number in consequ) {
    //判断什么节点需要加入

    if (!types.isBreakStatement(consequ[number])) {
        //如果不是break进入
        if (types.isExpressionStatement(consequ[number]) && types.isAssignmentExpression(consequ[number].expression) && consequ[number].expression.left.name == indexname) {
            if (!breakmakes) {
                index = index - 1

            }
fork icon6
star icon18
watch icon1

+ 2 other calls in file

179
180
181
182
183
184
185
186
187
188
ReturnStatement: (path_) => {
  const node_ = path_.node;
  if (
    node_.argument &&
    t.isSequenceExpression(node_.argument) &&
    t.isAssignmentExpression(node_.argument.expressions[0]) &&
    t.isBinaryExpression(node_.argument.expressions[0].right) &&
    node_.argument.expressions[0].right.operator === '-' &&
    !isNaN(node_.argument.expressions[0].right.right.value)
  ) {
fork icon5
star icon15
watch icon1

+ 31 other calls in file

14
15
16
17
18
19
20
21
22
23
AwaitExpression(path) {
  // 首先保证 await 语句没有被 try/catch 包裹
  if (path.findParent(path => t.isTryStatement(path.node))) return;
  const parent = path.parent;
  let replacePath = null;
  if (t.isVariableDeclarator(parent) || t.isAssignmentExpression(parent)) {
    // 赋值和声明的方式结构类似,都是在 AwaitExpression 中 path 的 parentPath.parentPath 上的节点就是 blockStatement 所需要的的参数,可以直接这么替换
    // console.log("AwaitExpression -> path.parentPath", path.parentPath)
    replacePath = path.parentPath.parentPath;
  } else {
fork icon2
star icon12
watch icon0

966
967
968
969
970
971
972
973
974
975
976
function transformSequenceExpression (path, targetPath, keyNode) {
    if (!t.isSequenceExpression(path)) return


    var expressions = path.expressions || path.node.expressions || []
    if (expressions.length > 1
        && t.isAssignmentExpression(expressions[0])
        && t.isIdentifier(expressions[expressions.length - 1])) {
        var objExpression = t.objectExpression([])
        expressions.map(function (subPath) {
            if (t.isAssignmentExpression(subPath)) {
fork icon220
star icon0
watch icon0

311
312
313
314
315
316
317
318
319
320
// n = m;
// n['xyz'](a, b)
// So we need to find all the assignments and fill them with the right keys
proxyFnBinding.referencePaths.forEach((refPath) => {
  if (
    t.isAssignmentExpression(refPath.parentPath.node) &&
    t.isIdentifier(refPath.parentPath.node.left)
  ) {
    const refBinding = refPath.scope.getBinding(
      refPath.parentPath.node.left.name
fork icon0
star icon6
watch icon1

+ 221 other calls in file

171
172
173
174
175
176
177
178
179
    callRestore(path.parentPath)
}

//  当修改了指针的时候
if (path.isExpressionStatement() &&
    types.isAssignmentExpression(node.expression) &&
    node.expression.left.name === getScopeInfo("indexName")) {
    return evaluationExpression(node, getScopeInfo("indexName"), ++scope.slice(-1)[0]['index']);
}
fork icon0
star icon0
watch icon1

+ 8 other calls in file

140
141
142
143
144
145
146
147
148
149
150
151
    return t.isUnaryExpression(path) && path.node.operator === 'void';
}


function isInteropRequireCall(path) {
    var expression = findExpression(path);
    var isAssignmentCall = t.isAssignmentExpression(expression) && t.isCallExpression(expression.get('right'));


    if (isAssignmentCall) {
        var callee = expression.get('right.callee');
        return callee.isIdentifier() && callee.node.name.indexOf(INTEROP_FUNCTION_NAME) === 0;
fork icon0
star icon0
watch icon0

+ 5 other calls in file

12
13
14
15
16
17
18
19
20
21
22


function crawl(node, state = {}) {
  if (t.isMemberExpression(node) || t.isOptionalMemberExpression(node)) {
    crawl(node.object, state);
    if (node.computed) crawl(node.property, state);
  } else if (t.isBinary(node) || t.isAssignmentExpression(node)) {
    crawl(node.left, state);
    crawl(node.right, state);
  } else if (t.isCallExpression(node) || t.isOptionalCallExpression(node)) {
    state.hasCall = true;
fork icon0
star icon0
watch icon0

124
125
126
127
128
129
130
131
132
133
134
135
136


    return false;
}


function isObjectAssignment(path, objectId) {
    var expression = t.isAssignmentExpression(path) ? path : findExpression(path);
    var isMemberAssignment = t.isAssignmentExpression(expression) && t.isMemberExpression(expression.get('left'));


    if (isMemberAssignment) {
        return t.isNodesEquivalent(expression.get('left.object').node, objectId);
fork icon0
star icon0
watch icon0

+ 14 other calls in file

275
276
277
278
279
280
281
282
283
284

if (hasPostfixPart(node, parent) && !t.isNewExpression(parent) || t.isSequenceExpression(parent) && parent.expressions[0] === node || t.isConditional(parent, {
  test: node
}) || t.isBinary(parent, {
  left: node
}) || t.isAssignmentExpression(parent, {
  left: node
})) {
  node = parent;
  i--;
fork icon0
star icon0
watch icon0

+ 2 other calls in file

80
81
82
83
84
85
86
87
88
89
let declaration = declarations[i - 1]
let identifier
if (t.isVariableDeclarator(declaration)) {
  identifier = declaration.id
  declaration = declaration.init
} else if (t.isExpressionStatement(declaration) && t.isAssignmentExpression(declaration.expression)) {
  identifier = declaration.expression.left
  declaration = declaration.expression.right
}
// __sfc_main.components = Object.assign({CustomButton}, __sfc_main.components);
fork icon0
star icon0
watch icon506

+ 3 other calls in file

Other functions in @babel/types

Sorted by popularity

function icon

@babel/types.identifier is the most popular function in @babel/types (20936 examples)