Identify JSX closing tags as identifiers so they emit correctly

Fixes bug #5955
This commit is contained in:
Ryan Cavanaugh
2015-12-07 11:07:37 -08:00
parent 31f56fdbfd
commit 04f8c32d32
4 changed files with 64 additions and 7 deletions

View File

@@ -22,12 +22,28 @@ import ReactRouter = require('react-router');
import Route = ReactRouter.Route;
var routes = <Route />;
var routes1 = <Route />;
module M {
export var X: any;
}
module M {
// Should emit 'M.X' in both opening and closing tags
var y = <X></X>;
}
//// [test.jsx]
define(["require", "exports", 'react-router'], function (require, exports, ReactRouter) {
"use strict";
var Route = ReactRouter.Route;
var routes = <Route />;
var routes1 = <Route />;
var M;
(function (M) {
})(M || (M = {}));
var M;
(function (M) {
// Should emit 'M.X' in both opening and closing tags
var y = <M.X></M.X>;
})(M || (M = {}));
});

View File

@@ -11,10 +11,26 @@ import Route = ReactRouter.Route;
>ReactRouter : Symbol(ReactRouter, Decl(react.d.ts, 4, 1))
>Route : Symbol(ReactRouter.Route, Decl(react.d.ts, 7, 4))
var routes = <Route />;
>routes : Symbol(routes, Decl(test.tsx, 6, 3))
var routes1 = <Route />;
>routes1 : Symbol(routes1, Decl(test.tsx, 6, 3))
>Route : Symbol(Route, Decl(test.tsx, 2, 45))
module M {
>M : Symbol(M, Decl(test.tsx, 6, 24), Decl(test.tsx, 10, 1))
export var X: any;
>X : Symbol(X, Decl(test.tsx, 9, 11))
}
module M {
>M : Symbol(M, Decl(test.tsx, 6, 24), Decl(test.tsx, 10, 1))
// Should emit 'M.X' in both opening and closing tags
var y = <X></X>;
>y : Symbol(y, Decl(test.tsx, 13, 4))
>X : Symbol(X, Decl(test.tsx, 9, 11))
>X : Symbol(X, Decl(test.tsx, 9, 11))
}
=== tests/cases/conformance/jsx/react.d.ts ===
declare module 'react' {

View File

@@ -11,11 +11,28 @@ import Route = ReactRouter.Route;
>ReactRouter : typeof ReactRouter
>Route : any
var routes = <Route />;
>routes : any
var routes1 = <Route />;
>routes1 : any
><Route /> : any
>Route : any
module M {
>M : typeof M
export var X: any;
>X : any
}
module M {
>M : typeof M
// Should emit 'M.X' in both opening and closing tags
var y = <X></X>;
>y : any
><X></X> : any
>X : any
>X : any
}
=== tests/cases/conformance/jsx/react.d.ts ===
declare module 'react' {

View File

@@ -23,4 +23,12 @@ import ReactRouter = require('react-router');
import Route = ReactRouter.Route;
var routes = <Route />;
var routes1 = <Route />;
module M {
export var X: any;
}
module M {
// Should emit 'M.X' in both opening and closing tags
var y = <X></X>;
}