This commit is contained in:
Sebastian McKenzie
2015-02-07 09:54:18 +11:00
parent 306cfc6328
commit 726451f86f
7 changed files with 73 additions and 21 deletions

View File

@@ -37,7 +37,12 @@ ReplaceSupers.prototype.setSuperProperty = function (property, value, isStatic,
return t.callExpression(
this.file.addHelper("set"),
[
isStatic ? this.superName : t.memberExpression(this.superName, t.identifier("prototype")),
t.callExpression(
t.memberExpression(t.identifier("Object"), t.identifier("getPrototypeOf")),
[
isStatic ? this.className : t.memberExpression(this.className, t.identifier("prototype"))
]
),
isComputed ? property : t.literal(property.name),
value,
thisExpression
@@ -63,7 +68,12 @@ ReplaceSupers.prototype.getSuperProperty = function (property, isStatic, isCompu
return t.callExpression(
this.file.addHelper("get"),
[
isStatic ? this.superName : t.memberExpression(this.superName, t.identifier("prototype")),
t.callExpression(
t.memberExpression(t.identifier("Object"), t.identifier("getPrototypeOf")),
[
isStatic ? this.className : t.memberExpression(this.className, t.identifier("prototype"))
]
),
isComputed ? property : t.literal(property.name),
thisExpression
]