Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsdc

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsdc - npm Package Compare versions

Comparing version 0.5.2 to 0.5.3

2

package.json
{
"name": "jsdc",
"version": "0.5.2",
"version": "0.5.3",
"description": "compiler ecmascript6 to ecmascript5",

@@ -5,0 +5,0 @@ "maintainers": [

@@ -121,3 +121,3 @@ var homunculus = require('homunculus');

var arglist = args.leaf(1);
if(arglist.size() > 1) {
if(arglist && arglist.size() > 1) {
var last = arglist.last();

@@ -124,0 +124,0 @@ var spread = last.prev();

@@ -8,4 +8,17 @@ define(function(require, exports, module){var homunculus = require('homunculus');

this.jsdc = jsdc;
this.hash = {};
}).methods({
parse: function(node) {
//var nid = node.nid();
////遍历查看是否有调用this和arguments,存储引用实现lexical绑定
//this.recursion(node.last(), nid);
//if(this.hash.hasOwnProperty(nid)) {
// var o = this.hash[nid];
// if(o.this) {
// this.jsdc.append('var ' + o.this + '=this;');
// }
// if(o.arguments) {
// this.jsdc.append('var ' + o.arguments + '=arguments;');
// }
//}
this.jsdc.append('function');

@@ -40,2 +53,33 @@ },

}
},
recursion: function(node, nid) {
var self = this;
if(node.isToken()) {
var token = node.token();
if(!token.isVirtual()) {
var s = token.content();
if(s == 'this' || s == 'arguments') {
this.hash[nid] = this.hash[nid] || {};
this.hash[nid][s] = this.jsdc.uid();
}
}
}
else {
node.leaves().forEach(function(leaf) {
switch(leaf.name()) {
case JsNode.CLASSDECL:
case JsNode.CLASSEXPR:
case JsNode.FNDECL:
case JsNode.FNEXPR:
case JsNode.ARROWFN:
case JsNode.GENDECL:
case JsNode.GENEXPR:
case JsNode.OBJLTR:
case JsNode.WITHSTMT:
return;
default:
self.recursion(leaf, nid);
}
});
}
}

@@ -42,0 +86,0 @@ });

@@ -121,3 +121,3 @@ define(function(require, exports, module){var homunculus = require('homunculus');

var arglist = args.leaf(1);
if(arglist.size() > 1) {
if(arglist && arglist.size() > 1) {
var last = arglist.last();

@@ -124,0 +124,0 @@ var spread = last.prev();

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc