Comparing version 0.3.4 to 0.3.5
{ | ||
"name": "jsdc", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "transform ecmascript6 to ecmascript5", | ||
@@ -42,3 +42,5 @@ "maintainers": [ | ||
"ecmascript6", | ||
"ecmascript5" | ||
"ecmascript5", | ||
"transform", | ||
"compiler" | ||
], | ||
@@ -51,3 +53,3 @@ "author": "army8735", | ||
"dependencies": { | ||
"homunculus": "^0.2.7-3" | ||
"homunculus": "^0.3.0-2" | ||
}, | ||
@@ -54,0 +56,0 @@ "devDependencies": { |
@@ -355,3 +355,3 @@ # Javascript Downcast | ||
``` | ||
getter/setter会巧妙地设置到原型上: | ||
getter/setter会通过`Object.defineProperty`巧妙地设置到原型上: | ||
```js | ||
@@ -365,7 +365,7 @@ class A{ | ||
function A(){} | ||
A.prototype.b={get b(){}}["b"]; | ||
A.prototype.c={set c(d){}}["c"]; | ||
Object.defineProperty(A.prototype, "b", {get :function(){}}); | ||
Object.defineProperty(A.prototype, "c", {set :function(d){}}); | ||
``` | ||
`static`静态属性会附加在`function`本身: | ||
`static`静态方法会附加在`function`本身: | ||
```js | ||
@@ -372,0 +372,0 @@ class A{ |
@@ -246,2 +246,5 @@ var homunculus = require('homunculus'); | ||
break; | ||
case JsNode.PROPTNAME: | ||
this.klass.prptn(node); | ||
break; | ||
case JsNode.MODULEBODY: | ||
@@ -248,0 +251,0 @@ this.module.enter(node); |
@@ -11,2 +11,3 @@ var homunculus = require('homunculus'); | ||
this.sup = {}; | ||
this.gs = {}; | ||
}).methods({ | ||
@@ -119,4 +120,8 @@ parse: function(node, start) { | ||
if(start) { | ||
var prptn = first.next(); | ||
this.gs[prptn.nid()] = true; | ||
this.jsdc.ignore(prptn); | ||
this.jsdc.append('Object.defineProperty('); | ||
this.jsdc.append(o.name); | ||
this.jsdc.append('.prototype.'); | ||
this.jsdc.append('.prototype, "'); | ||
if(token.content() == 'get') { | ||
@@ -132,13 +137,6 @@ var n = first.next().first().first().token(); | ||
} | ||
this.jsdc.append('={'); | ||
this.jsdc.append('", {'); | ||
} | ||
else { | ||
this.jsdc.appendBefore('}["'); | ||
if(token.content() == 'get') { | ||
this.jsdc.appendBefore(o.g); | ||
} | ||
else { | ||
this.jsdc.appendBefore(o.s); | ||
} | ||
this.jsdc.appendBefore('"];'); | ||
this.jsdc.appendBefore('});'); | ||
} | ||
@@ -155,2 +153,7 @@ } | ||
}, | ||
prptn: function(node) { | ||
if(this.gs.hasOwnProperty(node.nid())) { | ||
this.jsdc.append(':function'); | ||
} | ||
}, | ||
super: function(node) { | ||
@@ -157,0 +160,0 @@ this.jsdc.ignore(node); |
@@ -247,2 +247,5 @@ define(function(require, exports, module) { | ||
break; | ||
case JsNode.PROPTNAME: | ||
this.klass.prptn(node); | ||
break; | ||
case JsNode.MODULEBODY: | ||
@@ -249,0 +252,0 @@ this.module.enter(node); |
@@ -12,2 +12,3 @@ define(function(require, exports, module) { | ||
this.sup = {}; | ||
this.gs = {}; | ||
}).methods({ | ||
@@ -120,4 +121,8 @@ parse: function(node, start) { | ||
if(start) { | ||
var prptn = first.next(); | ||
this.gs[prptn.nid()] = true; | ||
this.jsdc.ignore(prptn); | ||
this.jsdc.append('Object.defineProperty('); | ||
this.jsdc.append(o.name); | ||
this.jsdc.append('.prototype.'); | ||
this.jsdc.append('.prototype, "'); | ||
if(token.content() == 'get') { | ||
@@ -133,13 +138,6 @@ var n = first.next().first().first().token(); | ||
} | ||
this.jsdc.append('={'); | ||
this.jsdc.append('", {'); | ||
} | ||
else { | ||
this.jsdc.appendBefore('}["'); | ||
if(token.content() == 'get') { | ||
this.jsdc.appendBefore(o.g); | ||
} | ||
else { | ||
this.jsdc.appendBefore(o.s); | ||
} | ||
this.jsdc.appendBefore('"];'); | ||
this.jsdc.appendBefore('});'); | ||
} | ||
@@ -156,2 +154,7 @@ } | ||
}, | ||
prptn: function(node) { | ||
if(this.gs.hasOwnProperty(node.nid())) { | ||
this.jsdc.append(':function'); | ||
} | ||
}, | ||
super: function(node) { | ||
@@ -158,0 +161,0 @@ this.jsdc.ignore(node); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
212277
52
4893
1
+ Addedhomunculus@0.3.8(transitive)
- Removedhomunculus@0.2.9(transitive)
Updatedhomunculus@^0.3.0-2