8000 [Master] wip-dynamic import by yuit · Pull Request #14774 · microsoft/TypeScript · GitHub
[go: up one dir, main page]

Skip to content

[Master] wip-dynamic import #14774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 76 commits into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
787ed37
Use term UpdateExpression instead of IncrementExpression to keep it c…
Mar 8, 2017
ca08167
Wip-parsing import call expression
Mar 8, 2017
330f7bf
Correctly parse import()
Mar 9, 2017
e7b3a15
Merge branch 'master' into master-dynamicImport
Mar 10, 2017
827abb3
Parse import call and use collect its specifier
Mar 10, 2017
6933b58
Wip-type check dynamic import
Mar 11, 2017
126fb64
Wip-type check dynamic import
Mar 11, 2017
bd50ccf
Merge branch 'master-dynamicImport' of https://github.com/Microsoft/T…
Mar 11, 2017
7340d84
Rename importcall to importCallExpression
Mar 13, 2017
18c826b
Add new value "es2018" for module kind
Mar 13, 2017
ddf5ed9
Emit dynamic import when module kind is es2018
Mar 13, 2017
26f9a52
Add initial tests
Mar 14, 2017
20293b0
Fix up error when we can't find promise type in import call expression
Mar 14, 2017
369af08
Change filename to indicate it uses module kind of es2018
Mar 14, 2017
ffbb445
wip-Emit import call expression for commonjs
Mar 14, 2017
be375cb
Fix missing import call expression in function and class declaration
Mar 14, 2017
a84645c
Add more tests for emitting of es2018 module-kind
Mar 14, 2017
9864b4e
Emit import callExpression for UMD and AMD
Mar 14, 2017
86c7129
wip-system emit
Mar 15, 2017
6db02e7
Fix up incorrect system emit
Mar 16, 2017
a77f0d2
Do not collect imports in parser as it makes it very hard for increme…
Mar 17, 2017
dbac66c
Update baselines from adding es2018 value into moduleKind
Mar 17, 2017
804ab2c
Remove duplicat es2018 tests
Mar 17, 2017
1af1005
Correctly bind import call expression
Mar 17, 2017
e019216
Use emitFlags to indicate that the subtree contains dynamic import
Mar 20, 2017
015f71b
Issue error when use with ES2015
Mar 20, 2017
8fd660b
Report no implicit error when we return Promise<any>
Mar 21, 2017
f04f7b5
Add comment for comparable relationship
Mar 21, 2017
871d609
Report an error if dynamic import specifier is not assigable to type …
Mar 21, 2017
15ca0af
Add tests
Mar 21, 2017
2332ea3
small fix on indentation
Mar 21, 2017
91d9ecf
Simply parse dynamic import as call-expression....
Mar 22, 2017
c798489
Move error report of incorrect grammar in dynamic import to checker
Mar 22, 2017
c62f4f5
Update tests
Mar 22, 2017
e1ba855
Add declaration emit test and test to make sure we don't give dynamic…
Mar 23, 2017
265d0c0
Fix where we report noImplicitAny error in dynamic import
Mar 24, 2017
640f2c7
Error when dynamic import has type arguments
Mar 24, 2017
61f199e
Update tests
Mar 24, 2017
486dc91
Change comment to jsdoc
Mar 27, 2017
6080c3e
Remove error with noImplicitAny
Mar 28, 2017
32e5cf7
Fix AMD emit
Mar 28, 2017
249f446
Update tests
Mar 28, 2017
f3306db
Update baselines
Mar 28, 2017
11f6eae
Merge branch 'master' into master-dynamicImport
Mar 29, 2017
d4754db
Update baseline from merging with master
Mar 29, 2017
9715052
Merge branch 'master' into master-dynamicImport
Mar 29, 2017
ca65996
Merge branch 'master' into master-dynamicImport
Apr 4, 2017
faaa38d
Update PR
Apr 4, 2017
55430c4
Add boolean flag to not walk the tree if there is no dynamic import
Apr 4, 2017
78b8275
Fix linting error
Apr 4, 2017
d1d5cac
Address PR: Remove duplication
Apr 6, 2017
2b96374
fix no-bom linting rule
Apr 6, 2017
2f61d47
Address minor PR comment
8000 Apr 26, 2017
a10e668
Move check for module kind is ES2015 into grammar check; Use checkNon…
Apr 26, 2017
e50667e
Address minor PR comment
Apr 26, 2017
feb41f7
Merge branch 'master' into master-dynamicImport
Apr 26, 2017
742d515
Fix baselines and function call from merging master
Apr 26, 2017
35e2289
Address PR:
Apr 28, 2017
a2d9fd4
Add target ES5 emit
Apr 28, 2017
1b0d020
Add tests and update baselines
Apr 28, 2017
1b7d3bf
Merge branch 'master' into master-dynamicImport
May 4, 2017
faab927
Merge branch 'master' into master-dynamicImport
May 24, 2017
a02edb1
Address PR: don't early exit when there are grammar errors
Jun 2, 2017
72ba23c
Address PR: change order of grammar check
Jun 2, 2017
e6d7327
Address PR: error message, fix capitalization, only allow functionLik…
Jun 2, 2017
d9e2033
Address PR: remove __resolved when emit for commonJs and just do Prom…
Jun 2, 2017
769f6ad
Update baselines
Jun 2, 2017
2f476bf
Merge branch 'master' into master-dynamicImport
Jun 2, 2017
9203f95
Update name change of isSpreadExpression
Jun 2, 2017
4733f0d
Fix linting
Jun 2, 2017
c2056c0
Address minor error messages
Jun 2, 2017
e386d65
Use ESNext instead of ES2018
Jun 5, 2017
3118afe
Remove ES2018 folder
Jun 5, 2017
75aa4bd
Rename test file with ES2018 to ESNext
Jun 5, 2017
7d64ec9
Update baselines from moving out of es2018
Jun 5, 2017
1729ea8
Update command line
Jun 5, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix linting error
  • Loading branch information
