Mercurial > hg > truffle
comparison graal/com.oracle.truffle.object/src/com/oracle/truffle/object/DynamicObjectImpl.java @ 21652:5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Mon, 01 Jun 2015 12:55:56 +0200 |
parents | 723142fed324 |
children | c76742cc2c6f |
comparison
equal
deleted
inserted
replaced
21651:f4cd6b1c2efc | 21652:5f3dda39d205 |
---|---|
207 @TruffleBoundary | 207 @TruffleBoundary |
208 public boolean changeFlags(Object id, FlagsFunction updateFunction) { | 208 public boolean changeFlags(Object id, FlagsFunction updateFunction) { |
209 Shape oldShape = getShape(); | 209 Shape oldShape = getShape(); |
210 Property existing = oldShape.getProperty(id); | 210 Property existing = oldShape.getProperty(id); |
211 if (existing != null) { | 211 if (existing != null) { |
212 Integer newFlags = updateFunction.apply(existing.getFlags()); | 212 int newFlags = updateFunction.apply(existing.getFlags()); |
213 if (newFlags != null && existing.getFlags() != newFlags.intValue()) { | 213 if (existing.getFlags() != newFlags) { |
214 Property newProperty = existing.copyWithFlags(newFlags); | 214 Property newProperty = existing.copyWithFlags(newFlags); |
215 Shape newShape = oldShape.replaceProperty(existing, newProperty); | 215 Shape newShape = oldShape.replaceProperty(existing, newProperty); |
216 this.setShape(newShape); | 216 this.setShape(newShape); |
217 } | 217 } |
218 return true; | 218 return true; |