@riotjs/compiler
Advanced tools
Comparing version 6.1.2 to 6.1.3
{ | ||
"name": "@riotjs/compiler", | ||
"version": "6.1.2", | ||
"version": "6.1.3", | ||
"description": "Compiler for riot .tag files", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -28,3 +28,4 @@ import { | ||
isLiteral, | ||
isMemberExpression | ||
isMemberExpression, | ||
isObjectExpression | ||
} from '../../utils/ast-nodes-checks' | ||
@@ -213,3 +214,16 @@ import {nullNode, simplePropertyNode} from '../../utils/custom-ast-nodes' | ||
export function wrapASTInFunctionWithScope(ast) { | ||
return builders.arrowFunctionExpression([scope], ast) | ||
const fn = builders.arrowFunctionExpression([scope], ast) | ||
// object expressions need to be wrapped in parenthesis | ||
// recast doesn't allow it | ||
// see also https://github.com/benjamn/recast/issues/985 | ||
if (isObjectExpression(ast)) { | ||
// doing a small hack here f | ||
// trying to figure out how the recast printer works internally | ||
ast.extra = { | ||
parenthesized: true | ||
} | ||
} | ||
return fn | ||
} | ||
@@ -216,0 +230,0 @@ |
@@ -11,2 +11,3 @@ import globalScope from 'globals' | ||
export const isThisExpression = n => namedTypes.ThisExpression.check(n) | ||
export const isObjectExpression = n => namedTypes.ObjectExpression.check(n) | ||
export const isThisExpressionStatement = n => | ||
@@ -13,0 +14,0 @@ isExpressionStatement(n) && |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1938837
53116