| Index: src/handles.cc
|
| ===================================================================
|
| --- src/handles.cc (revision 9927)
|
| +++ src/handles.cc (working copy)
|
| @@ -662,7 +662,20 @@
|
| return right + script->line_offset()->value();
|
| }
|
|
|
| +// Convert code position into column number.
|
| +int GetScriptColumnNumber(Handle<Script> script, int code_pos) {
|
| + int line_number = GetScriptLineNumber(script, code_pos);
|
| + if (line_number == -1) return -1;
|
|
|
| + AssertNoAllocation no_allocation;
|
| + FixedArray* line_ends_array = FixedArray::cast(script->line_ends());
|
| + line_number = line_number - script->line_offset()->value();
|
| + if (line_number == 0) return code_pos + script->column_offset()->value();
|
| + int prev_line_end_pos =
|
| + Smi::cast(line_ends_array->get(line_number - 1))->value();
|
| + return code_pos - (prev_line_end_pos + 1);
|
| +}
|
| +
|
| int GetScriptLineNumberSafe(Handle<Script> script, int code_pos) {
|
| AssertNoAllocation no_allocation;
|
| if (!script->line_ends()->IsUndefined()) {
|
|
|