-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'tresorit-directive_handling' into release-0.54.0
- Loading branch information
Showing
9 changed files
with
90 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var assert = require( 'assert' ); | ||
|
||
module.exports = { | ||
description: 'shouldn\'t delete use asm from the start of a function body', | ||
code: function ( code ) { | ||
assert.notEqual( code.indexOf('use asm'), -1 ); | ||
}, | ||
}; |
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 @@ | ||
export function a() { | ||
"use asm"; | ||
|
||
return 1; | ||
} |
9 changes: 9 additions & 0 deletions
9
test/function/samples/function-directive-not-first/_config.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,9 @@ | ||
var assert = require( 'assert' ); | ||
|
||
module.exports = { | ||
description: 'should delete use asm from function body if it\'s not first expression', | ||
code: function ( code ) { | ||
console.log(code); | ||
assert.equal( code.indexOf('use asm'), -1 ); | ||
}, | ||
}; |
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 @@ | ||
export function a() { | ||
const x = 1; | ||
"use asm"; | ||
return x; | ||
} |
9 changes: 9 additions & 0 deletions
9
test/function/samples/function-use-strict-directive-removed/_config.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,9 @@ | ||
var assert = require( 'assert' ); | ||
|
||
module.exports = { | ||
description: 'should delete use strict from function body', | ||
code: function ( code ) { | ||
assert.equal( code.lastIndexOf('use strict'), 1 ); | ||
}, | ||
show: true, | ||
}; |
5 changes: 5 additions & 0 deletions
5
test/function/samples/function-use-strict-directive-removed/main.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,5 @@ | ||
export function a() { | ||
"use strict"; | ||
const x = 1; | ||
return x; | ||
} |
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,22 @@ | ||
var assert = require( 'assert' ); | ||
var path = require( 'path' ); | ||
|
||
module.exports = { | ||
description: 'module level directives should produce warnings', | ||
warnings: [ | ||
{ | ||
code: 'MODULE_LEVEL_DIRECTIVE', | ||
message: 'Module level directives cause errors when bundled, \'use asm\' was ignored.', | ||
pos: 0, | ||
id: path.resolve( __dirname, 'main.js' ), | ||
loc: { | ||
file: path.resolve( __dirname, 'main.js' ), | ||
line: 1, | ||
column: 0 | ||
}, | ||
frame: ` | ||
1: \"use asm\";\n ^\n2:\n3: export default 1; | ||
` | ||
} | ||
] | ||
}; |
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,3 @@ | ||
"use asm"; | ||
|
||
export default 1; |