SourceImpl toSourceNotInterned() { assert !cached; return new SourceImpl(this, this); }
@Override public ByteSequence getBytes() { if (hasBytes()) { return (ByteSequence) key.content; } else { throw new UnsupportedOperationException(); } }
@Override public CharSequence getCharacters() { if (hasCharacters()) { return (CharSequence) key.content; } else { throw new UnsupportedOperationException(); } }
holder.code = content; SourceImpl ret = new SourceImpl(holder, type, language, uri, name, internal, interactive); if (ret.getName() == null) { throw raise(RuntimeException.class, new MissingNameException());
@Override public boolean equals(Object obj) { SourceAccessor.neverPartOfCompilation("do not call Source.equals from compiled code"); if (obj instanceof Source) { Source other = (Source) obj; return content().equals(other.content()) && equalAttributes(other); } return false; }
WeakSourceRef(SourceImpl referent, ReferenceQueue<SourceImpl> q) { super(referent, q); this.key = referent.toKey(); }
@Override public int hashCode() { return content().hashCode(); }
@Override Source copy() { return new SourceImpl(key, sourceId); }
SourceImpl toSourceInterned() { assert cached; return new SourceImpl(this); }
/** * Creates a {@linkplain Source Source instance} that represents the contents of a sub-range of * an <code>this</code> {@link Source}. * * @param baseCharIndex 0-based index of the first character of the sub-range * @param length the number of characters in the sub-range * @return a new instance representing a sub-range of another Source * @throws IllegalArgumentException if the specified sub-range is not contained in the base * @since 0.15 */ public Source subSource(int baseCharIndex, int length) { SourceAccessor.neverPartOfCompilation(NO_FASTPATH_SUBSOURCE_CREATION_MESSAGE); final SubSourceImpl subSource = SubSourceImpl.create(this, baseCharIndex, length); return new SourceImpl(subSource); }