code: func (n *EvalWriteDiff) Eval(ctx EvalContext) (interface{}, error) {
  	changes := ctx.Changes()
  	addr := n.Addr.Absolute(ctx.Path())
  	if n.Change == nil || *n.Change == nil {
  		// Caller sets nil to indicate that we need to remove a change from
  		// the set of changes.
  		gen := states.CurrentGen
  		if n.DeposedKey != states.NotDeposed {
  			gen = n.DeposedKey
  		}
  		changes.RemoveResourceInstanceChange(addr, gen)
  		return nil, nil
  	}
  
  	providerSchema := *n.ProviderSchema
  	change := *n.Change
  
  	if change.Addr.String() != addr.String() || change.DeposedKey != n.DeposedKey {
  		// Should never happen, and indicates a bug in the caller.
  		panic("inconsistent address and/or deposed key in EvalWriteDiff")
  	}
  
  	schema, _ := providerSchema.SchemaForResourceAddr(n.Addr.ContainingResource())
  	if schema == nil {
  		// Should be caught during validation, so we don't bother with a pretty error here
  		return nil, fmt.Errorf("provider does not support resource type %q", n.Addr.Resource.Type)
  	}
  
  	csrc, err := change.Encode(schema.ImpliedType())
  	if err != nil {
  		return nil, fmt.Errorf("failed to encode planned changes for %s: %s", addr, err)
  	}
  
  	changes.AppendResourceInstanceChange(csrc)
  	if n.DeposedKey == states.NotDeposed {
  		log.Printf("[TRACE] EvalWriteDiff: recorded %s change for %s", change.Action, addr)
  	} else {
  		log.Printf("[TRACE] EvalWriteDiff: recorded %s change for %s deposed object %s", change.Action, addr, n.DeposedKey)
  	}
  
  	return nil, nil
  }
docs: // TODO: test