public virtual void Visit(StructMemberInitializer init) { if (init.Value != null) { init.Value.Accept(this); } }
public virtual void Visit(StructMemberInitializer init) { if (init.Value != null) init.Value.Accept(this); }
public void Visit(StructMemberInitializer structMemberInitializer) { }
public AbstractType Visit(StructMemberInitializer structMemberInitializer) { //TODO return(null); }
public void Visit(StructMemberInitializer structMemberInitializer) { }
IExpression NonVoidInitializer(IBlockNode Scope = null) { // ArrayInitializers are handled in PrimaryExpression(), whereas setting IsParsingInitializer to true is required! #region StructInitializer if (laKind == OpenCurlyBrace && IsStructInitializer) { // StructMemberInitializations var ae = new StructInitializer() { Location = la.Location }; var inits = new List<StructMemberInitializer>(); bool IsInit = true; while (IsInit || laKind == (Comma)) { Step(); IsInit = false; // Allow empty post-comma expression IF the following token finishes the initializer expression // int[] a={1,2,3,4,}; if (laKind == CloseCurlyBrace) break; // Identifier : NonVoidInitializer var sinit = new StructMemberInitializer { Location = la.Location }; if (laKind == Identifier && Lexer.CurrentPeekToken.Kind == Colon) { Step(); sinit.MemberName = t.Value; Step(); } sinit.Value = NonVoidInitializer(Scope); sinit.EndLocation = t.EndLocation; inits.Add(sinit); } Expect(DTokens.CloseCurlyBrace); ae.MemberInitializers = inits.ToArray(); ae.EndLocation = t.EndLocation; return ae; } #endregion #region ArrayLiteral | AssocArrayLiteral if (laKind == OpenSquareBracket && IsArrayInitializer) return ArrayLiteral(Scope, false); #endregion return AssignExpression(Scope); }
IExpression NonVoidInitializer(IBlockNode Scope = null) { var isParsingInitializer_backup = TrackerVariables.IsParsingInitializer; TrackerVariables.IsParsingInitializer = true; // ArrayInitializers are handled in PrimaryExpression(), whereas setting IsParsingInitializer to true is required! #region StructInitializer if (laKind == OpenCurlyBrace) { // StructMemberInitializations var ae = new StructInitializer() { Location = la.Location }; LastParsedObject = ae; var inits = new List<StructMemberInitializer>(); bool IsInit = true; while (IsInit || laKind == (Comma)) { Step(); IsInit = false; // Allow empty post-comma expression IF the following token finishes the initializer expression // int[] a={1,2,3,4,}; if (laKind == CloseCurlyBrace) break; // Identifier : NonVoidInitializer var sinit = new StructMemberInitializer(); LastParsedObject = sinit; if (laKind == Identifier && Lexer.CurrentPeekToken.Kind == Colon) { Step(); sinit.MemberName = t.Value; Step(); } sinit.Value = NonVoidInitializer(Scope); inits.Add(sinit); } ae.MemberInitializers = inits.ToArray(); Expect(CloseCurlyBrace); ae.EndLocation = t.EndLocation; if (!IsEOF) TrackerVariables.IsParsingInitializer = isParsingInitializer_backup; return ae; } #endregion var expr= AssignExpression(Scope); if (!IsEOF) TrackerVariables.IsParsingInitializer = isParsingInitializer_backup; return expr; }
public ISymbolValue Visit(StructMemberInitializer structMemberInitializer) { //TODO return(null); }
public ISymbolValue Visit(StructMemberInitializer structMemberInitializer) { //TODO return null; }
IExpression NonVoidInitializer(IBlockNode Scope = null) { TrackerVariables.IsParsingInitializer = true; #region ArrayInitializer if (laKind == OpenSquareBracket) { Step(); // ArrayMemberInitializations var ae = new ArrayInitializer() { Location=t.Location}; LastParsedObject = ae; var inits=new List<ArrayMemberInitializer>(); bool IsInit = true; while (IsInit || laKind == (Comma)) { if (!IsInit) Step(); IsInit = false; // Allow empty post-comma expression IF the following token finishes the initializer expression // int[] a=[1,2,3,4,]; if (laKind == CloseSquareBracket) break; // ArrayMemberInitialization var ami = new ArrayMemberInitializer() { Left = NonVoidInitializer(Scope) }; LastParsedObject = ami; bool HasBeenAssExpr = !(t.Kind == (CloseSquareBracket) || t.Kind == (CloseCurlyBrace)); // AssignExpression : NonVoidInitializer if (HasBeenAssExpr && laKind == (Colon)) { Step(); ami.Specialization = NonVoidInitializer(Scope); } inits.Add(ami); } ae.ArrayMemberInitializations = inits.ToArray(); Expect(CloseSquareBracket); ae.EndLocation = t.EndLocation; // auto i=[1,2,3].idup; // in this case, this entire thing is meant to be an AssignExpression but not a dedicated initializer.. if (laKind == Dot) { Step(); var ae2 = new PostfixExpression_Access(); LastParsedObject = ae2; ae2.PostfixForeExpression = ae; ae2.TemplateOrIdentifier = Type(); //TODO: Is it really a type!? ae2.EndLocation = t.EndLocation; if (!IsEOF) TrackerVariables.IsParsingInitializer = false; return ae2; } if (!IsEOF) TrackerVariables.IsParsingInitializer = false; return ae; } #endregion // StructInitializer if (laKind == OpenCurlyBrace) { // StructMemberInitializations var ae = new StructInitializer() { Location = la.Location }; LastParsedObject = ae; var inits = new List<StructMemberInitializer>(); bool IsInit = true; while (IsInit || laKind == (Comma)) { Step(); IsInit = false; // Allow empty post-comma expression IF the following token finishes the initializer expression // int[] a=[1,2,3,4,]; if (laKind == CloseCurlyBrace) break; // Identifier : NonVoidInitializer var sinit = new StructMemberInitializer(); LastParsedObject = sinit; if (laKind == Identifier && Lexer.CurrentPeekToken.Kind == Colon) { Step(); sinit.MemberName = t.Value; Step(); } sinit.Specialization = NonVoidInitializer(Scope); inits.Add(sinit); } ae.StructMemberInitializers = inits.ToArray(); Expect(CloseCurlyBrace); ae.EndLocation = t.EndLocation; if (!IsEOF) TrackerVariables.IsParsingInitializer = false; return ae; } else { var expr= AssignExpression(Scope); if (!IsEOF) TrackerVariables.IsParsingInitializer = false; return expr; } }