make sourcegraph.Location fields readonly (#1696)

This commit is contained in:
Quinn Slack 2019-01-11 11:35:58 -08:00 committed by GitHub
parent feca5739ba
commit c62b279499
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

View File

@ -304,12 +304,12 @@ declare module 'sourcegraph' {
/**
* The resource identifier of this location.
*/
uri: URI
readonly uri: URI
/**
* The document range of this location.
*/
range?: Range
readonly range?: Range
/**
* Creates a new location object.

View File

@ -14,12 +14,9 @@ export class Location implements sourcegraph.Location {
return Range.isRange((thing as Location).range) && URI.isURI((thing as Location).uri)
}
public uri: sourcegraph.URI
public range?: sourcegraph.Range
constructor(uri: sourcegraph.URI, rangeOrPosition?: sourcegraph.Range | sourcegraph.Position) {
this.uri = uri
public readonly range?: sourcegraph.Range
constructor(public readonly uri: sourcegraph.URI, rangeOrPosition?: sourcegraph.Range | sourcegraph.Position) {
if (!rangeOrPosition) {
// that's OK
} else if (rangeOrPosition instanceof Range) {