ソースを参照

The line numbers was still showing incorrectly with the last fix, for a while stick for a linear search.

mingodad 13 年 前
コミット
6a60560ae9
1 ファイル変更10 行追加0 行削除
  1. 10 0
      SquiLu/squirrel/sqobject.cpp

+ 10 - 0
SquiLu/squirrel/sqobject.cpp

@@ -223,6 +223,15 @@ const SQChar* SQFunctionProto::GetLocal(SQVM *vm,SQUnsignedInteger stackbase,SQU
 
 SQInteger SQFunctionProto::GetLine(SQInstruction *curr)
 {
+	SQInteger op = (SQInteger)(curr-_instructions);
+	SQInteger line=_lineinfos[0]._line;
+	for(SQInteger i=1;i<_nlineinfos;i++){
+		if(_lineinfos[i]._op>=op)
+			return line;
+		line=_lineinfos[i]._line;
+	}
+	return line;
+#if 0
     SQInteger op = (SQInteger)(curr-_instructions);
     SQInteger low = 0;
     SQInteger high = _nlineinfos - 1;
@@ -250,6 +259,7 @@ SQInteger SQFunctionProto::GetLine(SQInstruction *curr)
     while(_lineinfos[mid]._op > op && mid >= 0) mid--;
 
     return _lineinfos[mid]._line;
+#endif
 }
 
 SQClosure::~SQClosure()