(message, line, column, opts = {})
| 83 | } |
| 84 | |
| 85 | error(message, line, column, opts = {}) { |
| 86 | let endColumn, endLine, endOffset, offset, result |
| 87 | |
| 88 | if (line && typeof line === 'object') { |
| 89 | let start = line |
| 90 | let end = column |
| 91 | if (typeof start.offset === 'number') { |
| 92 | offset = start.offset |
| 93 | let pos = this.fromOffset(offset) |
| 94 | line = pos.line |
| 95 | column = pos.col |
| 96 | } else { |
| 97 | line = start.line |
| 98 | column = start.column |
| 99 | offset = this.fromLineAndColumn(line, column) |
| 100 | } |
| 101 | if (typeof end.offset === 'number') { |
| 102 | endOffset = end.offset |
| 103 | let pos = this.fromOffset(endOffset) |
| 104 | endLine = pos.line |
| 105 | endColumn = pos.col |
| 106 | } else { |
| 107 | endLine = end.line |
| 108 | endColumn = end.column |
| 109 | endOffset = this.fromLineAndColumn(end.line, end.column) |
| 110 | } |
| 111 | } else if (!column) { |
| 112 | offset = line |
| 113 | let pos = this.fromOffset(offset) |
| 114 | line = pos.line |
| 115 | column = pos.col |
| 116 | } else { |
| 117 | offset = this.fromLineAndColumn(line, column) |
| 118 | } |
| 119 | |
| 120 | let origin = this.origin(line, column, endLine, endColumn) |
| 121 | if (origin) { |
| 122 | result = new CssSyntaxError( |
| 123 | message, |
| 124 | origin.endLine === undefined |
| 125 | ? origin.line |
| 126 | : { column: origin.column, line: origin.line }, |
| 127 | origin.endLine === undefined |
| 128 | ? origin.column |
| 129 | : { column: origin.endColumn, line: origin.endLine }, |
| 130 | origin.source, |
| 131 | origin.file, |
| 132 | opts.plugin |
| 133 | ) |
| 134 | } else { |
| 135 | result = new CssSyntaxError( |
| 136 | message, |
| 137 | endLine === undefined ? line : { column, line }, |
| 138 | endLine === undefined ? column : { column: endColumn, line: endLine }, |
| 139 | this.css, |
| 140 | this.file, |
| 141 | opts.plugin |
| 142 | ) |
nothing calls this directly
no test coverage detected