public override bool Walk(DottedName node) { CommonWalk(node); return true; }
public override void PostWalk(DottedName node) { CommonPostWalk(node); }
// DottedName public bool Walk(DottedName node) { return Process(node); }
// DottedName public override bool Walk(DottedName node) { Reference(node.Names[0]); return true; }
private string FormatDottedName(PyAst.DottedName name, params string[] namesToRemove) { var names = namesToRemove.Any() ? name.Names.Except(namesToRemove).ToList() : name.Names; return(string.Join(".", names)); }
public void PostWalk(DottedName node) { PostProcess(node); }
// DottedName public override bool Walk(DottedName node) { node.Parent = _currentScope; return base.Walk(node); }
public FromImportStatement(DottedName root, IList<SymbolId> names, SymbolId[] asNames) : this(root, names, asNames, false) { }
// DottedName public virtual bool Walk(DottedName node) { return true; }
public virtual void PostWalk(DottedName node) { }
// DottedName public virtual bool Walk(DottedName node) { return false; }
//dotted_name: NAME ('.' NAME)* private DottedName ParseDottedName() { Location start = GetStart(); List<SymbolId> l = new List<SymbolId>(); l.Add(ReadName()); while (MaybeEat(TokenKind.Dot)) { l.Add(ReadName()); } SymbolId[] names = l.ToArray(); DottedName ret = new DottedName(names); ret.SetLoc(GetExternal(), start, GetEnd()); return ret; }
public void Visit(PyAst.DottedName node) => throw CreateNotImplementedEx();
// DottedName public override bool Walk(DottedName node) { node.Parent = _currentScope; return(base.Walk(node)); }
public ImportDefinition(DottedName name, ImportStatement import) { this.name = name; this.importStatement = import; }
public ImportStatement(DottedName[] names, SymbolId[] asNames) { this.names = names; this.asNames = asNames; }
private CodeGen CompileModuleInit(CompilerContext context, GlobalSuite gs, TypeGen tg, string moduleName) { CodeGen init; if (!AutoImportAll) { init = OutputGenerator.GenerateModuleInitialize(context, gs, tg); } else { // auto-import all compiled modules, useful for CodeDom scenarios. init = OutputGenerator.GenerateModuleInitialize(context, gs, tg, staticTypes, delegate(CodeGen cg) { Location dummyLocation = new Location(1, 1); for (int i = 0; i < sourceFiles.Count; i++) { string otherModName = GetModuleFromFilename(sourceFiles[i]); if (otherModName == moduleName) continue; FromImportStatement stmt = new FromImportStatement( new DottedName(new SymbolId[] { SymbolTable.StringToId(otherModName) }), FromImportStatement.Star, null); stmt.Start = dummyLocation; stmt.End = dummyLocation; stmt.Emit(cg); } // Import the first part of all namespaces in all referenced assemblies // First, determine the set of unique such prefixes Dictionary<string, object> nsPrefixes = new Dictionary<string, object>(); foreach (string name in ReferencedAssemblies) { Assembly a = LoadAssembly(name); foreach (Type t in a.GetTypes()) { // We only care about public types if (!t.IsPublic) continue; // Ignore types that don't have a namespace if (t.Namespace == null) continue; string nsPrefix = t.Namespace.Split('.')[0]; nsPrefixes[nsPrefix] = null; } } // Import all the uniquer prefixes we found foreach (string nsPrefix in nsPrefixes.Keys) { SymbolId symbolId = SymbolTable.StringToId(nsPrefix); cg.Names.CreateGlobalSlot(symbolId); DottedName dottedName = new DottedName(new SymbolId[] { symbolId }); ImportStatement importStmt = new ImportStatement( new DottedName[] { dottedName }, new SymbolId[] { SymbolTable.Empty }); importStmt.Start = dummyLocation; importStmt.End = dummyLocation; importStmt.Emit(cg); } }); } return init; }
public FromImportStatement(DottedName root, IList<SymbolId> names, IList<SymbolId> asNames, bool fromFuture) { this.root = root; this.names = names; this.asNames = asNames; this.fromFuture = fromFuture; }
public override bool Walk(DottedName node) { writer.WriteLine("DottedName"); return base.Walk(node); }