Kanchalai Tanglertsampan committed Apr 4, 2017
commit 78b8275ab6407c07dbba8a838fea9a64e5fcbd3b
10 changes: 3 additions & 7 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference path="moduleNameResolver.ts"/>
/// <reference path="moduleNameResolver.ts"/>
/// <reference path="binder.ts"/>

/* @internal */
Expand Down Expand Up @@ -15809,15 +15809,15 @@ namespace ts {
function createPromiseReturnType(func: FunctionLikeDeclaration | CallExpression, promisedType: Type) {
const promiseType = createPromiseType(promisedType);
if (promiseType === emptyObjectType) {
error(func, isImportCall(func) ?
error(func, isImportCall(func) ?
Diagnostics.A_dynamic_import_call_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option :
Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option);
return unknownType;
}
else if (!getGlobalPromiseConstructorSymbol(/*reportErrors*/ true)) {
error(func, isImportCall(func) ?
Diagnostics.A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option :
Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
}

return promiseType;
Expand Down Expand Up @@ -24066,10 +24066,6 @@ namespace ts {
return result;
}

/**
*
* @param node
*/
function checkGrammarImportCallExpression(node: ImportCall): boolean {
const arguments = node.arguments;
if (arguments.length !== 1) {
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/transformers/module/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ namespace ts {
createCall(createIdentifier("require"), /*typeArguments*/ undefined, [createArrayLiteral(node.arguments), resolve]))
]);
}

function transformImportCallExpressionCommonJS(node: ImportCall): Expression {
// import("./blah")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with my comments for transformImportCallExpressionUMD, I'd rather see this added as a scoped helper at the top of the module body function.

// emit as
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/transformers/module/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,7 @@ namespace ts {
// }
// };
// });
return createCall(
return createCall(
createPropertyAccess(
contextObject,
createIdentifier("import")
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ namespace ts {
}

export interface ImportExpression extends PrimaryExpression {
kind: SyntaxKind.ImportKeyword
kind: SyntaxKind.ImportKeyword;
}

export interface DeleteExpression extends UnaryExpression {
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3906,7 +3906,7 @@ namespace ts {
|| kind === SyntaxKind.TrueKeyword
|| kind === SyntaxKind.SuperKeyword
|| kind === SyntaxKind.NonNullExpression
|| kind === SyntaxKind.MetaProperty
|| kind === SyntaxKind.MetaProperty;
}

export function isLeftHandSideExpression(node: Node): node is LeftHandSideExpression {
Expand Down
0