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

Cast: Fix for VC #2

Closed
wants to merge 11 commits into from
Closed

Cast: Fix for VC #2

wants to merge 11 commits into from

Conversation

am11
Copy link

@am11 am11 commented Nov 17, 2014

As described at: sass#635 (comment).

mgreter and others added 11 commits November 14, 2014 20:13
With string input, the "stdin" entry would get sorted away
from the start of the array. This lead to a strange bug
since we skip the first item when copying that information
back to the implementer.
Define a custom function named '@warn' to get called when
the corresponding statement is found in sass code. Use a
function named '*' as a fallback, if the requested function
is not found. The original function name will be the first
argument (along with the rest of the original arguments).
User will need to create a copy if the memory is static!
Otherwise he can pass the string to libsass and we will
take care to free the memory when the context is destroyed.
Allows to port sassc easier to the new API!
Additionally fixes some 'const char*' missuses!
This allows to query include files before the compile step!
We do not want to force implementers to need json parsing
functionality, just to get the extended error information.
We may not know how long these strings will live, therefore
we pay to price to create copies of them. We only let users
pass potentially very big char arrays directly to libsass!
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 915362d on am11:api/c-interface into 57a0158 on mgreter:api/c-interface.

@am11
Copy link
Author

am11 commented Nov 17, 2014

Separately, I have found a little inconsistency with JSON errors column number.

Consider the following code:

$test: (
  one: 1,
  two: 2,
;

Given line and comlum numbers are zero-based (is that so?) one-based, the "missing )" error is on line: 3, column: 0. line: 4, column: 0.

But, it returns:

{
        "status": 1,
        "path": "C:/temp/foo.scss",
        "line": 3,
        "column": 9,
        "message": "invalid syntax"
}

Also, the JSON has eight-space indentation, can you please reduce it to four?

Thanks!

@am11
Copy link
Author

am11 commented Nov 17, 2014

In the same example code, I made an error on line: 1:

-$test: (
  one: 1,
  two: 2,
);

It returns:

{
        "status": 1,
        "path": "C:/temp/foo.scss",
        "line": 1,
        "column": 1,
        "message": "invalid top-level expression"
}

The index, in fact, starts with 1.

I have updated the above comment accordingly.

Question: Are we using the same 1-based indexes with source-maps as well?

@am11
Copy link
Author

am11 commented Nov 17, 2014

Side note: can you please change path to file? Normally, this is what nodejs linters (jshint, jscs, tslint, coffelint etc.) call it. :)

@mgreter
Copy link
Owner

mgreter commented Nov 17, 2014

The error position is reported as previously. I merely just pass the internal values through.
I replaced the "tab" indentation of the json with two spaces, if that is ok with you?

@mgreter
Copy link
Owner

mgreter commented Nov 17, 2014

Cherrypicked your commit into my branch!

@mgreter mgreter closed this Nov 17, 2014
@am11
Copy link
Author

am11 commented Nov 17, 2014

That is awesome; less noisy and sleeker! Thanks. 😄 👍

For error position, there is this related issue, that the message in JSON also include legacy error position: sass#652 (comment). :)

@am11 am11 deleted the api/c-interface branch November 17, 2014 19:38
@mgreter
Copy link
Owner

mgreter commented Nov 17, 2014

The Backtrace is IMO added in error_handling.cpp. But I'm unsure if we really should disable it right away, since old implementations will only consume that string. Although I agree that this should not be embeded into the message string!

mgreter added a commit that referenced this pull request Feb 21, 2015
mgreter added a commit that referenced this pull request Feb 21, 2015
mgreter added a commit that referenced this pull request Feb 21, 2015
mgreter added a commit that referenced this pull request Mar 24, 2015
mgreter added a commit that referenced this pull request Jun 16, 2019
mgreter added a commit that referenced this pull request Jun 16, 2019
mgreter added a commit that referenced this pull request Jun 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants