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

@hegel/core

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hegel/core - npm Package Compare versions

Comparing version 0.0.32 to 0.0.33

2

package.json
{
"name": "@hegel/core",
"author": "Artem Kobzar",
"version": "0.0.32",
"version": "0.0.33",
"description": "",

@@ -6,0 +6,0 @@ "main": "index.js",

@@ -54,4 +54,2 @@ "use strict";

var _variableUtils = require("../utils/variable-utils");
var _immutableType = require("./types/immutable-type");

@@ -63,2 +61,4 @@

var _variableUtils = require("../utils/variable-utils");
var _moduleScope = require("./module-scope");

@@ -178,12 +178,5 @@

selfObject = selfObject instanceof _bottomType.$BottomType ? selfObject.subordinateMagicType.subordinateType : selfObject;
const isPrivate = node.type === _nodes2.default.CLASS_PRIVATE_PROPERTY;
let _propertyName;
const _propertyName = (0, _variableUtils.getPropertyName)(node);
if (isPrivate) {
_propertyName = `#${node.key.id.name}`;
} else {
_propertyName = node.key.name || `${node.key.value}`;
}
const propertyType = selfObject.properties.get(_propertyName);

@@ -190,0 +183,0 @@

@@ -42,2 +42,4 @@ "use strict";

var _variableUtils = require("./variable-utils");
var _call = require("../type-graph/call");

@@ -172,2 +174,35 @@

}
if (currentNode.implements) {
const localTypeScope = self instanceof _bottomType.$BottomType ? self.subordinateMagicType.localTypeScope : typeScope;
currentNode.implements = currentNode.implements.map(typeAnnotation => {
const typeForImplementation = (0, _typeUtils.getTypeFromTypeAnnotation)({
typeAnnotation
}, localTypeScope, classScope.parent, true, null, parentNode, typeGraph, precompute, middlecompute, postcompute);
if (!(typeForImplementation instanceof _objectType.ObjectType) || typeForImplementation.isStrict) {
throw new _errors2.default("Type which should be implemented should be an soft objecty type", typeAnnotation.loc);
}
currentNode.body.body.forEach(node => {
if (node.type !== _nodes2.default.CLASS_PROPERTY && node.type !== _nodes2.default.CLASS_PRIVATE_PROPERTY && node.type !== _nodes2.default.CLASS_METHOD && node.type !== _nodes2.default.CLASS_PRIVATE_METHOD) {
return;
}
const propertyName = (0, _variableUtils.getPropertyName)(node);
const existedProperty = typeForImplementation.properties.get(propertyName);
if (existedProperty === undefined) {
return;
}
node.expected = existedProperty.type;
});
return {
loc: typeAnnotation.loc,
id: typeAnnotation.id,
typeForImplementation
};
});
}
}

@@ -212,20 +247,4 @@

function addPropertyNodeToThis(currentNode, parentNode, typeGraph, pre, middle, post) {
let propertyName;
const isPrivate = currentNode.type === _nodes2.default.CLASS_PRIVATE_METHOD;
const propertyName = (0, _variableUtils.getPropertyName)(currentNode); // $FlowIssue
if (isPrivate) {
propertyName = `#${currentNode.key.id.name}`;
} else {
propertyName = currentNode.key.name || `${currentNode.key.value}`;
}
if (currentNode.kind === "constructor") {
propertyName = _constants.CONSTRUCTABLE;
}
if (currentNode.type === _nodes2.default.CLASS_PRIVATE_PROPERTY) {
propertyName = `#${propertyName}`;
} // $FlowIssue
const currentClassScope = (0, _scopeUtils.getParentForNode)(currentNode, parentNode, typeGraph);

@@ -347,13 +366,9 @@

const localTypeScope = self.type instanceof _bottomType.$BottomType ? self.type.subordinateMagicType.localTypeScope : typeScope;
classNode.implements.forEach(typeAnnotation => {
const typeForImplementation = (0, _typeUtils.getTypeFromTypeAnnotation)({
typeAnnotation
}, localTypeScope, classScope.parent, true, null, parentNode, typeGraph, pre, middle, post);
if (!(typeForImplementation instanceof _objectType.ObjectType) || typeForImplementation.isStrict) {
throw new _errors2.default("Type which should be implemented should be an soft objecty type", typeAnnotation.loc);
}
classNode.implements.forEach(({
typeForImplementation,
id,
loc
}) => {
if (!typeForImplementation.isPrincipalTypeFor(self.type)) {
throw new _errors2.default(`Wrong implementation for type "${typeAnnotation.id.name}"`, typeAnnotation.loc);
throw new _errors2.default(`Wrong implementation for type "${id.name}"`, loc);
}

@@ -360,0 +375,0 @@ });

@@ -17,4 +17,7 @@ "use strict";

this.loc = loc;
this.source = source;
this.loc = loc && {
end: loc.end,
start: loc.start
};
}

@@ -32,3 +35,6 @@

this.loc = loc;
this.loc = {
end: loc.end,
start: loc.start
};
}

@@ -35,0 +41,0 @@

@@ -85,2 +85,9 @@ "use strict";

}
const expectedReturnType = expectedType.returnType;
if (functionType.returnType instanceof _typeVar.TypeVar && !functionType.returnType.isUserDefined && expectedReturnType.parent.priority <= 1) {
functionType.returnType = expectedReturnType;
variableInfo.isInferenced = false;
}
}

@@ -87,0 +94,0 @@

@@ -6,2 +6,3 @@ "use strict";

});
exports.getPropertyName = getPropertyName;
exports.getVariableInfoFromDelcaration = getVariableInfoFromDelcaration;

@@ -12,2 +13,6 @@ exports.getSuperTypeOf = getSuperTypeOf;

var _nodes = require("./nodes");
var _nodes2 = _interopRequireDefault(_nodes);
var _meta = require("../type-graph/meta/meta");

@@ -27,2 +32,4 @@

var _constants = require("../type-graph/constants");
var _collectionType = require("../type-graph/types/collection-type");

@@ -40,2 +47,24 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getPropertyName(node) {
const isPrivate = node.type === _nodes2.default.CLASS_PRIVATE_METHOD;
if (isPrivate) {
return `#${node.key.id.name}`;
}
if (node.kind === "constructor") {
return _constants.CONSTRUCTABLE;
}
const propertyName = node.key.name || `${node.key.value}`;
if (node.type === _nodes2.default.CLASS_PRIVATE_PROPERTY) {
return `#${propertyName}`;
}
return propertyName;
}
function getVariableInfoFromDelcaration(currentNode, parentNode, typeGraph, precompute, middlecompute, postcompute) {

@@ -42,0 +71,0 @@ const parentScope = (0, _scopeUtils.getParentForNode)(currentNode, parentNode, typeGraph);

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