Skip to content
New issue

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

AST.toString() === 'AST'? #1949

Closed
matthewjh opened this issue May 17, 2015 · 5 comments
Closed

AST.toString() === 'AST'? #1949

matthewjh opened this issue May 17, 2015 · 5 comments
Labels
effort2: days refactoring Issue that involves refactoring or code-cleanup

Comments

@matthewjh
Copy link
Contributor

Is there any particular reason why subclasses of AST do not override the 'abstract' AST implementation of toString?

For this reason, change detection errors that use ProtoRecord#expressionAsString, which is derived from bindingRecord.ast.toString() throw unhelpful, garbage errors like this:

Expression 'AST' has changed after it was checked. Previous value: ''. Current value: ''

@matthewjh matthewjh changed the title AST.toString === 'AST' ?? AST.toString === 'AST'? May 17, 2015
@matthewjh matthewjh changed the title AST.toString === 'AST'? AST.toString() === 'AST'? May 17, 2015
@matthewjh
Copy link
Contributor Author

Actually, it'd probably be better to simply get the expression string from the upstream ASTWithSource, and pass it in to the BindingRecord constructor (which would assign it to a property astSource for example), rather than unnecessarily computing it from the AST.

Thoughts? Any reason why this wouldn't work / is a bad idea?

@matthewjh
Copy link
Contributor Author

What do you think, @vicb?

@vicb
Copy link
Contributor

vicb commented May 22, 2015

I'm not sure if AST.toString() is really valuable here, we should probably have a visitor that could transform an AST back to an expression.

BindingRecord takes an AST so it might not be an ASTWithSource.

@vsavkin what do you think ?

@mhevery mhevery added comp: core/change_detection effort2: days refactoring Issue that involves refactoring or code-cleanup labels May 31, 2015
This was referenced Jun 5, 2015
vicb added a commit to vicb/angular that referenced this issue Jun 6, 2015
vicb added a commit to vicb/angular that referenced this issue Jun 6, 2015
vicb added a commit to vicb/angular that referenced this issue Jun 6, 2015
vicb added a commit to vicb/angular that referenced this issue Jun 6, 2015
@vsavkin
Copy link
Contributor

vsavkin commented Jun 8, 2015

I think the issue was fixed some time ago. @vicb can you reproduce it on master?

vicb added a commit to vicb/angular that referenced this issue Jun 9, 2015
vicb added a commit to vicb/angular that referenced this issue Jun 10, 2015
@vicb vicb closed this as completed in 331a051 Jun 10, 2015
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort2: days refactoring Issue that involves refactoring or code-cleanup
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants