AsConstantValue returns the value as a constant numerical value, with the proper sign as given by expr.negative.
()
| 232 | // AsConstantValue returns the value as a constant numerical value, with the proper sign |
| 233 | // as given by expr.negative. |
| 234 | func (expr *NumVal) AsConstantValue() constant.Value { |
| 235 | v := expr.value |
| 236 | if expr.negative { |
| 237 | v = constant.UnaryOp(token.SUB, v, 0) |
| 238 | } |
| 239 | return v |
| 240 | } |
| 241 | |
| 242 | // AsConstantInt returns the value as an constant.Int if possible, along |
| 243 | // with a flag indicating whether the conversion was possible. |
no outgoing calls
no test coverage detected