add notifications and tests for jsx react-native es3

This commit is contained in:
David Sheldrick 2017-01-23 22:08:39 +01:00
parent 8d590d5191
commit 7bf52ee1fd
13 changed files with 134 additions and 2 deletions

View File

@ -14,7 +14,7 @@ namespace ts {
// enable emit notification only if using --jsx preserve
let previousOnEmitNode: (emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) => void;
let noSubstitution: boolean[];
if (compilerOptions.jsx === JsxEmit.Preserve) {
if (compilerOptions.jsx === JsxEmit.Preserve || compilerOptions.jsx === JsxEmit.ReactNative) {
previousOnEmitNode = context.onEmitNode;
context.onEmitNode = onEmitNode;
context.enableEmitNotification(SyntaxKind.JsxOpeningElement);
@ -116,4 +116,4 @@ namespace ts {
return undefined;
}
}
}
}

View File

@ -0,0 +1,11 @@
//// [es3-jsx-preserve.tsx]
const React: any = null;
const elem = <div></div>;
//// [es3-jsx-preserve.jsx]
var React = null;
var elem = <div></div>;

View File

@ -0,0 +1,11 @@
=== tests/cases/compiler/es3-jsx-preserve.tsx ===
const React: any = null;
>React : Symbol(React, Decl(es3-jsx-preserve.tsx, 1, 5))
const elem = <div></div>;
>elem : Symbol(elem, Decl(es3-jsx-preserve.tsx, 3, 5))
>div : Symbol(unknown)
>div : Symbol(unknown)

View File

@ -0,0 +1,13 @@
=== tests/cases/compiler/es3-jsx-preserve.tsx ===
const React: any = null;
>React : any
>null : null
const elem = <div></div>;
>elem : any
><div></div> : any
>div : any
>div : any

View File

@ -0,0 +1,11 @@
//// [es3-jsx-react-native.tsx]
const React: any = null;
const elem = <div></div>;
//// [es3-jsx-react-native.js]
var React = null;
var elem = <div></div>;

View File

@ -0,0 +1,11 @@
=== tests/cases/compiler/es3-jsx-react-native.tsx ===
const React: any = null;
>React : Symbol(React, Decl(es3-jsx-react-native.tsx, 1, 5))
const elem = <div></div>;
>elem : Symbol(elem, Decl(es3-jsx-react-native.tsx, 3, 5))
>div : Symbol(unknown)
>div : Symbol(unknown)

View File

@ -0,0 +1,13 @@
=== tests/cases/compiler/es3-jsx-react-native.tsx ===
const React: any = null;
>React : any
>null : null
const elem = <div></div>;
>elem : any
><div></div> : any
>div : any
>div : any

View File

@ -0,0 +1,11 @@
//// [es3-jsx-react.tsx]
const React: any = null;
const elem = <div></div>;
//// [es3-jsx-react.js]
var React = null;
var elem = React.createElement("div", null);

View File

@ -0,0 +1,11 @@
=== tests/cases/compiler/es3-jsx-react.tsx ===
const React: any = null;
>React : Symbol(React, Decl(es3-jsx-react.tsx, 1, 5))
const elem = <div></div>;
>elem : Symbol(elem, Decl(es3-jsx-react.tsx, 3, 5))
>div : Symbol(unknown)
>div : Symbol(unknown)

View File

@ -0,0 +1,13 @@
=== tests/cases/compiler/es3-jsx-react.tsx ===
const React: any = null;
>React : any
>null : null
const elem = <div></div>;
>elem : any
><div></div> : any
>div : any
>div : any

View File

@ -0,0 +1,9 @@
// @target: ES3
// @sourcemap: false
// @declaration: false
// @jsx: preserve
const React: any = null;
const elem = <div></div>;

View File

@ -0,0 +1,9 @@
// @target: ES3
// @sourcemap: false
// @declaration: false
// @jsx: react-native
const React: any = null;
const elem = <div></div>;

View File

@ -0,0 +1,9 @@
// @target: ES3
// @sourcemap: false
// @declaration: false
// @jsx: react
const React: any = null;
const elem = <div></div>;