[stringtemplate-interest] ASTExpr.getObjectProperty: should a null propertyName check for a default value if the object is a Map?

Johannes Luber jaluber at gmx.de
Wed Mar 4 00:20:42 PST 2009


Sam Harwell schrieb:
> If I have the following map in my StringTemplate:
> 
> csharpVisibilityMap ::= [
>         "private":"private",
>         "protected":"protected",
>         "public":"public",
>         "fragment":"private",
>         default:"private"
> ]
> 
> And ruleDescriptor is an instance of the Rule class, whose string member
> modifier is null, should “private” be output, or an empty string? It
> seems like the default value in the map, if present, should be used. The
> relevant code is the check for a null propertyName inside
> ASTExpr.getObjectProperty without then checking if the parameter o is a Map.
> 
> lexerRule(ruleName,nakedBlock,ruleDescriptor,block,memoize) ::= <<
> ...
> <csharpVisibilityMap.(ruleDescriptor.modifier)> ...
>>> 
> 
> Thanks,
> Sam Harwell

I'm in favor of doing so - less tighter access rights should be
explicitly set. But why using this list? That's an ANTLR-dev issue and
not a problem with using ST.

Johannes


More information about the stringtemplate-interest mailing list