File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
compiler/src/dotty/tools/dotc/core/classfile Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ object ClassfileParser {
50
50
mapOver(tp)
51
51
}
52
52
}
53
+
54
+ def withReader [T ](classfile : AbstractFile )(op : DataReader ?=> T )(using Context ): T =
55
+ ctx.base.reusableDataReader.using { reader =>
56
+ op(using reader.reset(classfile))
57
+ }
53
58
}
54
59
55
60
class ClassfileParser (
@@ -81,9 +86,7 @@ class ClassfileParser(
81
86
private def mismatchError (className : SimpleName ) =
82
87
throw new IOException (s " class file ' ${classfile.canonicalPath}' has location not matching its contents: contains class $className" )
83
88
84
- def run ()(using Context ): Option [Embedded ] = try ctx.base.reusableDataReader.using { reader =>
85
- implicit val in : DataReader = reader.reset(classfile)
86
-
89
+ def run ()(using Context ): Option [Embedded ] = try withReader(classfile) { (using in) =>
87
90
report.debuglog(" [class] >> " + classRoot.fullName)
88
91
parseHeader()
89
92
this .pool = new ConstantPool
@@ -238,9 +241,7 @@ class ClassfileParser(
238
241
239
242
val memberCompleter : LazyType = new LazyType {
240
243
241
- def complete (denot : SymDenotation )(using Context ): Unit = ctx.base.reusableDataReader.using { reader =>
242
- implicit val in : DataReader = reader.reset(classfile)
243
-
244
+ def complete (denot : SymDenotation )(using Context ): Unit = withReader(classfile) { (using in) =>
244
245
in.bp = denot.symbol.coord.toIndex
245
246
val sym = denot.symbol
246
247
val jflags = in.nextChar
You can’t perform that action at this time.
0 commit comments