Skip to content

Commit

Permalink
working on issue #509
Browse files Browse the repository at this point in the history
  • Loading branch information
objeck committed Feb 4, 2025
1 parent 653b21a commit e711dec
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
7 changes: 5 additions & 2 deletions core/compiler/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2632,16 +2632,19 @@ void ContextAnalyzer::AnalyzeNewArrayCall(MethodCall* method_call, const int dep
case BYTE_TYPE:
case CHAR_TYPE:
case INT_TYPE:
if(expression->GetExpressionType() == VAR_EXPR && !static_cast<Variable*>(expression)->GetIndices()) {
ProcessError(expression, L"Array index type must be an Int, Char, Byte or enum scalar");
}
break;

case CLASS_TYPE:
if(!IsEnumExpression(expression)) {
ProcessError(expression, L"Array index type must be an Integer, Char, Byte or Enum");
ProcessError(expression, L"Array index type must be an Int, Char, Byte or enum");
}
break;

default:
ProcessError(expression, L"Array index type must be an Integer, Char, Byte or Enum");
ProcessError(expression, L"Array index type must be an Int, Char, Byte or enum");
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/compiler/lib_src/net_secure.obs
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@ buffer->ToString()->Trim()->PrintLine();
frame[1] := mask_payload_length;
EncodeInt(length, frame, 2, 8);

if(@is_debug){
if(@is_debug) {
opcodes := Byte->New[9];
opcodes[0] := frame[0];
opcodes[1] := frame[1];
Expand Down Expand Up @@ -1281,9 +1281,9 @@ buffer->ToString()->Trim()->PrintLine();
each(f in frame) {
buffer->Append(f)
};
"\n==="->PrintLine();

buffer->ToByteArray()->ToHexString()->PrintLine();
"\n==="->PrintLine();
};

return @socket->WriteBuffer(frame) > 0;
Expand Down
15 changes: 15 additions & 0 deletions programs/tests/prgm333.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Test {
function : Main(args : String[]) ~ Nil {
a := [1, 2, 3];
a->Size()->PrintLine();

b := Int->New[a];
#~
l := a->Size();
b := Int->New[l];
Runtime->Copy(b, 0, a, 0, l);
~#

b->Size()->PrintLine();
}
}

0 comments on commit e711dec

Please sign in to comment.