MCPcopy
hub / github.com/google/mangle / Constant

Struct Constant

ast/ast.go:257–280  ·  view source on GitHub ↗

Constant represents a constant symbol and other structures (e.g. pair, list map, struct).

Source from the content-addressed store, hash-verified

255
256// Constant represents a constant symbol and other structures (e.g. pair, list map, struct).
257type Constant struct {
258 // The (runtime) type of this constant.
259 Type ConstantType
260
261 // If Type \in {StringType, BytesType}, the data itself.
262 // Otherwise, a string representation.
263 Symbol string
264
265 // For NumberType, the number value (int64 or the bytes of a float64).
266 // For other types it contains a hash code of the value.
267 NumValue int64
268
269 // For a pair constant, the first component.
270 // For a list constant, the head of the list.
271 // For a map constant, the first map entry.
272 // For a struct constant, the first field.
273 fst *Constant
274
275 // For a pair constant, the second component
276 // For a list constant, the tail of the list.
277 // For a map constant, the tail of the entries.
278 // For a struct constant, the tail of the fields.
279 snd *Constant
280}
281
282// Name constructs a new name constant while checking that constant symbol starts with a '/' and
283// does not contain empty parts.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected