Construct placement directly across the facade
This commit is contained in:
@@ -38,7 +38,7 @@ type importDeclarationSpec struct {
|
||||
depth int
|
||||
depthSet bool
|
||||
destination Path
|
||||
placement placementMode
|
||||
placement PlacementMode
|
||||
fieldSites map[string]importFieldSite
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ type resolvedImportPolicy struct {
|
||||
depthSet bool
|
||||
exclude []string
|
||||
destination Path
|
||||
placement placementMode
|
||||
placement PlacementMode
|
||||
}
|
||||
|
||||
func snapshotImportDefaults(value ImportDefaults) ImportDefaults {
|
||||
@@ -173,7 +173,7 @@ func parseImportDeclarationSpec(node *document.Node, declarationPath Path) (impo
|
||||
spec := importDeclarationSpec{
|
||||
path: declarationPath.clone(),
|
||||
location: publicLocation(node.Location),
|
||||
placement: placementModeMapping,
|
||||
placement: PlacementModeMapping,
|
||||
fieldSites: make(map[string]importFieldSite, len(node.Mapping)),
|
||||
}
|
||||
selectors := 0
|
||||
@@ -281,19 +281,19 @@ func parseImportWildcardAssignment(spec *importDeclarationSpec, field string, no
|
||||
return nil
|
||||
}
|
||||
|
||||
func parseImportPlacement(node *document.Node, fieldPath Path) (placementMode, *Diagnostic) {
|
||||
func parseImportPlacement(node *document.Node, fieldPath Path) (PlacementMode, *Diagnostic) {
|
||||
if node.Kind != document.String {
|
||||
diagnostic := nodeImportDiagnostic(CodeImportInvalid, fieldPath, "placement must be mapping or sequence-item", node)
|
||||
return placementModeMapping, &diagnostic
|
||||
return PlacementModeMapping, &diagnostic
|
||||
}
|
||||
switch node.Text {
|
||||
case "mapping":
|
||||
return placementModeMapping, nil
|
||||
return PlacementModeMapping, nil
|
||||
case "sequence-item":
|
||||
return placementModeSequenceItem, nil
|
||||
return PlacementModeSequenceItem, nil
|
||||
default:
|
||||
diagnostic := nodeImportDiagnostic(CodeImportInvalid, fieldPath, "placement must be mapping or sequence-item", node)
|
||||
return placementModeMapping, &diagnostic
|
||||
return PlacementModeMapping, &diagnostic
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user