Skip to content

Commit 6d63a66

Browse files
author
David Ungar
committed
---
yaml --- r: 314343 b: refs/heads/master c: b380764 h: refs/heads/master i: 314341: 863bab3 314339: 99cfcfd 314335: e83c21c
1 parent 9c82e1a commit 6d63a66

File tree

9 files changed

+31
-28
lines changed

9 files changed

+31
-28
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 1011998a97523328cbcec33d47b893819aad560c
2+
refs/heads/master: b38076490b5402178d1b07faa13bc8fbefb74563
33
refs/heads/master-next: 66a7e661ff8e88e2d4efab3e430197a7a941e352
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/include/swift/AST/Decl.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,8 +1908,9 @@ class PatternBindingEntry {
19081908
// initializer is ASTContext-allocated it is safe.
19091909

19101910
/// Exactly the expr the programmer wrote
1911-
Expr *origInit;
1912-
/// Might be transformed, e.g. for a property wrapper
1911+
Expr *originalInit;
1912+
/// Might be transformed, e.g. for a property wrapper. In the absence of
1913+
/// transformation or synthesis, holds the expr as parsed.
19131914
Expr *initAfterSynthesis;
19141915
/// The location of the equal '=' token.
19151916
SourceLoc EqualLoc;
@@ -1932,6 +1933,7 @@ class PatternBindingEntry {
19321933
friend class PatternBindingInitializer;
19331934

19341935
public:
1936+
/// \p E is the initializer as parsed.
19351937
PatternBindingEntry(Pattern *P, SourceLoc EqualLoc, Expr *E,
19361938
DeclContext *InitContext)
19371939
: PatternAndFlags(P, {}), InitExpr({E, E, EqualLoc}),
@@ -1955,7 +1957,7 @@ class PatternBindingEntry {
19551957
Expr *getExecutableInit() const {
19561958
return isInitializerSubsumed() ? nullptr : getInit();
19571959
}
1958-
SourceRange getOrigInitRange() const;
1960+
SourceRange getOriginalInitRange() const;
19591961
void setInit(Expr *E);
19601962

19611963
/// Gets the text of the initializer expression, stripping out inactive
@@ -1987,10 +1989,10 @@ class PatternBindingEntry {
19871989

19881990
/// Retrieve the initializer after the =, if any, as it was written in the
19891991
/// source.
1990-
Expr *getOrigInit() const;
1991-
1992+
Expr *getOriginalInit() const;
1993+
19921994
/// Set the initializer after the = as it was written in the source.
1993-
void setOrigInit(Expr*);
1995+
void setOriginalInit(Expr *);
19941996

19951997
bool isInitializerChecked() const {
19961998
return PatternAndFlags.getInt().contains(Flags::Checked);
@@ -2120,9 +2122,9 @@ class PatternBindingDecl final : public Decl,
21202122
Expr *getExecutableInit(unsigned i) const {
21212123
return getPatternList()[i].getExecutableInit();
21222124
}
2123-
2124-
SourceRange getOrigInitRange(unsigned i) const {
2125-
return getPatternList()[i].getOrigInitRange();
2125+
2126+
SourceRange getOriginalInitRange(unsigned i) const {
2127+
return getPatternList()[i].getOriginalInitRange();
21262128
}
21272129

21282130
void setInit(unsigned i, Expr *E) {

trunk/include/swift/AST/PropertyWrappers.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ void simple_display(
183183

184184
/// Given the initializer for the given property with an attached property
185185
/// wrapper, dig out the original initialization expression.
186-
/// Cannot just dig out the getOrigInit() value because this function checks
186+
///
187+
/// Cannot just dig out the getOriginalInit() value because this function checks
187188
/// types, etc. Erroneous code won't return a result from here.
188189
Expr *findOriginalPropertyWrapperInitialValue(VarDecl *var, Expr *init);
189190

trunk/lib/AST/ASTDumper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,11 +906,11 @@ namespace {
906906
for (auto entry : PBD->getPatternList()) {
907907
OS << '\n';
908908
printRec(entry.getPattern());
909-
if (entry.getOrigInit()) {
909+
if (entry.getOriginalInit()) {
910910
OS << '\n';
911911
OS.indent(Indent + 2);
912912
OS << "Original init:\n";
913-
printRec(entry.getOrigInit());
913+
printRec(entry.getOriginalInit());
914914
}
915915
if (entry.getInit()) {
916916
OS << '\n';

trunk/lib/AST/ASTScopeCreation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,8 @@ ASTScopeImpl *PatternEntryDeclScope::expandAScopeThatCreatesANewInsertionPoint(
629629
// initializer (because of InterpolatedLiteralStrings and EditorPlaceHolders),
630630
// so compute it ourselves.
631631
SourceLoc initializerEnd;
632-
if (patternEntry.getOrigInit() &&
633-
patternEntry.getOrigInit()->getSourceRange().isValid()) {
632+
if (patternEntry.getOriginalInit() &&
633+
patternEntry.getOriginalInit()->getSourceRange().isValid()) {
634634
auto *initializer =
635635
scopeCreator.createSubtree<PatternEntryInitializerScope>(
636636
this, decl, patternEntryIndex, vis);
@@ -649,8 +649,8 @@ ASTScopeImpl *
649649
PatternEntryInitializerScope::expandAScopeThatCreatesANewInsertionPoint(
650650
ScopeCreator &scopeCreator) {
651651
// Create a child for the initializer expression.
652-
ASTVisitorForScopeCreation().visitExpr(getPatternEntry().getOrigInit(), this,
653-
scopeCreator);
652+
ASTVisitorForScopeCreation().visitExpr(getPatternEntry().getOriginalInit(),
653+
this, scopeCreator);
654654
return this;
655655
}
656656

trunk/lib/AST/ASTScopeSourceRange.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ SourceRange PatternEntryDeclScope::getChildlessSourceRange() const {
213213
}
214214

215215
SourceRange PatternEntryInitializerScope::getChildlessSourceRange() const {
216-
return getPatternEntry().getOrigInit()->getSourceRange();
216+
return getPatternEntry().getOriginalInit()->getSourceRange();
217217
}
218218

219219
SourceRange PatternEntryUseScope::getChildlessSourceRange() const {

trunk/lib/AST/Decl.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,18 +1391,18 @@ unsigned PatternBindingDecl::getPatternEntryIndexForVarDecl(const VarDecl *VD) c
13911391
return ~0U;
13921392
}
13931393

1394-
Expr *PatternBindingEntry::getOrigInit() const {
1395-
return InitContextAndIsText.getInt() ? nullptr : InitExpr.origInit;
1394+
Expr *PatternBindingEntry::getOriginalInit() const {
1395+
return InitContextAndIsText.getInt() ? nullptr : InitExpr.originalInit;
13961396
}
13971397

1398-
SourceRange PatternBindingEntry::getOrigInitRange() const {
1399-
if (auto *i = getOrigInit())
1398+
SourceRange PatternBindingEntry::getOriginalInitRange() const {
1399+
if (auto *i = getOriginalInit())
14001400
return i->getSourceRange();
14011401
return SourceRange();
14021402
}
14031403

1404-
void PatternBindingEntry::setOrigInit(Expr *E) {
1405-
InitExpr.origInit = E;
1404+
void PatternBindingEntry::setOriginalInit(Expr *E) {
1405+
InitExpr.originalInit = E;
14061406
InitContextAndIsText.setInt(false);
14071407
}
14081408

@@ -1460,7 +1460,7 @@ SourceLoc PatternBindingEntry::getEndLoc(bool omitAccessors) const {
14601460
if (lastAccessorEnd.isValid())
14611461
return lastAccessorEnd;
14621462
}
1463-
const auto initEnd = getOrigInitRange().End;
1463+
const auto initEnd = getOriginalInitRange().End;
14641464
if (initEnd.isValid())
14651465
return initEnd;
14661466

@@ -1492,7 +1492,7 @@ StringRef PatternBindingEntry::getInitStringRepresentation(
14921492
if (InitContextAndIsText.getInt() && !InitStringRepresentation.empty())
14931493
return InitStringRepresentation;
14941494
auto &sourceMgr = getAnchoringVarDecl()->getASTContext().SourceMgr;
1495-
auto init = getInit();
1495+
auto init = getOriginalInit();
14961496
return extractInlinableText(sourceMgr, init, scratch);
14971497
}
14981498

trunk/lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5222,7 +5222,7 @@ Parser::parseDeclVar(ParseDeclOptions Flags,
52225222
PBDEntries.back().setEqualLoc(EqualLoc);
52235223

52245224
ParserResult<Expr> init = parseExpr(diag::expected_init_value);
5225-
PBDEntries.back().setOrigInit(init.getPtrOrNull());
5225+
PBDEntries.back().setOriginalInit(init.getPtrOrNull());
52265226

52275227
// If this Pattern binding was not supposed to have an initializer, but it
52285228
// did, diagnose this and remove it.

trunk/lib/Sema/PCMacro.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ class Instrumenter : InstrumenterBase {
435435

436436
SourceRange SR = PBD->getSourceRange();
437437
if (!SR.isValid()) {
438-
SR = PBD->getOrigInitRange(0);
438+
SR = PBD->getOriginalInitRange(0);
439439
}
440440

441441
Added<Stmt *> LogBefore = buildLoggerCall(SR, true);

0 commit comments

Comments
 (0)