mirror of
https://github.com/google/go-jsonnet.git
synced 2026-05-04 19:46:12 +02:00
Clean up some TODOs
Some were stale, some were transformed into issues, some were fixed
This commit is contained in:
parent
a4058fc177
commit
f0f70419f8
@ -468,8 +468,6 @@ type ObjectField struct {
|
||||
Expr2, Expr3 Node // In scope of the object (can see self).
|
||||
}
|
||||
|
||||
// TODO(jbeda): Add the remaining constructor helpers here
|
||||
|
||||
func ObjectFieldLocalNoMethod(id *Identifier, body Node) ObjectField {
|
||||
return ObjectField{ObjectLocal, ObjectFieldVisible, false, false, nil, nil, id, nil, false, body, nil}
|
||||
}
|
||||
|
||||
@ -25,7 +25,6 @@ import (
|
||||
)
|
||||
|
||||
type ErrorFormatter struct {
|
||||
// TODO(sbarzowski) use this
|
||||
// MaxStackTraceSize is the maximum length of stack trace before cropping
|
||||
MaxStackTraceSize int
|
||||
|
||||
|
||||
8
testdata/insuper2.golden
vendored
8
testdata/insuper2.golden
vendored
@ -1,5 +1,3 @@
|
||||
testdata/insuper2:1:11-13 Expected token OPERATOR but got (in, "in")
|
||||
|
||||
{ } { "x" in super }
|
||||
|
||||
|
||||
{
|
||||
"x": false
|
||||
}
|
||||
|
||||
2
testdata/insuper2.jsonnet
vendored
2
testdata/insuper2.jsonnet
vendored
@ -1 +1 @@
|
||||
{ } { "x" in super }
|
||||
{ } { x: "x" in super }
|
||||
|
||||
10
testdata/missing_super.golden
vendored
Normal file
10
testdata/missing_super.golden
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
RUNTIME ERROR: Attempt to use super when there is no super class.
|
||||
-------------------------------------------------
|
||||
testdata/missing_super:1:6-11 object <anonymous>
|
||||
|
||||
{ x: super.x }
|
||||
|
||||
-------------------------------------------------
|
||||
During manifestation
|
||||
|
||||
|
||||
1
testdata/missing_super.jsonnet
vendored
Normal file
1
testdata/missing_super.jsonnet
vendored
Normal file
@ -0,0 +1 @@
|
||||
{ x: super.x }
|
||||
2
testdata/object_invariant7.golden
vendored
2
testdata/object_invariant7.golden
vendored
@ -1,4 +1,4 @@
|
||||
RUNTIME ERROR: Field does not exist: x
|
||||
RUNTIME ERROR: Attempt to use super when there is no super class.
|
||||
-------------------------------------------------
|
||||
testdata/object_invariant7:1:16-21 object <anonymous>
|
||||
|
||||
|
||||
@ -100,8 +100,6 @@ func (th *callThunk) getValue(i *interpreter, trace *TraceElement) (value, error
|
||||
// the first evaluation.
|
||||
// Note: All potentialValues are required to provide the same value every time,
|
||||
// so it's only there for efficiency.
|
||||
// TODO(sbarzowski) better name?
|
||||
// TODO(sbarzowski) force use cached/ready everywhere? perhaps an interface tag?
|
||||
// TODO(sbarzowski) investigate efficiency of various representations
|
||||
type cachedThunk struct {
|
||||
pv evaluable
|
||||
|
||||
15
value.go
15
value.go
@ -166,13 +166,14 @@ func int64ToValue(i int64) *valueNumber {
|
||||
return makeValueNumber(float64(i))
|
||||
}
|
||||
|
||||
// TODO(dcunnin): Maybe intern values null, true, and false?
|
||||
type valueNull struct {
|
||||
valueBase
|
||||
}
|
||||
|
||||
var nullValue valueNull
|
||||
|
||||
func makeValueNull() *valueNull {
|
||||
return &valueNull{}
|
||||
return &nullValue
|
||||
}
|
||||
|
||||
func (*valueNull) typename() string {
|
||||
@ -274,9 +275,8 @@ func args(xs ...potentialValue) callArguments {
|
||||
// Object is a value that allows indexing (taking a value of a field)
|
||||
// and combining through mixin inheritence (operator +).
|
||||
//
|
||||
// Accessing a field multiple times results in multiple evaluations.
|
||||
// TODO(sbarzowski) This can be very easily avoided and currently innocent looking
|
||||
// code may be in fact exponential.
|
||||
// Note that every time a field is indexed it evaluates it again, there is
|
||||
// no caching of field values. See: https://github.com/google/go-jsonnet/issues/113
|
||||
type valueObject interface {
|
||||
value
|
||||
inheritanceSize() int
|
||||
@ -471,7 +471,6 @@ type unboundField interface {
|
||||
// This represenation allows us to implement "+" in O(1),
|
||||
// but requires going through the tree and trying subsequent leafs for field access.
|
||||
//
|
||||
// TODO(sbarzowski) consider other representations (this representation was chosen to stay close to C++ version)
|
||||
type valueExtendedObject struct {
|
||||
valueObjectBase
|
||||
left, right valueObject
|
||||
@ -515,7 +514,6 @@ func findField(curr value, minSuperDepth int, f string) (*valueSimpleObjectField
|
||||
return &field, curr.upValues, 0
|
||||
}
|
||||
}
|
||||
// TODO(sbarzowski) add handling of "Attempt to use super when there is no super class."
|
||||
return nil, nil, 0
|
||||
default:
|
||||
panic(fmt.Sprintf("Unknown object type %#v", curr))
|
||||
@ -527,6 +525,9 @@ func objectIndex(e *evaluator, sb selfBinding, fieldName string) (value, error)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if sb.superDepth >= sb.self.inheritanceSize() {
|
||||
return nil, e.Error("Attempt to use super when there is no super class.")
|
||||
}
|
||||
objp := tryObjectIndex(sb, fieldName, withHidden)
|
||||
if objp == nil {
|
||||
return nil, e.Error(fmt.Sprintf("Field does not exist: %s", fieldName))
|
||||
|
||||
3
vm.go
3
vm.go
@ -28,8 +28,6 @@ import (
|
||||
// Note: There are no garbage collection params because we're using the native
|
||||
// Go garbage collector.
|
||||
|
||||
// TODO(sbarzowski) prepare API that maps 1-1 to libjsonnet api
|
||||
|
||||
// VM is the core interpreter and is the touchpoint used to parse and execute
|
||||
// Jsonnet.
|
||||
type VM struct {
|
||||
@ -40,7 +38,6 @@ type VM struct {
|
||||
ef ErrorFormatter
|
||||
}
|
||||
|
||||
// TODO(sbarzowski) actually support these
|
||||
// External variable (or code) provided before execution
|
||||
type vmExt struct {
|
||||
value string // what is it?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user