Skip to content

Commit bae3c79

Browse files
committed
Adopt YARP's latest changes
1 parent b0c8bf2 commit bae3c79

File tree

4 files changed

+10
-26
lines changed

4 files changed

+10
-26
lines changed

mx.truffleruby/mx_truffleruby.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -131,20 +131,6 @@ def __init__(self, suite, name, deps, workingSets, output=None, **kwArgs):
131131
results=kwArgs.pop('results'),
132132
output=path, d=path, vpath=False, **kwArgs)
133133

134-
def getBuildTask(self, args):
135-
return YARPNativeBuildTask(args, self)
136-
137-
class YARPNativeBuildTask(mx.NativeBuildTask):
138-
def build(self):
139-
mx.run(['./configure'], cwd=self.subject.dir)
140-
super(YARPNativeBuildTask, self).build() # make
141-
142-
def clean(self, forBuild=False):
143-
if exists(join(self.subject.dir, 'Makefile')):
144-
super(YARPNativeBuildTask, self).clean(forBuild=forBuild)
145-
else:
146-
pass
147-
148134
# Commands
149135

150136
def jt(*args):

src/main/java/org/truffleruby/debug/TruffleDebugNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ protected Object parse(Object code,
293293

294294
var yarpSource = YARPTranslatorDriver.createYARPSource(source, YARPTranslatorDriver.createRubySource(code));
295295
var parseResult = Loader.load(serialized, yarpSource);
296-
var ast = parseResult.getValue();
296+
var ast = parseResult.value;
297297

298298
return createString(fromJavaStringNode, ast.toString(), Encodings.UTF_8);
299299
}

src/main/java/org/truffleruby/parser/YARPTranslatorDriver.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,7 @@ private String getMethodName(ParserContext parserContext, MaterializedFrame pare
389389
}
390390

391391
public static org.yarp.Nodes.Node parseToYARPAST(RubyContext context, RubyLanguage language, RubySource rubySource,
392-
StaticScope blockScope,
393-
ParserConfiguration configuration, RubyDeferredWarnings rubyWarnings) {
392+
StaticScope blockScope, ParserConfiguration configuration, RubyDeferredWarnings rubyWarnings) {
394393
// LexerSource lexerSource = new LexerSource(rubySource);
395394
// We only need to pass in current scope if we are evaluating as a block (which
396395
// is only done for evals). We need to pass this in so that we can appropriately scope
@@ -410,15 +409,15 @@ public static org.yarp.Nodes.Node parseToYARPAST(RubyContext context, RubyLangua
410409
var parseResult = Loader.load(serializedBytes, yarpSource);
411410

412411
final String filename = rubySource.getSourcePath();
413-
final ParseResult.Error[] errors = parseResult.getErrors();
412+
final ParseResult.Error[] errors = parseResult.errors;
414413

415414
// collect warnings generated by the parser
416-
for (ParseResult.Warning warning : parseResult.getWarnings()) {
417-
Nodes.Location location = warning.getLocation();
415+
for (ParseResult.Warning warning : parseResult.warnings) {
416+
Nodes.Location location = warning.location;
418417
SourceSection section = rubySource.getSource().createSection(location.startOffset, location.length);
419418
int lineNumber = RubySource.getStartLineAdjusted(context, section);
420419

421-
rubyWarnings.warn(filename, lineNumber, warning.getMessage());
420+
rubyWarnings.warn(filename, lineNumber, warning.message);
422421
}
423422

424423
if (errors.length != 0) {
@@ -433,9 +432,9 @@ public static org.yarp.Nodes.Node parseToYARPAST(RubyContext context, RubyLangua
433432
// but it isn't guarantied that the first error is the most specific/relevant to user
434433
ParseResult.Error error = errors[0];
435434

436-
Nodes.Location location = error.getLocation();
435+
Nodes.Location location = error.location;
437436
SourceSection section = rubySource.getSource().createSection(location.startOffset, location.length);
438-
String message = context.fileLine(section) + ": " + error.getMessage();
437+
String message = context.fileLine(section) + ": " + error.message;
439438

440439
if (context != null) {
441440
int lineNumber = RubySource.getStartLineAdjusted(context, section);
@@ -451,7 +450,7 @@ public static org.yarp.Nodes.Node parseToYARPAST(RubyContext context, RubyLangua
451450
}
452451
}
453452

454-
return parseResult.getValue();
453+
return parseResult.value;
455454
// YARP end
456455

457456
// RubyParser parser = new RubyParser(lexerSource, rubyWarnings);

tool/import-yarp.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ pushd $YARP
1010
bundle
1111
bundle exec rake clobber
1212
bundle exec rake templates
13-
bundle exec rake configure
1413
popd
1514

1615
rm -rf src/main/c/yarp
1716
mkdir src/main/c/yarp
1817
cp -R $YARP/{include,src} src/main/c/yarp
19-
cp $YARP/{.gitignore,LICENSE.md,configure,config.h.in,Makefile.in} src/main/c/yarp
18+
cp $YARP/{.gitignore,LICENSE.md,Makefile} src/main/c/yarp
2019

2120
rm -rf src/yarp/java
2221
cp -R $YARP/java src/yarp/java

0 commit comments

Comments
 (0)