View source code
Display the source code in dmd/initsem.d from which thispage was generated on github.
Report a bug
If you spot a problem with this page, click here to create aBugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinglocal clone.

Function dmd.initsem.resolveStructLiteralNamedArgs

Given the names and values of a StructInitializer or CallExp, resolve it to a list of expressions to construct a StructLiteralExp.

dmd.root.array.Array!(dmd.expression.Expression)* resolveStructLiteralNamedArgs(
  StructDeclaration sd,
  Type t,
  dmd.dscope.Scope* sc,
  Loc iloc,
  ulong argCount,
  scope Identifier delegate(ulong) getArgName,
  scope Expression delegate(ulong, Type) getExp,
  scope Loc delegate(ulong) getArgLoc,
  scope Loc delegate(ulong) getNameLoc
);

Parameters

NameDescription
sd struct
t type of struct (potentially including qualifiers such as const or immutable)
sc scope of the expression initializing the struct
iloc location of expression initializing the struct
argCount count of argumnet present
getExp function that, given an index into argNames and destination type, returns the initializing expression
getArgName function that, given an index into argNames, returns the name of argument for error messages
getArgLoc function that, given an index into argNames, returns a location of argument for error messages
getNameLoc function that, given an index into argNames, returns a location of that name for error messages

Returns

list of expressions ordered to the struct's fields, or null on error

Authors

Walter Bright

License

Boost License 1.0