1 /* |
1 /* |
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
239 |
239 |
240 public void addScopeListener(ScopeListener sl) { |
240 public void addScopeListener(ScopeListener sl) { |
241 listeners = listeners.prepend(sl); |
241 listeners = listeners.prepend(sl); |
242 } |
242 } |
243 |
243 |
244 /** Remove symbol from this scope. Used when an inner class |
244 /** Remove symbol from this scope. |
245 * attribute tells us that the class isn't a package member. |
245 */ |
246 */ |
246 public void remove(final Symbol sym) { |
247 public void remove(Symbol sym) { |
|
248 Assert.check(shared == 0); |
247 Assert.check(shared == 0); |
249 Entry e = lookup(sym.name); |
248 Entry e = lookup(sym.name, new Filter<Symbol>() { |
|
249 @Override |
|
250 public boolean accepts(Symbol candidate) { |
|
251 return candidate == sym; |
|
252 } |
|
253 }); |
250 if (e.scope == null) return; |
254 if (e.scope == null) return; |
251 |
255 |
252 // remove e from table and shadowed list; |
256 // remove e from table and shadowed list; |
253 int i = getIndex(sym.name); |
257 int i = getIndex(sym.name); |
254 Entry te = table[i]; |
258 Entry te = table[i]; |