Skip to content

Commit

Permalink
working on issue #510
Browse files Browse the repository at this point in the history
  • Loading branch information
objeck committed Feb 7, 2025
1 parent 8882b67 commit 199a11e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions core/compiler/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2643,6 +2643,7 @@ void ContextAnalyzer::AnalyzeNewArrayCall(MethodCall* method_call, const int dep
if(expressions.size() == 0) {
ProcessError(static_cast<Expression*>(method_call), L"Empty array index");
}

// TODO: check for dimension size of 1, looking at type
else if(expressions.size() == 1 && expressions[0]->GetExpressionType() == VAR_EXPR &&
expressions[0]->GetEvalType() && expressions[0]->GetEvalType()->GetDimension() ) {
Expand Down
4 changes: 0 additions & 4 deletions core/compiler/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ void IntermediateProgram::Write(bool emit_lib, bool is_debug, OutputStream& out_
}
}



// write byte strings
WriteInt((int)byte_strings.size(), out_stream);
for(size_t i = 0; i < byte_strings.size(); ++i) {
Expand All @@ -176,8 +174,6 @@ void IntermediateProgram::Write(bool emit_lib, bool is_debug, OutputStream& out_
}
}



// write int strings
WriteInt((int)int_strings.size(), out_stream);
for(size_t i = 0; i < int_strings.size(); ++i) {
Expand Down
3 changes: 1 addition & 2 deletions core/compiler/intermediate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,7 @@ void IntermediateEmitter::Translate()

Class* start_class = parsed_program->GetStartClass();
Method* start_method = parsed_program->GetStartMethod();
imm_program->SetStartIds((start_class ? start_class->GetId() : -1),
(start_method ? start_method->GetId() : -1));
imm_program->SetStartIds((start_class ? start_class->GetId() : -1), (start_method ? start_method->GetId() : -1));

#ifdef _DEBUG
assert(break_labels.empty());
Expand Down
5 changes: 3 additions & 2 deletions programs/tests/prgm333.obs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
class Test {
function : Main(args : String[]) ~ Nil {
a := [1, 2, 3]->As(Byte[]);
a := [1, 2, 3]->As(Int[]);

# a := [1.1, 2.2, 3.3];
# b := a->Copy();

b : Byte[] := a->Copy();
# b : Byte[] := a->Copy();
b := Int->New[a];

b[2]->PrintLine();
b->Size()->PrintLine();
Expand Down

0 comments on commit 199a11e

Please sign in to comment.