main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
833 bytes
|
Line | |
---|
1 | import { ArrayElement } from 'minim';
|
---|
2 | class SourceMap extends ArrayElement {
|
---|
3 | constructor(content, meta, attributes) {
|
---|
4 | super(content, meta, attributes);
|
---|
5 | this.element = 'sourceMap';
|
---|
6 | }
|
---|
7 | get positionStart() {
|
---|
8 | return this.children.filter(item => item.classes.contains('position')).get(0);
|
---|
9 | }
|
---|
10 | get positionEnd() {
|
---|
11 | return this.children.filter(item => item.classes.contains('position')).get(1);
|
---|
12 | }
|
---|
13 | set position(position) {
|
---|
14 | if (typeof position === 'undefined') {
|
---|
15 | return;
|
---|
16 | }
|
---|
17 | const start = new ArrayElement([position.start.row, position.start.column, position.start.char]);
|
---|
18 | const end = new ArrayElement([position.end.row, position.end.column, position.end.char]);
|
---|
19 | start.classes.push('position');
|
---|
20 | end.classes.push('position');
|
---|
21 | this.push(start).push(end);
|
---|
22 | }
|
---|
23 | }
|
---|
24 | export default SourceMap; |
---|
Note:
See
TracBrowser
for help on using the repository browser.