fix tests, better block scoped collisions

This commit is contained in:
Sebastian McKenzie 2015-04-04 14:17:26 +11:00
parent 7c710a0378
commit 4bd19da3c2
6 changed files with 20 additions and 16 deletions

View File

@ -452,7 +452,7 @@ class ClassTransformer {
file: this.file file: this.file
}; };
path.traverse(verifyConstructorVisitor, state); path.get("value").traverse(verifyConstructorVisitor, state);
this.bareSuper = state.bareSuper; this.bareSuper = state.bareSuper;

View File

@ -237,11 +237,12 @@ export default class Scope {
var local = this.getOwnBindingInfo(name); var local = this.getOwnBindingInfo(name);
if (!local) return; if (!local) return;
if (kind === "param") return; if (kind === "param") return;
if (kind === "hoisted" && local.kind === "let") return; if (kind === "hoisted" && local.kind === "let") return;
var duplicate = false; var duplicate = false;
duplicate ||= local.kind === "let" || local.kind === "const" || local.kind === "module"; duplicate ||= kind === "let" || kind === "const" || local.kind === "let" || local.kind === "const" || local.kind === "module";
duplicate ||= local.kind === "param" && (kind === "let" || kind === "const"); duplicate ||= local.kind === "param" && (kind === "let" || kind === "const");
if (duplicate) { if (duplicate) {

View File

@ -89,7 +89,7 @@ var a: Promise<bool>[]
var a:(...rest:Array<number>) => number var a:(...rest:Array<number>) => number
var identity: <T>(x: T) => T var identity: <T>(x: T) => T
var identity: <T>(x: T, ...y:T[]) => T var identity: <T>(x: T, ...y:T[]) => T
import type foo from "bar"; import type foo4 from "bar";
import type { foo2, bar } from "baz"; import type { foo2, bar } from "baz";
import type { foo as bar2 } from "baz"; import type { foo as bar2 } from "baz";
import type from "foo"; import type from "foo";

View File

@ -1,4 +1,4 @@
class Foo { class Foo extends Bar {
constructor (options) { constructor (options) {
let parentOptions = {}; let parentOptions = {};
parentOptions.init = function () { parentOptions.init = function () {

View File

@ -1,11 +1,16 @@
"use strict"; "use strict";
var Foo = function Foo(options) { var Foo = (function (_Bar) {
babelHelpers.classCallCheck(this, Foo); function Foo(options) {
babelHelpers.classCallCheck(this, Foo);
var parentOptions = {}; var parentOptions = {};
parentOptions.init = function () { parentOptions.init = function () {
this; this;
}; };
babelHelpers.get(Object.getPrototypeOf(Foo.prototype), "constructor", this).call(this, parentOptions); babelHelpers.get(Object.getPrototypeOf(Foo.prototype), "constructor", this).call(this, parentOptions);
}; }
babelHelpers.inherits(Foo, _Bar);
return Foo;
})(Bar);

View File

@ -1,9 +1,7 @@
"use strict"; "use strict";
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
var _toString = require("foo"); var _toString = require("foo");
var _toString2 = _interopRequireWildcard(_toString); var _toString2 = babelHelpers.interopRequireWildcard(_toString);
_toString2["default"]; _toString2["default"];