Skip to content

Commit

Permalink
Version 3.5.0-14.0.dev
Browse files Browse the repository at this point in the history
Merge 769cfb3 into dev
  • Loading branch information
Dart CI committed Apr 3, 2024
2 parents 2b5233d + 769cfb3 commit 892ec61
Show file tree
Hide file tree
Showing 59 changed files with 781 additions and 503 deletions.
6 changes: 0 additions & 6 deletions build/config/clang/clang.gni
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("../../toolchain/goma.gni")

_toolchain_cpu = host_cpu
if (host_os == "mac" && use_goma) {
# Goma does not support ARM64.
_toolchain_cpu = "x64"
}

default_clang_prefix =
rebase_path("//buildtools/${host_os}-${_toolchain_cpu}/clang/bin",
Expand Down
7 changes: 1 addition & 6 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -921,12 +921,7 @@ config("optimize_speed") {

config("symbols") {
if (is_win) {
import("//build/toolchain/goma.gni")
if (use_goma) {
cflags = [ "/Z7" ] # No PDB file
} else {
cflags = [ "/Zi" ] # Produce PDB file, no edit and continue.
}
cflags = [ "/Zi" ] # Produce PDB file, no edit and continue.
ldflags = [ "/DEBUG" ]
} else {
cflags = [
Expand Down
5 changes: 2 additions & 3 deletions build/config/mac/mac_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")

declare_args() {
Expand All @@ -18,15 +17,15 @@ declare_args() {
# mac_sdk_min is used.
mac_sdk_path = ""

mac_enable_relative_sdk_path = use_rbe || use_goma
mac_enable_relative_sdk_path = use_rbe
}

find_sdk_args = [
"--print_sdk_path",
mac_sdk_min,
]

if (use_rbe || use_goma) {
if (use_rbe) {
find_sdk_args += [
"--create_symlink_at",

Expand Down
8 changes: 1 addition & 7 deletions build/toolchain/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import("//build/config/sysroot.gni") # Imports android/config.gni.
import("//build/toolchain/ccache.gni")
import("//build/toolchain/gcc_toolchain.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")

# The Android GCC toolchains share most of the same parameters, so we have this
Expand All @@ -20,12 +19,7 @@ import("//build/toolchain/rbe.gni")
# Same as gcc_toolchain
template("android_toolchain") {
gcc_toolchain(target_name) {
if (use_goma) {
assert(!use_ccache, "Goma and ccache can't be used together.")
assembler_prefix = "$goma_dir/gomacc "
compiler_prefix = "$goma_dir/gomacc "
link_prefix = "$goma_dir/gomacc "
} else if (use_rbe) {
if (use_rbe) {
compiler_args =
rewrapper_args + [ "--labels=type=compile,compiler=clang,lang=cpp" ]

Expand Down
8 changes: 1 addition & 7 deletions build/toolchain/fuchsia/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@
import("//build/config/sysroot.gni")
import("//build/toolchain/ccache.gni")
import("//build/toolchain/gcc_toolchain.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")

if (use_goma) {
assert(!use_ccache, "Goma and ccache can't be used together.")
assembler_prefix = "$goma_dir/gomacc "
compiler_prefix = "$goma_dir/gomacc "
link_prefix = "$goma_dir/gomacc "
} else if (use_ccache) {
if (use_ccache) {
assembler_prefix = "ccache "
compiler_prefix = "ccache "
link_prefix = "ccache "
Expand Down
22 changes: 0 additions & 22 deletions build/toolchain/goma.gni

This file was deleted.

9 changes: 1 addition & 8 deletions build/toolchain/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import("//build/config/sysroot.gni")
import("//build/toolchain/ccache.gni")
import("//build/toolchain/gcc_toolchain.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")

declare_args() {
Expand All @@ -17,13 +16,7 @@ declare_args() {
riscv64_toolchain_prefix = ""
}

if (use_goma) {
assert(!use_ccache, "Goma and ccache can't be used together.")
assembler_prefix = "$goma_dir/gomacc "
compiler_prefix = "$goma_dir/gomacc "
link_prefix = "$goma_dir/gomacc "
gcc_compiler_prefix = compiler_prefix
} else if (use_rbe) {
if (use_rbe) {
compiler_args =
rewrapper_args + [ "--labels=type=compile,compiler=clang,lang=cpp" ]

Expand Down
11 changes: 2 additions & 9 deletions build/toolchain/mac/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@
# Linux.

import("//build/config/mac/mac_sdk.gni")
import("../goma.gni")

assert(host_os == "mac")

import("//build/config/sysroot.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")
import("//build/toolchain/signing.gni")

if (use_goma) {
assembler_prefix = "$goma_dir/gomacc "
compiler_prefix = "$goma_dir/gomacc "
link_prefix = "$goma_dir/gomacc "
} else if (use_rbe) {
if (use_rbe) {
compiler_args =
rewrapper_args + [ "--labels=type=compile,compiler=clang,lang=cpp" ]
if (rbe_os != host_os || rbe_cpu != host_cpu) {
Expand All @@ -38,8 +32,7 @@ if (use_goma) {
link_prefix = ""
}

# Goma doesn't support the host-arm64 toolchain, so continue using Rosetta.
if (host_cpu == "arm64" && !use_goma) {
if (host_cpu == "arm64") {
rebased_clang_dir =
rebase_path("//buildtools/mac-arm64/clang/bin", root_build_dir)
} else {
Expand Down
5 changes: 1 addition & 4 deletions build/toolchain/win/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ declare_args() {
}

import("//build/config/win/visual_studio_version.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")

# Should only be running on Windows.
Expand All @@ -25,9 +24,7 @@ tool_wrapper_path = rebase_path("tool_wrapper.py", root_build_dir)

ninja_path = rebase_path("//buildtools/ninja/ninja")

if (use_goma) {
compiler_prefix = "$goma_dir/gomacc.exe "
} else if (use_rbe) {
if (use_rbe) {
compiler_args =
rewrapper_args + [ "--labels=type=compile,compiler=clang-cl,lang=cpp" ]
if (rbe_os != host_os || rbe_cpu != host_cpu) {
Expand Down
24 changes: 12 additions & 12 deletions pkg/analysis_server/lib/src/analysis_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -999,18 +999,6 @@ abstract class CommonServerContextManagerCallbacks
var path = result.path;
filesToFlush.add(path);

if (result is AnalysisResultWithErrors) {
if (analysisServer.isAnalyzed(path)) {
final serverErrors = server.doAnalysisError_listFromEngine(result);
recordAnalysisErrors(path, serverErrors);
}
}

if (result is ResolvedUnitResult) {
analysisServer.filesResolvedSinceLastIdle.add(path);
handleResolvedUnitResult(result);
}

// If this is a virtual file and the client supports URIs, we need to notify
// that it's been updated.
var lspUri = analysisServer.uriConverter.toClientUri(result.path);
Expand All @@ -1027,6 +1015,18 @@ abstract class CommonServerContextManagerCallbacks
);
analysisServer.sendLspNotification(message);
}

if (result is AnalysisResultWithErrors) {
if (analysisServer.isAnalyzed(path)) {
final serverErrors = server.doAnalysisError_listFromEngine(result);
recordAnalysisErrors(path, serverErrors);
}
}

if (result is ResolvedUnitResult) {
analysisServer.filesResolvedSinceLastIdle.add(path);
handleResolvedUnitResult(result);
}
}

void handleResolvedUnitResult(ResolvedUnitResult result);
Expand Down
12 changes: 6 additions & 6 deletions pkg/analysis_server/lib/src/computer/computer_highlights.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,12 @@ class _DartUnitHighlightsComputerVisitor extends RecursiveAstVisitor<void> {
super.visitMixinDeclaration(node);
}

@override
void visitMixinOnClause(MixinOnClause node) {
computer._addRegion_token(node.onKeyword, HighlightRegionType.BUILT_IN);
super.visitMixinOnClause(node);
}

@override
void visitNamedType(NamedType node) {
if (node.importPrefix case final importPrefix?) {
Expand Down Expand Up @@ -1300,12 +1306,6 @@ class _DartUnitHighlightsComputerVisitor extends RecursiveAstVisitor<void> {
super.visitNullLiteral(node);
}

@override
void visitOnClause(OnClause node) {
computer._addRegion_token(node.onKeyword, HighlightRegionType.BUILT_IN);
super.visitOnClause(node);
}

@override
void visitPartDirective(PartDirective node) {
computer._addRegion_node(node, HighlightRegionType.DIRECTIVE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class DartCompletionManager {
if (selection == null) {
throw AbortCompletion();
}
var state = CompletionState(request, selection);
var state = CompletionState(request, selection, budget);
var pass = InScopeCompletionPass(
state: state,
collector: collector,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,41 @@ class CompletionState {
/// The completion request being processed.
final DartCompletionRequest request;

/// The selection at the time completion was requested. The selection is
/// required to have a length of zero.
/// The selection at the time completion was requested.
///
/// The selection is required to have a length of zero.
final Selection selection;

/// The budget controlling how much time can be spent computing completion
/// suggestions.
final CompletionBudget budget;

/// Initialize a newly created completion state.
CompletionState(this.request, this.selection) : assert(selection.length == 0);
CompletionState(this.request, this.selection, this.budget)
: assert(selection.length == 0);

/// Returns the type of value required by the context in which completion was
/// The type of value required by the context in which completion was
/// requested.
DartType? get contextType => request.contextType;

/// Return the [ClassMember] that encloses the completion location, or `null`
/// if the completion location isn't in a class member.
/// The [ClassMember] that encloses the completion location, or `null` if the
/// completion location isn't in a class member.
ClassMember? get enclosingMember {
return selection.coveringNode.thisOrAncestorOfType<ClassMember>();
}

/// Return `true` if the completion location is inside an instance member, and
/// hence there is a binding for `this`.
/// Whether the completion location is inside an instance member, and hence
/// whether there is a binding for `this`.
bool get inInstanceScope {
var member = enclosingMember;
return member != null && !member.isStatic;
}

/// Returns the element of the library containing the completion location.
/// The element of the library containing the completion location.
LibraryElement get libraryElement => request.libraryElement;

/// Return the type of `this` at the completion location, or `null`
/// if the completion location doesn't allow `this` to be used.
/// The type of `this` at the completion location, or `null` if the completion
/// location doesn't allow `this` to be used.
DartType? get thisType {
AstNode? node = selection.coveringNode;
while (node != null) {
Expand Down Expand Up @@ -70,16 +76,16 @@ class CompletionState {
return null;
}

/// Return `true` if the given `feature` is enabled in the library containing
/// the selection.
/// Whether the given `feature` is enabled in the library containing the
/// selection.
bool isFeatureEnabled(Feature feature) {
return libraryElement.featureSet.isEnabled(feature);
}
}

// TODO(brianwilkerson): Move to 'package:analysis_server/src/utilities/extensions/ast.dart'
extension on ClassMember {
/// Return `true` if this member is a static member.
/// Whether this member is a static member.
bool get isStatic {
var self = this;
if (self is MethodDeclaration) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1795,6 +1795,16 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
}
}

@override
void visitMixinOnClause(MixinOnClause node) {
var onKeyword = node.onKeyword;
if (offset <= onKeyword.end) {
keywordHelper.addKeyword(Keyword.ON);
} else {
_forTypeAnnotation(node);
}
}

@override
void visitNamedExpression(NamedExpression node) {
if (offset <= node.name.label.end) {
Expand Down Expand Up @@ -1882,16 +1892,6 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
}
}

@override
void visitOnClause(OnClause node) {
var onKeyword = node.onKeyword;
if (offset <= onKeyword.end) {
keywordHelper.addKeyword(Keyword.ON);
} else {
_forTypeAnnotation(node);
}
}

@override
void visitParenthesizedExpression(ParenthesizedExpression node) {
var expression = node.expression;
Expand Down Expand Up @@ -3468,8 +3468,10 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
required InterfaceElement? element,
bool skipAt = false,
}) {
// TODO(brianwilkerson): Check whether there's sufficient remaining time
// before computing suggestions for overrides.
if (state.budget.isEmpty) {
// Don't suggest overrides if the time budget has already been spent.
return;
}
if (suggestOverrides && element != null) {
overrideHelper.computeOverridesFor(
interfaceElement: element,
Expand Down Expand Up @@ -3671,9 +3673,9 @@ extension on AstNode {
MethodDeclaration(:var metadata) => metadata.contains(child),
MixinDeclaration(:var members, :var metadata) =>
members.contains(child) || metadata.contains(child),
ObjectPattern(:var fields) => fields.contains(child),
OnClause(:var superclassConstraints) =>
MixinOnClause(:var superclassConstraints) =>
superclassConstraints.contains(child),
ObjectPattern(:var fields) => fields.contains(child),
PartDirective(:var metadata) => metadata.contains(child),
PartOfDirective(:var metadata) => metadata.contains(child),
PatternVariableDeclaration(:var metadata) => metadata.contains(child),
Expand Down
Loading

0 comments on commit 892ec61

Please sign in to comment.