From ee7a5d7a1645f3ead9674f54421ee0f7003dd0ce Mon Sep 17 00:00:00 2001 From: Usta Shrestha Date: Mon, 10 Jan 2022 22:46:23 -0500 Subject: [PATCH] Typos and missing parameter names use in doc comment Test: N/A Bug: N/A Change-Id: I01331365925decef22502da02a23ed4ce610da98 --- context.go | 11 ++++------- module_ctx.go | 29 ++++++++++++----------------- package_ctx.go | 2 +- parser/ast.go | 4 ++-- 4 files changed, 19 insertions(+), 27 deletions(-) diff --git a/context.go b/context.go index 92c5d30..e0442ce 100644 --- a/context.go +++ b/context.go @@ -486,7 +486,7 @@ func (c *Context) RegisterModuleType(name string, factory ModuleFactory) { type SingletonFactory func() Singleton // RegisterSingletonType registers a singleton type that will be invoked to -// generate build actions. Each registered singleton type is instantiated and +// generate build actions. Each registered singleton type is instantiated // and invoked exactly once as part of the generate phase. Each registered // singleton is invoked in registration order. // @@ -1443,14 +1443,11 @@ func (c *Context) prettyPrintGroupVariants(group *moduleGroup) string { func newModule(factory ModuleFactory) *moduleInfo { logicModule, properties := factory() - module := &moduleInfo{ + return &moduleInfo{ logicModule: logicModule, factory: factory, + properties: properties, } - - module.properties = properties - - return module } func processModuleDef(moduleDef *parser.Module, @@ -2171,7 +2168,7 @@ func cycleError(cycle []*moduleInfo) (errs []error) { // additional fields based on the dependencies. It builds a sorted list of modules // such that dependencies of a module always appear first, and populates reverse // dependency links and counts of total dependencies. It also reports errors when -// it encounters dependency cycles. This should called after resolveDependencies, +// it encounters dependency cycles. This should be called after resolveDependencies, // as well as after any mutator pass has called addDependency func (c *Context) updateDependencies() (errs []error) { c.cachedDepsModified = true diff --git a/module_ctx.go b/module_ctx.go index 95061f0..5d2b39b 100644 --- a/module_ctx.go +++ b/module_ctx.go @@ -132,14 +132,14 @@ type EarlyModuleContext interface { // the module was created, but may have been modified by calls to BaseMutatorContext.Rename. ModuleName() string - // ModuleDir returns the path to the directory that contains the defintion of the module. + // ModuleDir returns the path to the directory that contains the definition of the module. ModuleDir() string // ModuleType returns the name of the module type that was used to create the module, as specified in - // RegisterModuleType. + // Context.RegisterModuleType(). ModuleType() string - // BlueprintFile returns the name of the blueprint file that contains the definition of this + // BlueprintsFile returns the name of the blueprint file that contains the definition of this // module. BlueprintsFile() string @@ -227,7 +227,7 @@ type BaseModuleContext interface { // invalidated by future mutators. VisitDepsDepthFirst(visit func(Module)) - // VisitDepsDepthFirst calls pred for each transitive dependency, and if pred returns true calls visit, traversing + // VisitDepsDepthFirstIf calls pred for each transitive dependency, and if pred returns true calls visit, traversing // the dependency tree in depth first order. visit will only be called once for any given module, even if there are // multiple paths through the dependency tree to the module or multiple direct dependencies with different tags. // OtherModuleDependencyTag will return the tag for the first path found to the module. The return value of pred @@ -834,7 +834,7 @@ type BaseMutatorContext interface { type EarlyMutatorContext interface { BaseMutatorContext - // CreateVariations splits a module into mulitple variants, one for each name in the variationNames + // CreateVariations splits a module into multiple variants, one for each name in the variationNames // parameter. It returns a list of new modules in the same order as the variationNames // list. // @@ -885,7 +885,7 @@ type BottomUpMutatorContext interface { // module's dependency list. AddReverseDependency(module Module, tag DependencyTag, name string) - // CreateVariations splits a module into mulitple variants, one for each name in the variationNames + // CreateVariations splits a module into multiple variants, one for each name in the variationNames // parameter. It returns a list of new modules in the same order as the variationNames // list. // @@ -896,16 +896,16 @@ type BottomUpMutatorContext interface { // If a module is split, and then a module depending on the first module is not split // when the Mutator is later called on it, the dependency of the depending module will // automatically be updated to point to the first variant. - CreateVariations(...string) []Module + CreateVariations(variationNames ...string) []Module - // CreateLocationVariations splits a module into mulitple variants, one for each name in the variantNames + // CreateLocalVariations splits a module into multiple variants, one for each name in the variationNames // parameter. It returns a list of new modules in the same order as the variantNames // list. // // Local variations do not affect automatic dependency resolution - dependencies added // to the split module via deps or DynamicDependerModule must exactly match a variant // that contains all the non-local variations. - CreateLocalVariations(...string) []Module + CreateLocalVariations(variationNames ...string) []Module // SetDependencyVariation sets all dangling dependencies on the current module to point to the variation // with given name. This function ignores the default variation set by SetDefaultDependencyVariation. @@ -942,7 +942,7 @@ type BottomUpMutatorContext interface { AddFarVariationDependencies([]Variation, DependencyTag, ...string) []Module // AddInterVariantDependency adds a dependency between two variants of the same module. Variants are always - // ordered in the same orderas they were listed in CreateVariations, and AddInterVariantDependency does not change + // ordered in the same order as they were listed in CreateVariations, and AddInterVariantDependency does not change // that ordering, but it associates a DependencyTag with the dependency and makes it visible to VisitDirectDeps, // WalkDeps, etc. AddInterVariantDependency(tag DependencyTag, from, to Module) @@ -952,7 +952,7 @@ type BottomUpMutatorContext interface { // after the mutator pass is finished. ReplaceDependencies(string) - // ReplaceDependencies replaces all dependencies on the identical variant of the module with the + // ReplaceDependenciesIf replaces all dependencies on the identical variant of the module with the // specified name with the current variant of this module as long as the supplied predicate returns // true. // @@ -1035,13 +1035,8 @@ func (mctx *mutatorContext) SetVariationProvider(module Module, provider Provide panic(fmt.Errorf("module %q is not a newly created variant of %q", module, mctx.module)) } -type pendingAlias struct { - fromVariant variant - target *moduleInfo -} - func (mctx *mutatorContext) createVariations(variationNames []string, local bool) []Module { - ret := []Module{} + var ret []Module modules, errs := mctx.context.createVariations(mctx.module, mctx.name, mctx.defaultVariation, variationNames, local) if len(errs) > 0 { mctx.errs = append(mctx.errs, errs...) diff --git a/package_ctx.go b/package_ctx.go index af78772..1eafdb9 100644 --- a/package_ctx.go +++ b/package_ctx.go @@ -81,7 +81,7 @@ type packageContext struct { ninjaFileDeps []string } -var _ PackageContext = &packageContext{} +var _ PackageContext = (*packageContext)(nil) func (p *packageContext) getScope() *basicScope { return p.scope diff --git a/parser/ast.go b/parser/ast.go index fb7e516..8d8b10e 100644 --- a/parser/ast.go +++ b/parser/ast.go @@ -35,7 +35,7 @@ type Definition interface { } // An Assignment is a variable assignment at the top level of a Blueprints file, scoped to the -// file and and subdirs. +// file and subdirs. type Assignment struct { Name string NamePos scanner.Position @@ -289,7 +289,7 @@ func (x *Map) getPropertyImpl(name string) (Property *Property, found bool, inde return nil, false, -1 } -// GetProperty removes the property with the given name, if it exists. +// RemoveProperty removes the property with the given name, if it exists. func (x *Map) RemoveProperty(propertyName string) (removed bool) { _, found, index := x.getPropertyImpl(propertyName) if found {