createSourceMap(element, path, produceLineColumnAttributes) {
    if (this.ast) {
      const NumberElement = this.namespace.elements.Number;
      const SourceMap = this.namespace.getElementClass('sourceMap');
      const position = this.ast.getPosition(path);

      if (position && position.start && position.end
          && !Number.isNaN(position.start.pointer) && !Number.isNaN(position.end.pointer)) {
        const start = new NumberElement(position.start.pointer);
        const end = new NumberElement(position.end.pointer - position.start.pointer);

        if (produceLineColumnAttributes) {
          start.attributes.set('line', position.start.line);
          start.attributes.set('column', position.start.column);
          end.attributes.set('line', position.end.line);
          end.attributes.set('column', position.end.column);
        }

        element.attributes.set('sourceMap', [new SourceMap([[start, end]])]);
      }
    }
  }
// Make a new source map for the given element
Make a new source map for the given element
Make a new source map for the given element
createSourceMap(element, path, produceLineColumnAttributes) {
    if (this.ast) {
      const NumberElement = this.namespace.elements.Number;
      const SourceMap = this.namespace.getElementClass('sourceMap');
      const position = this.ast.getPosition(path);
      if (position && position.start && position.end
          && !Number.isNaN(position.start.pointer) && !Number.isNaN(position.end.pointer)) {
        const start = new NumberElement(position.start.pointer);
        const end = new NumberElement(position.end.pointer - position.start.pointer);
        if (produceLineColumnAttributes) {
          start.attributes.set('line', position.start.line);
          start.attributes.set('column', position.start.column);
          end.attributes.set('line', position.end.line);
          end.attributes.set('column', position.end.column);
        }
        element.attributes.set('sourceMap', [new SourceMap([[start, end]])]);
      }
    }
  }
createSourceMap ( element , path , produceLineColumnAttributes ) { if ( this . ast ) { const NumberElement = this . namespace . elements . Number ; const SourceMap = this . namespace . getElementClass ( 'sourceMap' ) ; const position = this . ast . getPosition ( path ) ; if ( position && position . start && position . end && ! Number . isNaN ( position . start . pointer ) && ! Number . isNaN ( position . end . pointer ) ) { const start = new NumberElement ( position . start . pointer ) ; const end = new NumberElement ( position . end . pointer - position . start . pointer ) ; if ( produceLineColumnAttributes ) { start . attributes . set ( 'line' , position . start . line ) ; start . attributes . set ( 'column' , position . start . column ) ; end . attributes . set ( 'line' , position . end . line ) ; end . attributes . set ( 'column' , position . end . column ) ; } element . attributes . set ( 'sourceMap' , [ new SourceMap ( [ [ start , end ] ] ) ] ) ; } } }
Make a new source map for the given element
Make a new source map for the given element