New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ql.io-compiler

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ql.io-compiler - npm Package Compare versions

Comparing version 0.8.1 to 0.8.2

146

lib/compiler.js

@@ -15,3 +15,3 @@ /*

* limitations under the License.
*/
**/

@@ -58,2 +58,41 @@ 'use strict';

var maxid = 0;
function divescope(lines, scope) {
if (!lines){
return;
}
var i, line;
for (i = 0; i < lines.length; i++) {
line = lines[i];
maxid = line.id > maxid ? line.id : maxid;
if(scope){
line.scope = scope;
}
if(line.assign) {
if(symbols[line.assign]) {
throw new this.SyntaxError('Duplicate symbol ' + line.assign);
}
else {
symbols[line.assign] = line;
}
}
else if(line.type === 'create') { // Makes sense when DDL is inline
symbols[line.name] = line;
creates[line.id.toString()] = line;
}
else if (line.type === 'if') {
divescope(line.if, line);
divescope(line.else, line);
}
else if (line.type === 'try') {
//dependsOn are the lines in try clause
divescope(line.dependsOn, line);
_.each(line.catchClause, function(k, mycatch){
divescope(mycatch.lines, line);
});
if(line.finallyClause) {
divescope(line.finallyClause, line);
}
}
}
}
for(i = 0; i < compiled.length; i++) {

@@ -87,2 +126,20 @@ line = compiled[i];

}
else if (line.type === 'if') {
divescope(line.if, line);
if (line.else){
divescope(line.else, line);
}
single = line;
}
else if (line.type === 'try') {
//dependsOn are the lines in try clause
divescope(line.dependsOn,line);
_.each(line.catchClause, function(mycatch, k){
divescope(mycatch.lines, line);
});
if(line.finallyClause) {
divescope(line.finallyClause, line);
}
single = line;
}
else {

@@ -144,2 +201,5 @@ single = line;

}
if(node.scope) {
used.push(node.scope.id);
}
}

@@ -177,3 +237,2 @@ used.push(ret.rhs.id);

ret.rhs.dependsOn = creates.concat(ret.rhs.dependsOn);
return ret;

@@ -195,13 +254,5 @@ }

introspectObject(line.object, symbols, line.dependsOn, line);
if(line.fallback) {
walk(line.fallback, symbols);
}
break;
case 'return':
walk(line.rhs, symbols);
if(line.fallback) {
walk(line.fallback, symbols);
}
// Route

@@ -221,12 +272,19 @@ if(line.route) {

line = introspectWhere(line, symbols);
if(line.fallback) {
walk(line.fallback, symbols);
}
break;
case 'insert':
introspectFrom(line, [line.source], symbols);
if(line.fallback) {
walk(line.fallback, symbols);
if(line.columns){
_.each(line.values, function(val) {
//introspectString(line, val, symbols);
introspectString(val, symbols, line.dependsOn, line);
})
}
if(line.jsonObj) {
introspectString(line.jsonObj.value, symbols, line.dependsOn, line);
}
break;
case 'update':
introspectFrom(line, [line.source], symbols);
introspectString(line.withClause.value, symbols, line.dependsOn, line);
break;
case 'select':

@@ -239,7 +297,43 @@ introspectFrom(line, line.fromClause, symbols);

}
if(line.fallback) {
walk(line.fallback, symbols);
break;
case 'if':
addDep(line, line.dependsOn, line.condition, symbols);
walk(line.condition, symbols);
_.each(line.if, function(ifline){
walk(ifline, symbols);
});
if(line.else){
_.each(line.else, function(elseline){
walk(elseline, symbols);
})
}
break;
case 'logic':
var condDepends = logicVars(line, symbols);
_.each(condDepends, function(dependency){
addDep(line, line.dependsOn, dependency, symbols);
walk(dependency, symbols);
});
break;
case 'try':
_.each(line.dependsOn, function(tryline){
addListener(tryline, line);
walk(tryline, symbols);
});
_.each(line.catchClause, function(currentcatch){
walk(currentcatch.condition, symbols);
_.each(currentcatch.lines, function(catchline){
walk(catchline, symbols);
})
});
if(line.finallyClause) {
_.each(line.finallyClause, function(finallyline){
walk(finallyline, symbols);
});
}
break;
}
if(line.fallback) {
walk(line.fallback, symbols);
}
}

@@ -481,1 +575,19 @@

}
// find all variables that appears in a logic condition.
function logicVars(condition, symbols){
if(_.isString(condition.values)){
var conditionDep = symbols[condition.values];
if (conditionDep) {
return [conditionDep];
}else{
return [];
}
}
else if (!_.isArray(condition.values)){
return logicVars(condition.values, symbols);
}
return _.reduce(condition.values, function(memo, val){
return memo.concat(logicVars(val, symbols));
}, [])
}

2

package.json
{
"author": "ql.io",
"name": "ql.io-compiler",
"version": "0.8.1",
"version": "0.8.2",
"repository": {

@@ -6,0 +6,0 @@ "type": "git",

Sorry, the diff of this file is too big to display

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