Skip to content

Commit

Permalink
Merge branch 'type-array' of https://github.com/nshaheed/chuck into t…
Browse files Browse the repository at this point in the history
…ype-array
  • Loading branch information
nshaheed committed Nov 8, 2023
2 parents 3c81644 + e1d99e4 commit 4cab545
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/chuck_absyn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,10 @@ a_Exp new_exp_from_array_lit( a_Array_Sub exp_list, uint32_t lineNum, uint32_t p
a->s_meta = ae_meta_value;
a->primary.s_type = ae_primary_array;
a->primary.array = exp_list;
a->primary.array->self = a; // 1.5.1.9 (ge & nshaheed) added
a->line = lineNum; a->where = posNum;
a->primary.line = lineNum; a->primary.where = posNum;
a->primary.self = a;

return a;
}

Expand Down
9 changes: 8 additions & 1 deletion src/core/chuck_lang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3492,7 +3492,8 @@ CK_DLL_MFUN( type_isObject )
CK_DLL_MFUN( type_isArray )
{
Chuck_Type * type = (Chuck_Type *)SELF;
RETURN->v_int = type->array_depth > 0;
// test for arrayhood -- either array depth > 0 or type could be "@array" | 1.5.1.9
RETURN->v_int = type->array_depth > 0 || isa(type, type->env()->ckt_array);
}

CK_DLL_MFUN( type_arrayDims )
Expand Down Expand Up @@ -3525,7 +3526,13 @@ CK_DLL_SFUN( type_typeOf_obj )
RETURN->v_object = NULL;
return;
}

// get type
// NOTE: Chuck_Object->type_ref may have different semantics for typeOf() and Type.of()
// [1.0] @=> float array[];
// <<< array.typeOf().isArray() >>>;
// <<< Type.of(array).isArray() >>>;
// TODO: do these need to be unified?
RETURN->v_object = obj->type_ref;
}

Expand Down

0 comments on commit 4cab545

Please sign in to comment.