JavaScript-Embedded
view release on metacpan or search on metacpan
lib/JavaScript/Embedded/C/lib/duktape.c view on Meta::CPAN
return 365 * (year - 1970) + duk__div_floor(year - 1969, 4) - duk__div_floor(year - 1901, 100) +
duk__div_floor(year - 1601, 400);
}
/* Given a day number, determine year and day-within-year. */
DUK_LOCAL duk_int_t duk__year_from_day(duk_int_t day, duk_small_int_t *out_day_within_year) {
duk_int_t year;
duk_int_t diff_days;
/* estimate year upwards (towards positive infinity), then back down;
* two iterations should be enough
*/
if (day >= 0) {
year = 1970 + day / 365;
} else {
year = 1970 + day / 366;
}
for (;;) {
diff_days = duk__day_from_year(year) - day;
t/data/typescript.js view on Meta::CPAN
getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ {});
}
});
return result;
}
/**
* Find symbol of the given property-name and add the symbol to the given result array
* @param symbol a symbol to start searching for the given propertyName
* @param propertyName a name of property to serach for
* @param result an array of symbol of found property symbols
* @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisitng of the same symbol.
* The value of previousIterationSymbol is undefined when the function is first called.
*/
function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) {
if (!symbol) {
return;
}
// If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited
// This is particularly important for the following cases, so that we do not infinitely visit the same symbol.
// For example:
// interface C extends C {
( run in 1.212 second using v1.01-cache-2.11-cpan-71847e10f99 )