com.google.javascript.jscomp
Class SourceMapLegacy

java.lang.Object
  extended by com.google.javascript.jscomp.SourceMapLegacy
All Implemented Interfaces:
SourceMap

public class SourceMapLegacy
extends Object
implements SourceMap

Collects information mapping the generated (compiled) source back to its original source for debugging purposes.

See Also:
CodeConsumer, CodeGenerator, CodePrinter

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.google.javascript.jscomp.SourceMap
SourceMap.DetailLevel, SourceMap.Format
 
Constructor Summary
SourceMapLegacy()
           
 
Method Summary
 void addMapping(Node node, com.google.javascript.jscomp.Position startPosition, com.google.javascript.jscomp.Position endPosition)
          Adds a mapping for the given node.
 void appendTo(Appendable out, String name)
          Appends the source map in LavaBug format to the given buffer.
 void reset()
          Resets the source map for reuse for the generation of a new source file.
 void setStartingPosition(int offsetLine, int offsetIndex)
          Sets the source code that exists in the buffer to which the generated code is being generated.
 void setWrapperPrefix(String prefix)
          Sets the prefix used for wrapping the generated source file before it is output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceMapLegacy

public SourceMapLegacy()
Method Detail

addMapping

public void addMapping(Node node,
                       com.google.javascript.jscomp.Position startPosition,
                       com.google.javascript.jscomp.Position endPosition)
Adds a mapping for the given node. Mappings must be added in order.

Specified by:
addMapping in interface SourceMap
Parameters:
node - The node that the new mapping represents.
startPosition - The position on the starting line
endPosition - The position on the ending line.

setWrapperPrefix

public void setWrapperPrefix(String prefix)
Sets the prefix used for wrapping the generated source file before it is output. This ensures that the source map is adjusted as needed.

Specified by:
setWrapperPrefix in interface SourceMap
Parameters:
prefix - The prefix that is added before the generated source code.

setStartingPosition

public void setStartingPosition(int offsetLine,
                                int offsetIndex)
Sets the source code that exists in the buffer to which the generated code is being generated. This ensures that the source map accurately reflects the fact that the source is being appended to an existing buffer and as such, does not start at line 0, position 0 but rather some other line and position.

Specified by:
setStartingPosition in interface SourceMap
Parameters:
offsetLine - The index of the current line being printed.
offsetIndex - The column index of the current character being printed.

reset

public void reset()
Resets the source map for reuse for the generation of a new source file.

Specified by:
reset in interface SourceMap

appendTo

public void appendTo(Appendable out,
                     String name)
              throws IOException
Appends the source map in LavaBug format to the given buffer.

Specified by:
appendTo in interface SourceMap
Parameters:
out - The stream to which the map will be appended.
name - The name of the generated source file that this source map represents.
Throws:
IOException