public override void EnterTypeStmt(VBAParser.TypeStmtContext context) { var accessibility = GetMemberAccessibility(context.visibility()); var name = context.ambiguousIdentifier().GetText(); _declarations.Add(CreateDeclaration(name, null, accessibility, DeclarationType.UserDefinedType, context, context.ambiguousIdentifier().GetSelection())); //SetCurrentScope(name); }
// we add initialization Sub for the current Structure public override void ExitTypeStmt([NotNull] VBAParser.TypeStmtContext context) { var currentType = Types.Pop(); if (InitStructures.ContainsKey(currentType) && InitStructures[currentType].Text.Length > 0) { Rewriter.InsertBefore(context.Stop, InitStructures[currentType].Text); StructuresWithInitializer.Add(currentType); } else { InitStructures.Remove(currentType); } }
public override void EnterTypeStmt(VBAParser.TypeStmtContext context) { var accessibility = GetMemberAccessibility(context.visibility()); var identifier = context.identifier(); if (identifier == null) { return; } var name = identifier.GetText(); var declaration = CreateDeclaration(name, null, accessibility, DeclarationType.UserDefinedType, context, context.identifier().GetSelection()); OnNewDeclaration(declaration); _parentDeclaration = declaration; // treat members as child declarations, but keep them scoped to module }
// transform a Type in a Structure public override void EnterTypeStmt(VBAParser.TypeStmtContext context) { var typeName = context.ambiguousIdentifier().GetText(); Types.Push(typeName); InitStructures.Add(typeName, new StructureInitializer(typeName)); Rewriter.Replace(context.TYPE().Symbol, "Structure"); Rewriter.Replace(context.END_TYPE().Symbol, "End Structure"); string visibility = context.visibility().GetText(); foreach (var st in context.typeStmt_Element()) { Rewriter.InsertBefore(st.Start, $"{visibility} "); } }
public override void ExitTypeStmt(VBAParser.TypeStmtContext context) { SetCurrentScope(); }
public override void EnterTypeStmt(VBAParser.TypeStmtContext context) { SetCurrentScope(context.identifier().GetText(), DeclarationType.UserDefinedType); }
public override void ExitTypeStmt(VBAParser.TypeStmtContext context) { _parentDeclaration = _moduleDeclaration; }
public override void EnterTypeStmt(VBAParser.TypeStmtContext context) { _members.Add(new QualifiedContext <ParserRuleContext>(_qualifiedName, context)); }