We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I tried to parse my code with recast, and traverse AST with ast-types.
recast
ast-types
But when I used visitObjectProperty option in visit function, it did't work.
visitObjectProperty
visit
All my code is below:
const { parse } = require('recast') const { visit } = require('ast-types') const rawCode = ` import Foo from "./Foo.vue" export default { components: { Foo }, data() { return { msg: 'Hello World' } } } ` const ast = parse(rawCode) visit(ast, { visitObjectExpression(path) { // can access to object properties here. console.log(path.value.properties) this.traverse(path) }, visitObjectProperty(path) { // nothing print. cannot access to object property console.log('------------Property-------------') console.log(path) this.traverse(path) } })
node version: v16.9.1 ast-types version: v0.14.2 recast version: v0.20.5 OS: Mac OS 11.3.1
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I tried to parse my code with
recast
, and traverse AST withast-types
.But when I used
visitObjectProperty
option invisit
function, it did't work.All my code is below:
Environment
node version: v16.9.1
ast-types version: v0.14.2
recast version: v0.20.5
OS: Mac OS 11.3.1
The text was updated successfully, but these errors were encountered: