babel-plugin-aexpr-source-transformation
Advanced tools
Comparing version 2.1.3 to 2.2.0
@@ -154,3 +154,9 @@ "use strict"; | ||
path.replaceWith(t.callExpression(addCustomTemplate(state.file, SET_MEMBER), [path.node.left.object, getPropertyFromMemberExpression(path.node.left), t.stringLiteral(path.node.operator), path.node.right])); | ||
if (!SET_MEMBER_BY_OPERATORS[path.node.operator]) { | ||
return; | ||
} | ||
path.replaceWith(t.callExpression(addCustomTemplate(state.file, SET_MEMBER_BY_OPERATORS[path.node.operator]), [path.node.left.object, getPropertyFromMemberExpression(path.node.left), | ||
//t.stringLiteral(path.node.operator), | ||
path.node.right])); | ||
}, | ||
@@ -308,2 +314,18 @@ MemberExpression: function MemberExpression(path) { | ||
var SET_MEMBER_BY_OPERATORS = { | ||
'=': 'setMember', | ||
'+=': 'setMemberAddition', | ||
'-=': 'setMemberSubtraction', | ||
'*=': 'setMemberMultiplication', | ||
'/=': 'setMemberDivision', | ||
'%=': 'setMemberRemainder', | ||
//'**=': 'setMemberExponentiation', | ||
'<<=': 'setMemberLeftShift', | ||
'>>=': 'setMemberRightShift', | ||
'>>>=': 'setMemberUnsignedRightShift', | ||
'&=': 'setMemberBitwiseAND', | ||
'^=': 'setMemberBitwiseXOR', | ||
'|=': 'setMemberBitwiseOR' | ||
}; | ||
// const SET_LOCAL = "setLocal"; | ||
@@ -310,0 +332,0 @@ // const GET_LOCAL = "getLocal"; |
22
index.js
@@ -10,2 +10,18 @@ const AEXPR_IDENTIFIER_NAME = "aexpr"; | ||
const SET_MEMBER_BY_OPERATORS = { | ||
'=': 'setMember', | ||
'+=': 'setMemberAddition', | ||
'-=': 'setMemberSubtraction', | ||
'*=': 'setMemberMultiplication', | ||
'/=': 'setMemberDivision', | ||
'%=': 'setMemberRemainder', | ||
//'**=': 'setMemberExponentiation', | ||
'<<=': 'setMemberLeftShift', | ||
'>>=': 'setMemberRightShift', | ||
'>>>=': 'setMemberUnsignedRightShift', | ||
'&=': 'setMemberBitwiseAND', | ||
'^=': 'setMemberBitwiseXOR', | ||
'|=': 'setMemberBitwiseOR' | ||
}; | ||
// const SET_LOCAL = "setLocal"; | ||
@@ -175,9 +191,11 @@ // const GET_LOCAL = "getLocal"; | ||
if(!SET_MEMBER_BY_OPERATORS[path.node.operator]) { return; } | ||
path.replaceWith( | ||
t.callExpression( | ||
addCustomTemplate(state.file, SET_MEMBER), | ||
addCustomTemplate(state.file, SET_MEMBER_BY_OPERATORS[path.node.operator]), | ||
[ | ||
path.node.left.object, | ||
getPropertyFromMemberExpression(path.node.left), | ||
t.stringLiteral(path.node.operator), | ||
//t.stringLiteral(path.node.operator), | ||
path.node.right | ||
@@ -184,0 +202,0 @@ ] |
{ | ||
"name": "babel-plugin-aexpr-source-transformation", | ||
"version": "2.1.3", | ||
"version": "2.2.0", | ||
"description": "3rd implementation strategy of active expressions, via a babel transformation", | ||
@@ -26,2 +26,3 @@ "main": "dist/index.js", | ||
"expression", | ||
"expressions", | ||
"active-expression" | ||
@@ -28,0 +29,0 @@ ], |
@@ -10,2 +10,2 @@ import { getMember as _getMember } from "aexpr-source-transformation-propagation"; | ||
// Mixin everything together | ||
_setMember(_getAndCallMember(a, "fn", []), _getMember(c, "d"), "=", 1); | ||
_setMember(_getAndCallMember(a, "fn", []), _getMember(c, "d"), 1); |
@@ -5,6 +5,6 @@ import { getMember as _getMember } from "aexpr-source-transformation-propagation"; | ||
constructor(x, y, width, height) { | ||
_setMember(this, "x", "=", x); | ||
_setMember(this, "y", "=", y); | ||
_setMember(this, "width", "=", width); | ||
_setMember(this, "height", "=", height); | ||
_setMember(this, "x", x); | ||
_setMember(this, "y", y); | ||
_setMember(this, "width", width); | ||
_setMember(this, "height", height); | ||
} | ||
@@ -11,0 +11,0 @@ |
import { getMember as _getMember } from "aexpr-source-transformation-propagation"; | ||
import { setMember as _setMember } from "aexpr-source-transformation-propagation"; | ||
// nested left side of assignment | ||
_setMember(_getMember(a, "b"), "c", "=", _getMember(y, "z")); | ||
_setMember(_getMember(a, "b"), "c", _getMember(y, "z")); |
@@ -17,3 +17,4 @@ "use strict"; | ||
{file: 'class_example'}, | ||
{file: 'with_aexpr'} | ||
{file: 'with_aexpr'}, | ||
{file: 'operators'} | ||
]; | ||
@@ -20,0 +21,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34024
24
686