SourceReference constructor

SourceReference(
  1. SourceSpan sourceSpan,
  2. CompileDirectiveMetadata? compileDirectiveMetadata
)

Returns a SourceReference accounting for the templateOffset.

Implementation

factory SourceReference(SourceSpan sourceSpan,
    CompileDirectiveMetadata? compileDirectiveMetadata) {
  var templateOffset =
      compileDirectiveMetadata?.template?.templateOffset ?? 0;
  return SourceReference._(sourceSpan.start.offset + templateOffset,
      sourceSpan.end.offset + templateOffset, sourceSpan.sourceUrl!);
}