Skip to content

Commit 8a4c034

Browse files
cleanup: Fix some source locations + remove debug print statements.
1 parent f499313 commit 8a4c034

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

rewriter/Command.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ void Command::run(core::MutableContext ctx, ast::ClassDef *klass) {
8484
ast::MethodDef::Flags flags;
8585
flags.isSelfMethod = true;
8686
flags.discardDef = true;
87-
auto selfCall = ast::MK::SyntheticMethod(call->loc, call->loc, call->loc, call->name, std::move(newArgs),
88-
ast::MK::UntypedNil(call->loc), flags);
87+
auto selfCall = ast::MK::SyntheticMethod(call->loc, call->loc, core::LocOffsets::none(), call->name,
88+
std::move(newArgs), ast::MK::UntypedNil(call->loc), flags);
8989

9090
klass->rhs.insert(klass->rhs.begin() + i + 1, sig->deepCopy());
9191
klass->rhs.insert(klass->rhs.begin() + i + 2, std::move(selfCall));

rewriter/DSLBuilder.cc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ vector<ast::ExpressionPtr> DSLBuilder::run(core::MutableContext ctx, ast::Send *
5353
ENFORCE(!ctx.locAt(sym->loc).source(ctx).value().empty() && ctx.locAt(sym->loc).source(ctx).value()[0] == ':');
5454
auto nameLoc = core::LocOffsets{sym->loc.beginPos() + 1, sym->loc.endPos()};
5555

56-
fmt::print(stderr, "log: [DSLBuilder::run] name = {} @ {}\n", name.toString(ctx), ctx.locAt(nameLoc).showRaw(ctx));
57-
5856
type = ASTUtil::dupType(send->getPosArg(1));
5957
if (!type) {
6058
return empty;
@@ -108,16 +106,15 @@ vector<ast::ExpressionPtr> DSLBuilder::run(core::MutableContext ctx, ast::Send *
108106
// def self.get_<prop>
109107
core::NameRef getName = ctx.state.enterNameUTF8("get_" + name.show(ctx));
110108
stats.emplace_back(ast::MK::Sig0(loc, ASTUtil::dupType(type)));
111-
// TODO(varun): Get proper location here
112109
auto defSelfGetProp =
113-
ast::MK::SyntheticMethod(loc, loc, loc, getName, {}, ast::MK::RaiseUnimplemented(loc), flags);
110+
ast::MK::SyntheticMethod(loc, loc, nameLoc, getName, {}, ast::MK::RaiseUnimplemented(loc), flags);
114111
ast::cast_tree<ast::MethodDef>(defSelfGetProp)->flags.isSelfMethod = true;
115112
stats.emplace_back(move(defSelfGetProp));
116113

117-
// TODO(varun): Get proper location here
118114
// def <prop>()
119115
stats.emplace_back(ast::MK::Sig0(loc, ASTUtil::dupType(type)));
120-
stats.emplace_back(ast::MK::SyntheticMethod(loc, loc, loc, name, {}, ast::MK::RaiseUnimplemented(loc), flags));
116+
stats.emplace_back(
117+
ast::MK::SyntheticMethod(loc, loc, nameLoc, name, {}, ast::MK::RaiseUnimplemented(loc), flags));
121118
}
122119

123120
return stats;

rewriter/Prop.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,6 @@ vector<ast::ExpressionPtr> processProp(core::MutableContext ctx, PropInfo &ret,
353353
const auto name = ret.name;
354354
const auto nameLoc = ret.nameLoc;
355355

356-
fmt::print(stderr, "log: [processProp] name = {} @ {}\n", name.toString(ctx), ctx.locAt(nameLoc).showRaw(ctx));
357-
358356
const auto getType = ASTUtil::dupType(ret.type);
359357

360358
const auto computedByMethodName = ret.computedByMethodName;

0 commit comments

Comments
 (0)