Move variable assignment handling to generation context
This allows the parsing code to be cleaner, as it doesn't have to care about variable assignments. Bug: 228518745 Test: go test Change-Id: I33425c2fb51acab4901bfa82a53d337b75210f8e
This commit is contained in:
@@ -232,19 +232,18 @@ func (xi *interpolateExpr) transform(transformer func(expr starlarkExpr) starlar
|
||||
}
|
||||
|
||||
type variableRefExpr struct {
|
||||
ref variable
|
||||
isDefined bool
|
||||
ref variable
|
||||
}
|
||||
|
||||
func NewVariableRefExpr(ref variable, isDefined bool) starlarkExpr {
|
||||
func NewVariableRefExpr(ref variable) starlarkExpr {
|
||||
if predefined, ok := ref.(*predefinedVariable); ok {
|
||||
return predefined.value
|
||||
}
|
||||
return &variableRefExpr{ref, isDefined}
|
||||
return &variableRefExpr{ref}
|
||||
}
|
||||
|
||||
func (v *variableRefExpr) emit(gctx *generationContext) {
|
||||
v.ref.emitGet(gctx, v.isDefined)
|
||||
v.ref.emitGet(gctx)
|
||||
}
|
||||
|
||||
func (v *variableRefExpr) typ() starlarkType {
|
||||
|
Reference in New Issue
Block a user