本文整理汇总了C++中SourceCode::startOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ SourceCode::startOffset方法的具体用法?C++ SourceCode::startOffset怎么用?C++ SourceCode::startOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SourceCode
的用法示例。
在下文中一共展示了SourceCode::startOffset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: link
FunctionExecutable* UnlinkedFunctionExecutable::link(VM& vm, const SourceCode& ownerSource, int overrideLineNumber)
{
SourceCode source = m_sourceOverride ? SourceCode(m_sourceOverride) : ownerSource;
unsigned firstLine = source.firstLine() + m_firstLineOffset;
unsigned startOffset = source.startOffset() + m_startOffset;
unsigned lineCount = m_lineCount;
// Adjust to one-based indexing.
bool startColumnIsOnFirstSourceLine = !m_firstLineOffset;
unsigned startColumn = m_unlinkedBodyStartColumn + (startColumnIsOnFirstSourceLine ? source.startColumn() : 1);
bool endColumnIsOnStartLine = !lineCount;
unsigned endColumn = m_unlinkedBodyEndColumn + (endColumnIsOnStartLine ? startColumn : 1);
SourceCode code(source.provider(), startOffset, startOffset + m_sourceLength, firstLine, startColumn);
FunctionOverrides::OverrideInfo overrideInfo;
bool hasFunctionOverride = false;
if (UNLIKELY(Options::functionOverrides())) {
hasFunctionOverride = FunctionOverrides::initializeOverrideFor(code, overrideInfo);
if (hasFunctionOverride) {
firstLine = overrideInfo.firstLine;
lineCount = overrideInfo.lineCount;
startColumn = overrideInfo.startColumn;
endColumn = overrideInfo.endColumn;
code = overrideInfo.sourceCode;
}
}
FunctionExecutable* result = FunctionExecutable::create(vm, code, this, firstLine, firstLine + lineCount, startColumn, endColumn);
if (overrideLineNumber != -1)
result->setOverrideLineNumber(overrideLineNumber);
if (UNLIKELY(hasFunctionOverride)) {
result->overrideParameterAndTypeProfilingStartEndOffsets(
overrideInfo.parametersStartOffset,
overrideInfo.typeProfilingStartOffset,
overrideInfo.typeProfilingEndOffset);
}
return result;
}