forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix microsoft#10758 Add compiler option to parse in strict mode
* add compiler option alwaysStrict * compile in strict mode when option is set * emit "use strict"
- Loading branch information
Showing
19 changed files
with
170 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
tests/cases/compiler/alwaysStrict.ts(3,9): error TS1100: Invalid use of 'arguments' in strict mode. | ||
|
||
|
||
==== tests/cases/compiler/alwaysStrict.ts (1 errors) ==== | ||
|
||
function f() { | ||
var arguments = []; | ||
~~~~~~~~~ | ||
!!! error TS1100: Invalid use of 'arguments' in strict mode. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//// [alwaysStrict.ts] | ||
|
||
function f() { | ||
var arguments = []; | ||
} | ||
|
||
//// [alwaysStrict.js] | ||
"use strict"; | ||
function f() { | ||
var arguments = []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
tests/cases/compiler/alwaysStrictES6.ts(3,9): error TS1100: Invalid use of 'arguments' in strict mode. | ||
|
||
|
||
==== tests/cases/compiler/alwaysStrictES6.ts (1 errors) ==== | ||
|
||
function f() { | ||
var arguments = []; | ||
~~~~~~~~~ | ||
!!! error TS1100: Invalid use of 'arguments' in strict mode. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//// [alwaysStrictES6.ts] | ||
|
||
function f() { | ||
var arguments = []; | ||
} | ||
|
||
//// [alwaysStrictES6.js] | ||
"use strict"; | ||
function f() { | ||
var arguments = []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
tests/cases/compiler/alwaysStrictModule.ts(4,13): error TS1100: Invalid use of 'arguments' in strict mode. | ||
|
||
|
||
==== tests/cases/compiler/alwaysStrictModule.ts (1 errors) ==== | ||
|
||
module M { | ||
export function f() { | ||
var arguments = []; | ||
~~~~~~~~~ | ||
!!! error TS1100: Invalid use of 'arguments' in strict mode. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//// [alwaysStrictModule.ts] | ||
|
||
module M { | ||
export function f() { | ||
var arguments = []; | ||
} | ||
} | ||
|
||
//// [alwaysStrictModule.js] | ||
"use strict"; | ||
var M; | ||
(function (M) { | ||
function f() { | ||
var arguments = []; | ||
} | ||
M.f = f; | ||
})(M || (M = {})); |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/alwaysStrictNoImplicitUseStrict.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
tests/cases/compiler/alwaysStrictNoImplicitUseStrict.ts(4,13): error TS1100: Invalid use of 'arguments' in strict mode. | ||
|
||
|
||
==== tests/cases/compiler/alwaysStrictNoImplicitUseStrict.ts (1 errors) ==== | ||
|
||
module M { | ||
export function f() { | ||
var arguments = []; | ||
~~~~~~~~~ | ||
!!! error TS1100: Invalid use of 'arguments' in strict mode. | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/alwaysStrictNoImplicitUseStrict.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//// [alwaysStrictNoImplicitUseStrict.ts] | ||
|
||
module M { | ||
export function f() { | ||
var arguments = []; | ||
} | ||
} | ||
|
||
//// [alwaysStrictNoImplicitUseStrict.js] | ||
"use strict"; | ||
var M; | ||
(function (M) { | ||
function f() { | ||
var arguments = []; | ||
} | ||
M.f = f; | ||
})(M || (M = {})); |
3 changes: 3 additions & 0 deletions
3
tests/baselines/reference/transpile/Supports setting alwaysStrict.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// @alwaysStrict: true | ||
|
||
function f() { | ||
var arguments = []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// @target: ES6 | ||
// @alwaysStrict: true | ||
|
||
function f() { | ||
var arguments = []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// @module: commonjs | ||
// @alwaysStrict: true | ||
|
||
module M { | ||
export function f() { | ||
var arguments = []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// @module: commonjs | ||
// @alwaysStrict: true | ||
// @noImplicitUseStrict: true | ||
|
||
module M { | ||
export function f() { | ||
var arguments = []; | ||
} | ||
} |