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

Add property operator: giv #192

Merged
merged 6 commits into from Feb 28, 2019

Conversation

Projects
None yet
2 participants
@AnEmortalKid
Copy link
Member

commented Feb 21, 2019

Fixes #128

Adds an operator that behaves like . when accessing properties.

Once #191 is merged and this is merged, we might be able to use the logic in 191 to support giv. I've left it separate at the moment. lvl will also be a property accessor, but might not play into the same way the binary operators do (basically a replacement for a character)

@AnEmortalKid AnEmortalKid requested review from Pholey and vpzomtrrfrt Feb 21, 2019

@@ -1189,7 +1231,11 @@ function parseStatement(parseContext) {
// if there's more tokens, split them by a ' ' similar to how joinTokens would work
if(tokens.length > 0)
{
statement += ' ';
// peek at the next token and don't apply space since it would break
if(shouldSeparateTokens(tokens))

This comment has been minimized.

Copy link
@vpzomtrrfrt

vpzomtrrfrt Feb 23, 2019

Member

This doesn't seem to be necessary, though it does make the output slightly nicer

This comment has been minimized.

Copy link
@AnEmortalKid

AnEmortalKid Feb 23, 2019

Author Member

ah, does document . window work? i'll double check on the console

This comment has been minimized.

Copy link
@AnEmortalKid

AnEmortalKid Feb 23, 2019

Author Member
$ node
> x = {
... a: 5
... }
{ a: 5 }
> x . a
5
>

I could go either way, without the separate token bit it just makes things slightly simpler

This comment has been minimized.

Copy link
@AnEmortalKid

AnEmortalKid Feb 26, 2019

Author Member

@vpzomtrrfrt any preference? looks like the beautyfier would actually combine those, so my vote is no-fancy thing and just let it separate them!

This comment has been minimized.

Copy link
@AnEmortalKid

AnEmortalKid Feb 28, 2019

Author Member

Since it simplifies our stuff, i'm gonna get rid of the check !

@@ -0,0 +1 @@
document giv body is 'blah'

This comment has been minimized.

Copy link
@vpzomtrrfrt

vpzomtrrfrt Feb 23, 2019

Member

Maybe we shouldn't assign strings to elements? Trying this in Firefox actually throws a TypeError

This comment has been minimized.

Copy link
@AnEmortalKid

AnEmortalKid Feb 23, 2019

Author Member

well i only set this as the test, but i can update it to an html string? idk what would be more appropriate. these only get compared to the parsed out JS and not actually ran (the js)

AnEmortalKid added some commits Feb 24, 2019

@AnEmortalKid AnEmortalKid merged commit a3b121a into dogescript:master Feb 28, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@AnEmortalKid AnEmortalKid deleted the AnEmortalKid:giv branch Feb 28, 2019

@AnEmortalKid AnEmortalKid referenced this pull request Mar 5, 2019

Open

2.4 Feature List #114

6 of 15 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.