Global constants pushed directly into the global constants table:
static const StaticString s_mpi("M_PI");
virtual moduleLoad(Hdf config) {
Native::RegisterConstantDouble(s_mpi.get(), 3.1415926535);
}
While Class constants are queued into a temporary table,
then picked up during PCE emit as Systemlib is parsed:
static const StaticString s_math("Math");
static const StaticString s_pi("PI");
virtual moduleLoad(Hdf config) {
Native::RegisterClassConstantDouble(s_math.get(), s_pi.get(),
3.1415926535);
}
.
<?php
class Math {
// PI will be injected here at emit time
}
Reviewed By: @jdelong
Differential Revision: D963642