StringValue returns the string value of this constant, if it is of type string.
()
| 437 | |
| 438 | // StringValue returns the string value of this constant, if it is of type string. |
| 439 | func (c Constant) StringValue() (string, error) { |
| 440 | if c.Type != StringType { |
| 441 | return "", fmt.Errorf("not a string constant %v", c) |
| 442 | } |
| 443 | return c.Symbol, nil |
| 444 | } |
| 445 | |
| 446 | // NumberValue returns the number(int64) value of this constant, if it is of type number. |
| 447 | func (c Constant) NumberValue() (int64, error) { |
no outgoing calls