Compare commits

...

7 Commits

Author SHA1 Message Date
Sebastian McKenzie
2053610429 v5.5.3 2015-06-05 12:20:22 +01:00
Sebastian McKenzie
cd4f83b299 fix linting errors 2015-06-05 12:19:32 +01:00
Sebastian McKenzie
ec29ba19a9 add 5.5.3 changelog 2015-06-05 12:18:43 +01:00
Sebastian McKenzie
9dc03e0978 traverse over ClassProperty path rather than node 2015-06-05 12:17:55 +01:00
Sebastian McKenzie
bc4258eca9 add type inferrence for template literals 2015-06-05 12:17:45 +01:00
Sebastian McKenzie
b0e58f9770 add completion statement test and enable experimental option on deadCodeElimination tests 2015-06-05 12:17:36 +01:00
Sebastian McKenzie
a1e2641c91 5.5.2 2015-06-05 12:17:18 +01:00
9 changed files with 48 additions and 9 deletions

View File

@@ -13,6 +13,11 @@ _Note: Gaps between patch versions are faulty/broken releases._
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
## 5.5.3
* **Bug Fix**
* Fix weird state bug when traversing overa `node` `ClassProperty` instead of `path` in the `es6.classes` transformer.
## 5.5.2
* **Bug Fix**

View File

@@ -1,7 +1,7 @@
{
"name": "babel-core",
"description": "A compiler for writing next generation JavaScript",
"version": "5.5.2",
"version": "5.5.3",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
"license": "MIT",

View File

@@ -1,14 +1,14 @@
{
"name": "babel",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "5.5.1",
"version": "5.5.2",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
"license": "MIT",
"repository": "babel/babel",
"preferGlobal": true,
"dependencies": {
"babel-core": "^5.5.1",
"babel-core": "^5.5.2",
"chokidar": "^1.0.0",
"commander": "^2.6.0",
"convert-source-map": "^1.1.0",

View File

@@ -1,7 +1,7 @@
{
"name": "babel-runtime",
"description": "babel selfContained runtime",
"version": "5.5.1",
"version": "5.5.2",
"license": "MIT",
"repository": "babel/babel",
"author": "Sebastian McKenzie <sebmck@gmail.com>",

View File

@@ -293,7 +293,7 @@ class ClassTransformer {
this.pushMethod(node, path);
}
} else if (t.isClassProperty(node)) {
this.pushProperty(node);
this.pushProperty(node, path);
}
}
@@ -478,8 +478,8 @@ class ClassTransformer {
* Description
*/
pushProperty(node: { type: "ClassProperty" }) {
this.scope.traverse(node, collectPropertyReferencesVisitor, {
pushProperty(node: { type: "ClassProperty" }, path: NodePath) {
path.traverse(collectPropertyReferencesVisitor, {
references: this.instancePropRefs,
scope: this.scope
});

View File

@@ -190,6 +190,10 @@ export function _inferTypeAnnotation(force?: boolean): ?Object {
return t.genericTypeAnnotation(t.identifier("Function"));
}
if (path.isTemplateLiteral()) {
return t.stringTypeAnnotation();
}
if (path.isUnaryExpression()) {
let operator = node.operator;
@@ -273,8 +277,11 @@ export function _inferTypeAnnotation(force?: boolean): ?Object {
if (node.regex) return t.genericTypeAnnotation(t.identifier("RegExp"));
}
if (path.isCallExpression()) {
var callee = path.get("callee").resolve();
var callPath;
if (path.isCallExpression()) callPath = path.get("callee");
if (path.isTaggedTemplateExpression()) callPath = path.get("tag");
if (callPath) {
var callee = callPath.resolve();
// todo: read typescript/flow interfaces
if (callee.isNodeType("Function")) return callee.node.returnType;
}

View File

@@ -0,0 +1,13 @@
for (var key in foo) {
break;
foo();
}
function bar() {
yes();
bar();
return "wow";
nomore();
}
bar();

View File

@@ -0,0 +1,13 @@
"use strict";
for (var key in foo) {
break;
}
function bar() {
yes();
bar();
return "wow";
}
bar();

View File

@@ -1,4 +1,5 @@
{
"experimental": true,
"externalHelpers": true,
"noCheckAst": true,
"blacklist": ["regenerator"],