Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 65fcaf3

Browse files
johnniwintherCommit Queue
authored and
Commit Queue
committed
[cfe] Remove inConstructorName
This removes the inConstructorName property from the outline builder. This relies on the inConstructor property which cannot be accurately computed. This prepares for removal of the inConstructor property. Change-Id: Ibc31f4c590717165fb5d86478ba1949cfed100c8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461020 Reviewed-by: Jens Johansen <jensj@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Erik Ernst <eernst@google.com>
1 parent f02fd0c commit 65fcaf3

13 files changed

+372
-295
lines changed

‎pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ abstract class StackListener extends Listener with StackChecker {
181181
if (tokenOrNull == null) stack.push(nullValue);
182182
}
183183

184-
Object? peek() => stack.isNotEmpty ? stack.last :null;
184+
Object? peek([NullValue? nullValue]) => stack.peek(nullValue);
185185

186186
Object? pop([NullValue? nullValue]) {
187187
return stack.pop(nullValue);
@@ -488,6 +488,8 @@ abstract class Stack {
488488

489489
List<Object?> get values;
490490

491+
Object? peek(NullValue? nullValue);
492+
491493
Object? pop(NullValue? nullValue);
492494

493495
int get length;
@@ -528,6 +530,22 @@ class StackImpl implements Stack {
528530
}
529531
}
530532

533+
@override
534+
Object? peek(NullValue? nullValue) {
535+
if (isNotEmpty) {
536+
Object? value = last;
537+
if (value is! NullValue) {
538+
return value;
539+
} else if (nullValue == null || value == nullValue) {
540+
return null;
541+
} else {
542+
return value;
543+
}
544+
} else {
545+
return null;
546+
}
547+
}
548+
531549
@override
532550
Object? pop(NullValue? nullValue) {
533551
assert(arrayLength > 0);
@@ -638,6 +656,11 @@ class DebugStack implements Stack {
638656
@override
639657
int get length => realStack.length;
640658

659+
@override
660+
Object? peek(NullValue? nullValue) {
661+
return realStack.peek(nullValue);
662+
}
663+
641664
@override
642665
Object? pop(NullValue? nullValue) {
643666
Object? result = realStack.pop(nullValue);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /