Exemple #1
0
        public void AddSymbol(LocalSymbol symbol) {
            Debug.Assert(symbol != null);
            Debug.Assert(String.IsNullOrEmpty(symbol.Name) == false);
            Debug.Assert(_localTable.ContainsKey(symbol.Name) == false);

            _locals.Add(symbol);
            _localTable[symbol.Name] = symbol;
        }
        private string TransformLocal(LocalSymbol localSymbol) {
            int depth = 0;

            AnonymousMethodSymbol parentMethod = localSymbol.Parent as AnonymousMethodSymbol;
            if (parentMethod != null) {
                // If an anonymous method contains a local variable with the
                // same name as a variable in the containing method, they will
                // conflict at runtime, i.e. the value in the inner method
                // will override the value of the outer method when it is run.
                // Note that right now we aren't seeing if there is actually a conflict.
                // We're always qualifying the inner variable with a depth prefix.
                // REVIEW: Should we try to optimize when we qualify?

                depth = parentMethod.Depth;
            }

            string transformedName = GenerateName(_count, depth);
            _count++;

            return transformedName;
        }
 void ILocalSymbolTable.AddSymbol(LocalSymbol symbol)
 {
     Debug.Assert(_currentScope != null);
     _currentScope.AddSymbol(symbol);
 }
 public LocalExpression(LocalSymbol symbol, SymbolFilter memberMask)
     : base(ExpressionType.Local, symbol.ValueType, memberMask)
 {
     _symbol = symbol;
 }
 public LocalExpression(LocalSymbol symbol)
     : this(symbol, SymbolFilter.Public | SymbolFilter.InstanceMembers)
 {
     _symbol = symbol;
 }
Exemple #6
0
 public LocalExpression(LocalSymbol symbol, SymbolFilter memberMask)
     : base(ExpressionType.Local, symbol.ValueType, memberMask)
 {
     _symbol = symbol;
 }
Exemple #7
0
 public LocalExpression(LocalSymbol symbol)
     : this(symbol, SymbolFilter.Public | SymbolFilter.InstanceMembers)
 {
     _symbol = symbol;
 }