-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
memory safe for inline assembly (#685)
* memory safe for inline assembly * adding language option for assembly
- Loading branch information
Showing
3 changed files
with
40 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
// @TODO: add support for assembly language specifier | ||
const { printString } = require('../prettier-comments/common/util'); | ||
const printSeparatedList = require('./print-separated-list'); | ||
|
||
const InlineAssemblyStatement = { | ||
print: ({ path, print }) => ['assembly ', path.call(print, 'body')] | ||
print: ({ node, path, print, options }) => [ | ||
'assembly ', | ||
node.language ? `${printString(node.language, options)} ` : '', | ||
node.flags && node.flags.length > 0 | ||
? [ | ||
'(', | ||
printSeparatedList( | ||
node.flags.map((flag) => printString(flag, options)) | ||
), | ||
') ' | ||
] | ||
: '', | ||
path.call(print, 'body') | ||
] | ||
}; | ||
module.exports = InlineAssemblyStatement; |
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