diff --git a/index.html b/index.html index 67ffd0ff..54c043a9 100644 --- a/index.html +++ b/index.html @@ -91,10 +91,10 @@
13-09-2018: Version 0.22.2
+27-09-2018: Version 0.22.3
Small update release that fixes crashes -affecting spread operator in object notation and rest operatore in object pattern.
+affecting spread operator in object notation, rest operatore in object pattern and export default anonymous class or function.28-08-2018: Version 0.22
diff --git a/lib/infer.js b/lib/infer.js index 44707443..ce638bac 100644 --- a/lib/infer.js +++ b/lib/infer.js @@ -1153,7 +1153,7 @@ } }, ClassDeclaration: function(node, scope, c) { - addVar(scope, node.id) + if (node.id) addVar(scope, node.id); if (node.superClass) c(node.superClass, scope, "Expression") for (var i = 0; i < node.body.body.length; i++) c(node.body.body[i], scope) @@ -1660,18 +1660,26 @@ infer(node, node.scope || scope, ANull); }, + ObjectExpression: function(node, scope) { + infer(node, node.scope || scope, ANull); + }, + FunctionDeclaration: function(node, scope, c) { var inner = node.scope, fn = inner.fnType; connectParams(node, inner) c(node.body, inner, "Statement"); maybeTagAsInstantiated(node, fn) || maybeTagAsGeneric(fn); - scope.getProp(node.id.name).addType(fn) + if (node.id) scope.getProp(node.id.name).addType(fn); }, Statement: function(node, scope, c) { c(node, node.scope || scope) }, + ExportDefaultDeclaration: function(node, scope, c) { + c(node.declaration, node.scope || scope) + }, + VariableDeclaration: function(node, scope) { for (var i = 0; i < node.declarations.length; ++i) { var decl = node.declarations[i]; @@ -1686,7 +1694,8 @@ }, ClassDeclaration: function(node, scope) { - scope.getProp(node.id.name).addType(inferClass(node, scope, node.id.name)) + if (!node.id) inferClass(node, scope); + else scope.getProp(node.id.name).addType(inferClass(node, scope, node.id.name)) }, ReturnStatement: function(node, scope) { @@ -1893,9 +1902,15 @@ ObjectExpression: function(node) { return node.objType; }, + ClassDeclaration: function(node) { + return node.objType; + }, ClassExpression: function(node) { return node.objType; }, + FunctionDeclaration: function(node) { + return node.scope.fnType; + }, FunctionExpression: function(node) { return node.scope.fnType; }, diff --git a/lib/tern.js b/lib/tern.js index f4d5bbed..4d89cd6b 100644 --- a/lib/tern.js +++ b/lib/tern.js @@ -1149,5 +1149,5 @@ return {files: srv.files.map(function(f){return f.name;})}; } - exports.version = "0.22.2"; + exports.version = "0.22.3"; }); diff --git a/package.json b/package.json index 875a2d17..e86a09d7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tern", "license": "MIT", - "version": "0.22.2", + "version": "0.22.3", "author": "Marijn Haverbeke