Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

feat($parse): handle Infinity #9504

Closed
wants to merge 1 commit into from

Conversation

btford
Copy link
Contributor

@btford btford commented Oct 8, 2014

Closes #9492

it('should evaluate Infinity', function() {
expect(scope.$eval("Infinity")).toBe(Infinity);
expect(scope.$eval("a=Infinity")).toBe(Infinity);
expect(scope.a).toBe(Infinity);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add test for -Infinity

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@caitp
Copy link
Contributor

caitp commented Oct 9, 2014

It's weird to add this but not NaN--- but it should be a good way to do it. Make sure obj.Infinity works right too imo

@btford btford force-pushed the feat-parse-infinity branch 2 times, most recently from 71b6cb0 to 90e588a Compare October 9, 2014 00:56
@IgorMinar
Copy link
Contributor

I dunno. Either add NaN or don't do this at all.

What happens when you override Infinity via Infinity=42?

@caitp
Copy link
Contributor

caitp commented Oct 9, 2014

What happens when you override Infinity via Infinity=42?

shouldn't be able to afaik

V8 version 3.30.0 (candidate) [console: dumb]
d8> Infinity = 52
52
d8> Infinity
Infinity
d8> 

d8> this.Infinity = 52
52
d8> Infinity
Infinity
d8> this.Infinity
Infinity
d8> 

Same in spidermonkey and JSC, basically you just can't modify Infinity in the global object

In the parser's case, that should result in writing to the Infinity property in scope though..

@btford btford force-pushed the feat-parse-infinity branch from 90e588a to 61289a5 Compare October 9, 2014 18:47
@tbosch tbosch self-assigned this Oct 9, 2014
@tbosch tbosch added this to the Backlog milestone Oct 9, 2014
@tbosch tbosch removed their assignment Oct 9, 2014
@jeffbcross jeffbcross force-pushed the master branch 2 times, most recently from e8dc429 to e83fab9 Compare October 10, 2014 17:38
@btford btford force-pushed the feat-parse-infinity branch from 61289a5 to 3afe421 Compare October 10, 2014 17:51
@btford btford force-pushed the feat-parse-infinity branch from 3afe421 to 595cc2e Compare October 10, 2014 19:17
@btford
Copy link
Contributor Author

btford commented Oct 10, 2014

updated

expect(scope.$eval("obj.NaN = 43")).toBe(43);
expect(scope.obj.NaN).toBe(43);
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last thing, can we add a test that

$eval('Infinity = x'); will actually assign $scope.Infinity rather than global Infinity? (and maybe, if $scope.Infinity is defined, it should shadow window.Infinity? --- maybe that's more complicated than people want)

lgalfaso added a commit to lgalfaso/angular.js that referenced this pull request Mar 7, 2016
Allow user-defined literals.

Close: angular#9504
Close: angular#9492
lgalfaso added a commit to lgalfaso/angular.js that referenced this pull request Mar 7, 2016
Allow user-defined literals.

Close: angular#9504
Close: angular#9492
lgalfaso added a commit to lgalfaso/angular.js that referenced this pull request Mar 8, 2016
Allow user-defined literals.

Close: angular#9504
Close: angular#9492
lgalfaso added a commit to lgalfaso/angular.js that referenced this pull request Mar 12, 2016
Allow user-defined literals.

Close: angular#9504
Close: angular#9492
@lgalfaso lgalfaso closed this in 81150ac Mar 13, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expressions don't understand Infinity
5 participants