//global_stmt: 'global' NAME (',' NAME)* private GlobalStatement ParseGlobalStmt() { Eat(TokenKind.KeywordGlobal); var start = GetStart(); string globalWhiteSpace = _tokenWhiteSpace; List<string> commaWhiteSpace; List<string> namesWhiteSpace; var l = ReadNameList(out commaWhiteSpace, out namesWhiteSpace); var names = l.ToArray(); GlobalStatement ret = new GlobalStatement(names); ret.SetLoc(start, GetEnd()); if (_verbatim) { AddPreceedingWhiteSpace(ret, globalWhiteSpace); AddListWhiteSpace(ret, commaWhiteSpace.ToArray()); AddNamesWhiteSpace(ret, namesWhiteSpace.ToArray()); } return ret; }
// GlobalStatement public override bool Walk(GlobalStatement node) { return ShouldWalkWorker(node); }
public override bool Walk(GlobalStatement node) { foreach (var name in node.Names) { if (name.Name != null) { // set the variable in the local scope to be the real variable in the global scope _scope.AddVariable(name.Name, _scope.GlobalScope.CreateVariable(node, _curUnit, name.Name, false)); } } return false; }
public override void PostWalk(GlobalStatement node) { PostWalkWorker(node); }