Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e35ed32

Browse files
committed
Fix bugs
1 parent c603e2e commit e35ed32

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

‎lib/SubInput.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module.exports = class SubInput {
2727
columnInContext = column + this.columnInContext - 1;
2828
} else {
2929
lineInContext = this.lineInContext + line - 1;
30+
columnInContext = column;
3031
}
3132

3233
return this.context.error(message, lineInContext, columnInContext, opts);

‎lib/index.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ function positionAfter(node, chunks) {
4242

4343
module.exports = {
4444
parse(css, options) {
45+
if (!options) options = {};
46+
4547
let input;
4648
if (options.context) {
4749
if (!options.lineInContext || !options.columnInContext) {

‎lib/nodes/Func.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ class Func extends Container {
8686
// use a new parser to parse the params of the function. recursion here makes for easier maint
8787
// we must require this here due to circular dependency resolution
8888
const { parse } = require('../'); // eslint-disable-line global-require
89-
const root = parse(params, opts);
89+
const root = parse(params, {
90+
...opts,
91+
context: parser.input,
92+
lineInContext: brackets[2],
93+
columnInContext: brackets[3] + 1
94+
});
9095
const { nodes: children } = root;
9196

9297
// TODO: correct line and character position (should we just pad the input? probably easiest)

‎lib/nodes/Interpolation.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ class Interpolation extends Container {
6666
// use a new parser to parse the params of the function. recursion here makes for easier maint
6767
// we must require this here due to circular dependency resolution
6868
const { parse } = require('../'); // eslint-disable-line global-require
69-
const { nodes: children } = parse(params, parser.options);
69+
const { nodes: children } = parse(params, {
70+
...parser.options,
71+
context: parser.input,
72+
lineInContext: first[2],
73+
columnInContext: first[3] + first[1].length + 1
74+
});
7075

7176
// TODO: correct line and character position (should we just pad the input? probably easiest)
7277
for (const child of children) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /