perf(compiler): should only perform assertions during tests
Compiler assertions are made to ensure implementation correctness, but they have performance costs that should not affect users during development.
This commit is contained in:
@@ -77,7 +77,7 @@ export function getInnerRange(
|
||||
offset: number,
|
||||
length?: number
|
||||
): SourceLocation {
|
||||
__DEV__ && assert(offset <= loc.source.length)
|
||||
__TEST__ && assert(offset <= loc.source.length)
|
||||
const source = loc.source.substr(offset, length)
|
||||
const newLoc: SourceLocation = {
|
||||
source,
|
||||
@@ -86,7 +86,7 @@ export function getInnerRange(
|
||||
}
|
||||
|
||||
if (length != null) {
|
||||
__DEV__ && assert(offset + length <= loc.source.length)
|
||||
__TEST__ && assert(offset + length <= loc.source.length)
|
||||
newLoc.end = advancePositionWithClone(
|
||||
loc.start,
|
||||
loc.source,
|
||||
|
||||
Reference in New Issue
Block a user