Comparing version 0.5.11 to 0.5.12
{ | ||
"name": "jsdc", | ||
"version": "0.5.11", | ||
"version": "0.5.12", | ||
"description": "compiler ecmascript6 to ecmascript5", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
@@ -13,3 +13,6 @@ var homunculus = require('homunculus'); | ||
this.sup = {}; | ||
this.gsh = {}; | ||
this.gssh = {}; | ||
this.gs = {}; | ||
this.gss = {}; | ||
}).methods({ | ||
@@ -44,2 +47,8 @@ parse: function(node, start) { | ||
var o = this.hash[node.nid()]; | ||
if(o.gs) { | ||
this.jsdc.appendBefore('Object.keys(' + o.gs + ').forEach(function(k){Object.defineProperty(' + o.name + '.prototype,k,' + o.gs + '[k])});'); | ||
} | ||
if(o.gss) { | ||
this.jsdc.appendBefore('Object.keys(' + o.gss + ').forEach(function(k){Object.defineProperty(' + o.name + ',k,' + o.gss + '[k])});'); | ||
} | ||
if(o.extend) { | ||
@@ -125,2 +134,6 @@ this.jsdc.appendBefore('Object.keys(' + o.extend + ').forEach(function(k){' + o.name + '[k]=' + o.extend + '[k]});'); | ||
if(start) { | ||
if(!o.gs) { | ||
o.gs = this.jsdc.uid(); | ||
this.jsdc.append('var ' + o.gs + '={};'); | ||
} | ||
var token = first.token(); | ||
@@ -130,9 +143,14 @@ var prptn = first.next(); | ||
this.jsdc.ignore(prptn, 'klass14'); | ||
this.jsdc.append('Object.defineProperty('); | ||
this.jsdc.append(o.name); | ||
this.jsdc.append('.prototype, "'); | ||
//this.jsdc.append('Object.defineProperty('); | ||
//this.jsdc.append(o.name); | ||
//this.jsdc.append('.prototype, "'); | ||
if(token.content() == 'get') { | ||
var n = first.next().first().first().token(); | ||
o.g = n.content(); | ||
this.jsdc.append(o.g); | ||
//this.jsdc.append(o.g); | ||
if(!this.gsh.hasOwnProperty(o.g)) { | ||
this.gsh[o.g] = true; | ||
this.jsdc.append(o.gs + '.' + o.g + '={};'); | ||
} | ||
this.jsdc.append(o.gs + '.' + o.g + '.'); | ||
} | ||
@@ -142,8 +160,13 @@ else { | ||
o.s = n.content(); | ||
this.jsdc.append(o.s); | ||
//this.jsdc.append(o.s); | ||
if(!this.gsh.hasOwnProperty(o.s)) { | ||
this.gsh[o.s] = true; | ||
this.jsdc.append(o.gs + '.' + o.s + '={};'); | ||
} | ||
this.jsdc.append(o.gs + '.' + o.s + '.'); | ||
} | ||
this.jsdc.append('", {'); | ||
//this.jsdc.append('", {'); | ||
} | ||
else { | ||
this.jsdc.appendBefore('});'); | ||
//this.jsdc.appendBefore('});'); | ||
} | ||
@@ -164,14 +187,23 @@ } | ||
if(start) { | ||
if(!o.gss) { | ||
o.gss = this.jsdc.uid(); | ||
this.jsdc.append('var ' + o.gss + '={};'); | ||
} | ||
this.jsdc.ignore(token, 'klass17'); | ||
token = first.token(); | ||
var prptn = first.next(); | ||
this.gs[prptn.nid()] = true; | ||
this.gss[prptn.nid()] = true; | ||
this.jsdc.ignore(prptn, 'klass18'); | ||
this.jsdc.append('Object.defineProperty('); | ||
this.jsdc.append(o.name); | ||
this.jsdc.append(', "'); | ||
//this.jsdc.append('Object.defineProperty('); | ||
//this.jsdc.append(o.name); | ||
//this.jsdc.append(', "'); | ||
if(token.content() == 'get') { | ||
var n = first.next().first().first().token(); | ||
o.g = n.content(); | ||
this.jsdc.append(o.g); | ||
//this.jsdc.append(o.g); | ||
if(!this.gssh.hasOwnProperty(o.g)) { | ||
this.gssh[o.g] = true; | ||
this.jsdc.append(o.gss + '.' + o.g + '={};'); | ||
} | ||
this.jsdc.append(o.gss + '.' + o.g + '.'); | ||
} | ||
@@ -181,8 +213,13 @@ else { | ||
o.s = n.content(); | ||
this.jsdc.append(o.s); | ||
//this.jsdc.append(o.s); | ||
if(!this.gssh.hasOwnProperty(o.s)) { | ||
this.gssh[o.s] = true; | ||
this.jsdc.append(o.gss + '.' + o.s + '={};'); | ||
} | ||
this.jsdc.append(o.gss + '.' + o.s + '.'); | ||
} | ||
this.jsdc.append('", {'); | ||
//this.jsdc.append('", {'); | ||
} | ||
else { | ||
this.jsdc.appendBefore('});'); | ||
//this.jsdc.appendBefore('});'); | ||
} | ||
@@ -193,4 +230,4 @@ } | ||
prptn: function(node) { | ||
if(this.gs.hasOwnProperty(node.nid())) { | ||
this.jsdc.append(':function'); | ||
if(this.gs.hasOwnProperty(node.nid()) || this.gss.hasOwnProperty(node.nid())) { | ||
this.jsdc.append('=function'); | ||
} | ||
@@ -197,0 +234,0 @@ }, |
@@ -13,3 +13,6 @@ define(function(require, exports, module){var homunculus = require('homunculus'); | ||
this.sup = {}; | ||
this.gsh = {}; | ||
this.gssh = {}; | ||
this.gs = {}; | ||
this.gss = {}; | ||
}).methods({ | ||
@@ -44,2 +47,8 @@ parse: function(node, start) { | ||
var o = this.hash[node.nid()]; | ||
if(o.gs) { | ||
this.jsdc.appendBefore('Object.keys(' + o.gs + ').forEach(function(k){Object.defineProperty(' + o.name + '.prototype,k,' + o.gs + '[k])});'); | ||
} | ||
if(o.gss) { | ||
this.jsdc.appendBefore('Object.keys(' + o.gss + ').forEach(function(k){Object.defineProperty(' + o.name + ',k,' + o.gss + '[k])});'); | ||
} | ||
if(o.extend) { | ||
@@ -125,2 +134,6 @@ this.jsdc.appendBefore('Object.keys(' + o.extend + ').forEach(function(k){' + o.name + '[k]=' + o.extend + '[k]});'); | ||
if(start) { | ||
if(!o.gs) { | ||
o.gs = this.jsdc.uid(); | ||
this.jsdc.append('var ' + o.gs + '={};'); | ||
} | ||
var token = first.token(); | ||
@@ -130,9 +143,14 @@ var prptn = first.next(); | ||
this.jsdc.ignore(prptn, 'klass14'); | ||
this.jsdc.append('Object.defineProperty('); | ||
this.jsdc.append(o.name); | ||
this.jsdc.append('.prototype, "'); | ||
//this.jsdc.append('Object.defineProperty('); | ||
//this.jsdc.append(o.name); | ||
//this.jsdc.append('.prototype, "'); | ||
if(token.content() == 'get') { | ||
var n = first.next().first().first().token(); | ||
o.g = n.content(); | ||
this.jsdc.append(o.g); | ||
//this.jsdc.append(o.g); | ||
if(!this.gsh.hasOwnProperty(o.g)) { | ||
this.gsh[o.g] = true; | ||
this.jsdc.append(o.gs + '.' + o.g + '={};'); | ||
} | ||
this.jsdc.append(o.gs + '.' + o.g + '.'); | ||
} | ||
@@ -142,8 +160,13 @@ else { | ||
o.s = n.content(); | ||
this.jsdc.append(o.s); | ||
//this.jsdc.append(o.s); | ||
if(!this.gsh.hasOwnProperty(o.s)) { | ||
this.gsh[o.s] = true; | ||
this.jsdc.append(o.gs + '.' + o.s + '={};'); | ||
} | ||
this.jsdc.append(o.gs + '.' + o.s + '.'); | ||
} | ||
this.jsdc.append('", {'); | ||
//this.jsdc.append('", {'); | ||
} | ||
else { | ||
this.jsdc.appendBefore('});'); | ||
//this.jsdc.appendBefore('});'); | ||
} | ||
@@ -164,14 +187,23 @@ } | ||
if(start) { | ||
if(!o.gss) { | ||
o.gss = this.jsdc.uid(); | ||
this.jsdc.append('var ' + o.gss + '={};'); | ||
} | ||
this.jsdc.ignore(token, 'klass17'); | ||
token = first.token(); | ||
var prptn = first.next(); | ||
this.gs[prptn.nid()] = true; | ||
this.gss[prptn.nid()] = true; | ||
this.jsdc.ignore(prptn, 'klass18'); | ||
this.jsdc.append('Object.defineProperty('); | ||
this.jsdc.append(o.name); | ||
this.jsdc.append(', "'); | ||
//this.jsdc.append('Object.defineProperty('); | ||
//this.jsdc.append(o.name); | ||
//this.jsdc.append(', "'); | ||
if(token.content() == 'get') { | ||
var n = first.next().first().first().token(); | ||
o.g = n.content(); | ||
this.jsdc.append(o.g); | ||
//this.jsdc.append(o.g); | ||
if(!this.gssh.hasOwnProperty(o.g)) { | ||
this.gssh[o.g] = true; | ||
this.jsdc.append(o.gss + '.' + o.g + '={};'); | ||
} | ||
this.jsdc.append(o.gss + '.' + o.g + '.'); | ||
} | ||
@@ -181,8 +213,13 @@ else { | ||
o.s = n.content(); | ||
this.jsdc.append(o.s); | ||
//this.jsdc.append(o.s); | ||
if(!this.gssh.hasOwnProperty(o.s)) { | ||
this.gssh[o.s] = true; | ||
this.jsdc.append(o.gss + '.' + o.s + '={};'); | ||
} | ||
this.jsdc.append(o.gss + '.' + o.s + '.'); | ||
} | ||
this.jsdc.append('", {'); | ||
//this.jsdc.append('", {'); | ||
} | ||
else { | ||
this.jsdc.appendBefore('});'); | ||
//this.jsdc.appendBefore('});'); | ||
} | ||
@@ -193,4 +230,4 @@ } | ||
prptn: function(node) { | ||
if(this.gs.hasOwnProperty(node.nid())) { | ||
this.jsdc.append(':function'); | ||
if(this.gs.hasOwnProperty(node.nid()) || this.gss.hasOwnProperty(node.nid())) { | ||
this.jsdc.append('=function'); | ||
} | ||
@@ -197,0 +234,0 @@ }, |
Sorry, the diff of this file is not supported yet
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
313769
8193