Perform constant evaluation during constant declaration analysis
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package analyzer
|
||||
|
||||
import "fmt"
|
||||
import "git.tebibyte.media/fspl/fspl/eval"
|
||||
import "git.tebibyte.media/fspl/fspl/errors"
|
||||
import "git.tebibyte.media/fspl/fspl/entity"
|
||||
|
||||
@@ -101,11 +102,8 @@ func (this *Tree) analyzeConstantDeclaration (
|
||||
value, err := this.analyzeExpression(into, strict, constant.Value)
|
||||
if err != nil { return nil, err }
|
||||
|
||||
// TODO once constant expression evaluation is implemented, do
|
||||
// that here
|
||||
|
||||
// only allow values that can be used as constants
|
||||
err = this.isConstant(value)
|
||||
// evaluate constant expression to literal value
|
||||
value, err = eval.EvaluateConstant(value)
|
||||
if err != nil { return nil, err }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user