File: const.go

package info (click to toggle)
mumax3 3.11.1-1
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid
  • size: 10,668 kB
  • sloc: makefile: 194; ansic: 155; sh: 86; javascript: 16
file content (17 lines) | stat: -rw-r--r-- 385 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package script

import "reflect"

type Const struct {
	value interface{}
	typ   reflect.Type
}

func NewConst(e Expr) *Const {
	return &Const{value: e.Eval(), typ: e.Type()}
}

func (c *Const) Eval() interface{}  { return c.value }
func (c *Const) Type() reflect.Type { return c.typ }
func (c *Const) Child() []Expr      { return nil }
func (c *Const) Fix() Expr          { return c }