()
| 282 | } |
| 283 | |
| 284 | func createMathTemplate() *objectTemplate { |
| 285 | t := newObjectTemplate() |
| 286 | t.protoFactory = func(r *Runtime) *Object { |
| 287 | return r.global.ObjectPrototype |
| 288 | } |
| 289 | |
| 290 | t.putStr("E", func(r *Runtime) Value { return valueProp(valueFloat(math.E), false, false, false) }) |
| 291 | t.putStr("LN10", func(r *Runtime) Value { return valueProp(valueFloat(math.Ln10), false, false, false) }) |
| 292 | t.putStr("LN2", func(r *Runtime) Value { return valueProp(valueFloat(math.Ln2), false, false, false) }) |
| 293 | t.putStr("LOG10E", func(r *Runtime) Value { return valueProp(valueFloat(math.Log10E), false, false, false) }) |
| 294 | t.putStr("LOG2E", func(r *Runtime) Value { return valueProp(valueFloat(math.Log2E), false, false, false) }) |
| 295 | t.putStr("PI", func(r *Runtime) Value { return valueProp(valueFloat(math.Pi), false, false, false) }) |
| 296 | t.putStr("SQRT1_2", func(r *Runtime) Value { return valueProp(valueFloat(sqrt1_2), false, false, false) }) |
| 297 | t.putStr("SQRT2", func(r *Runtime) Value { return valueProp(valueFloat(math.Sqrt2), false, false, false) }) |
| 298 | |
| 299 | t.putSym(SymToStringTag, func(r *Runtime) Value { return valueProp(asciiString(classMath), false, false, true) }) |
| 300 | |
| 301 | t.putStr("abs", func(r *Runtime) Value { return r.methodProp(r.math_abs, "abs", 1) }) |
| 302 | t.putStr("acos", func(r *Runtime) Value { return r.methodProp(r.math_acos, "acos", 1) }) |
| 303 | t.putStr("acosh", func(r *Runtime) Value { return r.methodProp(r.math_acosh, "acosh", 1) }) |
| 304 | t.putStr("asin", func(r *Runtime) Value { return r.methodProp(r.math_asin, "asin", 1) }) |
| 305 | t.putStr("asinh", func(r *Runtime) Value { return r.methodProp(r.math_asinh, "asinh", 1) }) |
| 306 | t.putStr("atan", func(r *Runtime) Value { return r.methodProp(r.math_atan, "atan", 1) }) |
| 307 | t.putStr("atanh", func(r *Runtime) Value { return r.methodProp(r.math_atanh, "atanh", 1) }) |
| 308 | t.putStr("atan2", func(r *Runtime) Value { return r.methodProp(r.math_atan2, "atan2", 2) }) |
| 309 | t.putStr("cbrt", func(r *Runtime) Value { return r.methodProp(r.math_cbrt, "cbrt", 1) }) |
| 310 | t.putStr("ceil", func(r *Runtime) Value { return r.methodProp(r.math_ceil, "ceil", 1) }) |
| 311 | t.putStr("clz32", func(r *Runtime) Value { return r.methodProp(r.math_clz32, "clz32", 1) }) |
| 312 | t.putStr("cos", func(r *Runtime) Value { return r.methodProp(r.math_cos, "cos", 1) }) |
| 313 | t.putStr("cosh", func(r *Runtime) Value { return r.methodProp(r.math_cosh, "cosh", 1) }) |
| 314 | t.putStr("exp", func(r *Runtime) Value { return r.methodProp(r.math_exp, "exp", 1) }) |
| 315 | t.putStr("expm1", func(r *Runtime) Value { return r.methodProp(r.math_expm1, "expm1", 1) }) |
| 316 | t.putStr("floor", func(r *Runtime) Value { return r.methodProp(r.math_floor, "floor", 1) }) |
| 317 | t.putStr("fround", func(r *Runtime) Value { return r.methodProp(r.math_fround, "fround", 1) }) |
| 318 | t.putStr("hypot", func(r *Runtime) Value { return r.methodProp(r.math_hypot, "hypot", 2) }) |
| 319 | t.putStr("imul", func(r *Runtime) Value { return r.methodProp(r.math_imul, "imul", 2) }) |
| 320 | t.putStr("log", func(r *Runtime) Value { return r.methodProp(r.math_log, "log", 1) }) |
| 321 | t.putStr("log1p", func(r *Runtime) Value { return r.methodProp(r.math_log1p, "log1p", 1) }) |
| 322 | t.putStr("log10", func(r *Runtime) Value { return r.methodProp(r.math_log10, "log10", 1) }) |
| 323 | t.putStr("log2", func(r *Runtime) Value { return r.methodProp(r.math_log2, "log2", 1) }) |
| 324 | t.putStr("max", func(r *Runtime) Value { return r.methodProp(r.math_max, "max", 2) }) |
| 325 | t.putStr("min", func(r *Runtime) Value { return r.methodProp(r.math_min, "min", 2) }) |
| 326 | t.putStr("pow", func(r *Runtime) Value { return r.methodProp(r.math_pow, "pow", 2) }) |
| 327 | t.putStr("random", func(r *Runtime) Value { return r.methodProp(r.math_random, "random", 0) }) |
| 328 | t.putStr("round", func(r *Runtime) Value { return r.methodProp(r.math_round, "round", 1) }) |
| 329 | t.putStr("sign", func(r *Runtime) Value { return r.methodProp(r.math_sign, "sign", 1) }) |
| 330 | t.putStr("sin", func(r *Runtime) Value { return r.methodProp(r.math_sin, "sin", 1) }) |
| 331 | t.putStr("sinh", func(r *Runtime) Value { return r.methodProp(r.math_sinh, "sinh", 1) }) |
| 332 | t.putStr("sqrt", func(r *Runtime) Value { return r.methodProp(r.math_sqrt, "sqrt", 1) }) |
| 333 | t.putStr("tan", func(r *Runtime) Value { return r.methodProp(r.math_tan, "tan", 1) }) |
| 334 | t.putStr("tanh", func(r *Runtime) Value { return r.methodProp(r.math_tanh, "tanh", 1) }) |
| 335 | t.putStr("trunc", func(r *Runtime) Value { return r.methodProp(r.math_trunc, "trunc", 1) }) |
| 336 | |
| 337 | return t |
| 338 | } |
| 339 | |
| 340 | var mathTemplate *objectTemplate |
| 341 | var mathTemplateOnce sync.Once |
no test coverage detected
searching dependent graphs…