static private IsSimpleExecutableKeywordStmt ( LNode _n, Pedantics p ) : bool | ||
_n | LNode | |
p | Pedantics | |
return | bool |
public SPResult AutoPrintSimpleStmt(Ambiguity flags) { // S.Break, S.Continue, S.Goto, S.GotoCase, S.Return, S.Throw, S.Import if (!EcsValidators.IsSimpleExecutableKeywordStmt(_n, Pedantics)) { return(SPResult.Fail); } var name = _n.Name; LNode usingStatic = name == S.Import && _n.AttrCount > 0 && _n.Attrs.Last.IsIdNamed(S.Static) ? _n.Attrs.Last : null; var allowAttrs = (name == S.Import ? AttrStyle.AllowKeywordAttrs : AttrStyle.AllowWordAttrs); G.Verify(0 == PrintAttrs(StartStmt, allowAttrs, flags, usingStatic)); if (name == S.GotoCase) { _out.Write("goto case", true); if (_n.ArgCount == 1 && _n.Args[0].IsIdNamed(S.Default)) { _out.Write("default", true); return(SPResult.NeedSemicolon); } } else if (name == S.Import) { _out.Write(usingStatic != null ? "using static" : "using", true); } else { WriteOperatorName(name); } int i = 0; foreach (var arg in _n.Args) { if (i++ == 0) { Space(SpaceOpt.Default); } else { WriteThenSpace(',', SpaceOpt.AfterComma); } PrintExpr(arg, StartExpr); } return(SPResult.NeedSemicolon); }
public SPResult AutoPrintSimpleStmt() { // S.Break, S.Continue, S.Goto, S.GotoCase, S.Return, S.Throw, S.Import if (!EcsValidators.IsSimpleExecutableKeywordStmt(_n, Pedantics)) { return(SPResult.Fail); } LNode usingStatic = _name == S.Import && _n.AttrCount > 0 && _n.Attrs.Last.IsIdNamed(S.Static) ? _n.Attrs.Last : null; var allowAttrs = (_name == S.Import ? AttrStyle.AllowKeywordAttrs : AttrStyle.AllowWordAttrs); G.Verify(0 == PrintAttrs(allowAttrs, usingStatic)); PrintReturnThrowEtc(usingStatic != null ? _using_static : _name, _n.Args[0, null]); return(SPResult.NeedSemicolon); }