Changeset 0c327ce for src/ControlStruct


Ignore:
Timestamp:
Jul 12, 2024, 3:30:06 PM (7 days ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
76b507d
Parents:
9c447e2
Message:
  1. Add bound check to Serial function: now compiler generates the unchecked functions in ImplementEnumFunc?, and enum.hfa implements the bound check on top. Todo: Wrapped the checked version into a trait; 2. countof is now works on any type that implement Countof(). Because Countof() is implemented in enum.hfa for all CfaEnum?, we can call countof on { T | CfaEnum?(T) }
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/TranslateEnumRange.cpp

    r9c447e2 r0c327ce  
    8181            ast::UntypedExpr::createCall( location, "upperBound", {} )  });
    8282    auto increment = ast::UntypedExpr::createCall( location,
    83         stmt->is_inc? "succ": "pred",
     83        stmt->is_inc? "succ_unsafe": "pred_unsafe",
    8484        { new ast::NameExpr( location, indexName ) });
    8585    auto assig = ast::UntypedExpr::createAssign( location, new ast::NameExpr( location, indexName ), increment );
Note: See TracChangeset for help on using the changeset viewer.