code: func (d decl) indexOfReplacementStart(idents []string) int {
  
  	l := len(idents)
  
  	if l == 0 {
  		return -1
  	}
  
  	if l == 1 {
  		first := idents[0]
  		if first == "" || first == paramsIdentifier || first[0] == '$' {
  			// This can not be a Params.x
  			return -1
  		}
  	}
  
  	var lookFurther bool
  	var needsVarExpansion bool
  	for _, ident := range idents {
  		if ident[0] == '$' {
  			lookFurther = true
  			needsVarExpansion = true
  			break
  		} else if ident == paramsIdentifier {
  			lookFurther = true
  			break
  		}
  	}
  
  	if !lookFurther {
  		return -1
  	}
  
  	var resolvedIdents []string
  
  	if !needsVarExpansion {
  		resolvedIdents = idents
  	} else {
  		var ok bool
  		resolvedIdents, ok = d.resolveVariables(idents)
  		if !ok {
  			return -1
  		}
  	}
  
  	var paramFound bool
  	for i, ident := range resolvedIdents {
  		if ident == paramsIdentifier {
  			if i > 0 {
  				container := resolvedIdents[i-1]
  				if reservedContainers[container] {
  					// .Data.Params.someKey
  					return -1
  				}
  			}
  
  			paramFound = true
  			break
  		}
  	}
  
  	if !paramFound {
  		return -1
  	}
  
  	var paramSeen bool
  	idx := -1
  	for i, ident := range idents {
  		if ident == "" || ident[0] == '$' {
  			continue
  		}
  
  		if ident == paramsIdentifier {
  			paramSeen = true
  			idx = -1
  
  		} else {
  			if paramSeen {
  				return i
  			}
  			if idx == -1 {
  				idx = i
  			}
  		}
  	}
  	return idx
  
  }
docs: // indexOfReplacementStart will return the index of where to start doing replacement,
  // -1 if none needed.