Skip to content

Commit

Permalink
Version 1.8.0-dev.4.0
Browse files Browse the repository at this point in the history
 svn merge -r 41500:41683 https://dart.googlecode.com/svn/branches/bleeding_edge trunk

git-svn-id: http://dart.googlecode.com/svn/trunk@41684 260f80e4-7a28-3924-810f-c04153c831b5
  • Loading branch information
ricowind committed May 27, 2015
2 parents ecc6bd5 + f343cae commit 0f34f62
Show file tree
Hide file tree
Showing 697 changed files with 22,178 additions and 12,814 deletions.
2 changes: 1 addition & 1 deletion dart.gyp
Expand Up @@ -128,7 +128,7 @@
'target_name': 'api_docs',
'type': 'none',
'dependencies': [
'utils/apidoc/docgen.gyp:docgen',
'utils/apidoc/docgen.gyp:dartdocgen',
],
},
{
Expand Down
1,208 changes: 156 additions & 1,052 deletions docs/language/dartLangSpec.tex

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion pkg/analysis_server/doc/api.html
Expand Up @@ -2106,7 +2106,15 @@ <h2 class="domain"><a name="types">Types</a></h2>
in a completion suggestion.
</p>

<dl><dt class="value">ARGUMENT_LIST</dt><dt class="value">IMPORT</dt><dt class="value">IDENTIFIER</dt><dd>
<dl><dt class="value">ARGUMENT_LIST</dt><dd>

<p>
A list of arguments for the method or function that is being invoked.
For this suggestion kind, the completion field is a textual representation
of the invocation and the parameterNames, parameterTypes, and requiredParameterCount
attributes are defined.
</p>
</dd><dt class="value">IMPORT</dt><dt class="value">IDENTIFIER</dt><dd>

<p>
The element identifier should be inserted at the completion location.
Expand Down
21 changes: 16 additions & 5 deletions pkg/analysis_server/lib/src/computer/computer_hover.dart
Expand Up @@ -68,10 +68,21 @@ class DartUnitHoverComputer {
*/
HoverInformation compute() {
AstNode node = new NodeLocator.con1(_offset).searchWithin(_unit);
if (node.parent is TypeName &&
node.parent.parent is ConstructorName &&
node.parent.parent.parent is InstanceCreationExpression) {
node = node.parent.parent.parent;
}
if (node.parent is ConstructorName &&
node.parent.parent is InstanceCreationExpression) {
node = node.parent.parent;
}
if (node is Expression) {
HoverInformation hover = new HoverInformation(node.offset, node.length);
Expression expression = node;
HoverInformation hover =
new HoverInformation(expression.offset, expression.length);
// element
Element element = ElementLocator.locateWithOffset(node, _offset);
Element element = ElementLocator.locateWithOffset(expression, _offset);
if (element != null) {
// variable, if synthetic accessor
if (element is PropertyAccessorElement) {
Expand All @@ -95,10 +106,10 @@ class DartUnitHoverComputer {
hover.dartdoc = dartDoc;
}
// parameter
hover.parameter = _safeToString(node.bestParameterElement);
hover.parameter = _safeToString(expression.bestParameterElement);
// types
hover.staticType = _safeToString(node.staticType);
hover.propagatedType = _safeToString(node.propagatedType);
hover.staticType = _safeToString(expression.staticType);
hover.propagatedType = _safeToString(expression.propagatedType);
// done
return hover;
}
Expand Down
30 changes: 16 additions & 14 deletions pkg/analysis_server/lib/src/computer/computer_navigation.dart
Expand Up @@ -168,20 +168,22 @@ class _DartUnitNavigationComputerVisitor extends RecursiveAstVisitor {
ClassElement classElement = element.enclosingElement;
element = classElement;
}
// "new ", excluding last character
computer._addRegion_nodeStart_nodeStart(
node,
constructorName.type,
element,
excludeLastChar: true);
// "ClassName<TypeA, TypeB>"
_safelyVisit(constructorName.type);
// optional ".name"
if (constructorName.period != null) {
computer._addRegion_tokenStart_nodeEnd(
constructorName.period,
constructorName,
element);
// add regions
TypeName typeName = constructorName.type;
TypeArgumentList typeArguments = typeName.typeArguments;
if (typeArguments == null) {
computer._addRegion_nodeStart_nodeEnd(node, constructorName, element);
} else {
computer._addRegion_nodeStart_nodeEnd(node, typeName.name, element);
// <TypeA, TypeB>
typeArguments.accept(this);
// optional ".name"
if (constructorName.period != null) {
computer._addRegion_tokenStart_nodeEnd(
constructorName.period,
constructorName,
element);
}
}
}
_safelyVisit(node.argumentList);
Expand Down
28 changes: 22 additions & 6 deletions pkg/analysis_server/lib/src/domain_completion.dart
Expand Up @@ -24,6 +24,11 @@ class CompletionDomainHandler implements RequestHandler {
*/
int _nextCompletionId = 0;

/**
* Code completion peformance for the last completion operation.
*/
CompletionPerformance performance;

/**
* Initialize a new request handler for the given [server].
*/
Expand All @@ -46,33 +51,44 @@ class CompletionDomainHandler implements RequestHandler {
* Process a `completion.getSuggestions` request.
*/
Response processRequest(Request request) {
performance = new CompletionPerformance();
// extract params
var params = new CompletionGetSuggestionsParams.fromRequest(request);
CompletionGetSuggestionsParams params =
new CompletionGetSuggestionsParams.fromRequest(request);
// schedule completion analysis
String completionId = (_nextCompletionId++).toString();
CompletionManager.create(
server.getAnalysisContext(params.file),
server.getSource(params.file),
params.offset,
server.searchEngine).results().listen((CompletionResult result) {
server.searchEngine,
performance).results().listen((CompletionResult result) {
sendCompletionNotification(
completionId,
result.replacementOffset,
result.replacementLength,
result.suggestions,
result.last);
if (result.last) {
performance.complete();
}
});
// initial response without results
return new CompletionGetSuggestionsResult(completionId).toResponse(
request.id);
return new CompletionGetSuggestionsResult(
completionId).toResponse(request.id);
}

/**
* Send completion notification results.
*/
void sendCompletionNotification(String completionId, int replacementOffset,
int replacementLength, Iterable<CompletionSuggestion> results, bool isLast) {
server.sendNotification(new CompletionResultsParams(completionId,
replacementOffset, replacementLength, results, isLast).toNotification());
server.sendNotification(
new CompletionResultsParams(
completionId,
replacementOffset,
replacementLength,
results,
isLast).toNotification());
}
}
2 changes: 0 additions & 2 deletions pkg/analysis_server/lib/src/domain_execution.dart
Expand Up @@ -177,8 +177,6 @@ class ExecutionDomainHandler implements RequestHandler {
=> server.contextDirectoryManager.isInAnalysisRoot(filePath);

void _reportCurrentFileStatus() {
Map<String, List<String>> dartToHtml = new HashMap<String, List<String>>();
Map<String, List<String>> htmlToDart = new HashMap<String, List<String>>();
for (AnalysisContext context in server.getAnalysisContexts()) {
List<Source> librarySources = context.librarySources;
List<Source> clientSources = context.launchableClientLibrarySources;
Expand Down
10 changes: 9 additions & 1 deletion pkg/analysis_server/lib/src/edit/edit_domain.dart
Expand Up @@ -294,7 +294,6 @@ class _RefactoringManager {
*/
Future<RefactoringStatus> _init(RefactoringKind kind, String file, int offset,
int length) {
List<RefactoringProblem> problems = <RefactoringProblem>[];
// check if we can continue with the existing Refactoring instance
if (this.kind == kind &&
this.file == file &&
Expand Down Expand Up @@ -373,6 +372,15 @@ class _RefactoringManager {
if (nodes.isNotEmpty && elements.isNotEmpty) {
AstNode node = nodes[0];
Element element = elements[0];
// climb from "Class" in "new Class()" to "new Class()"
if (node.parent is TypeName &&
node.parent.parent is ConstructorName &&
node.parent.parent.parent is InstanceCreationExpression) {
InstanceCreationExpression creation = node.parent.parent.parent;
node = creation;
element = creation.staticElement;
}
// do create the refactoring
refactoring = new RenameRefactoring(searchEngine, element);
feedback =
new RenameFeedback(node.offset, node.length, 'kind', 'oldName');
Expand Down
6 changes: 6 additions & 0 deletions pkg/analysis_server/lib/src/generated_protocol.dart
Expand Up @@ -5571,6 +5571,12 @@ class CompletionSuggestion implements HasToJson {
* }
*/
class CompletionSuggestionKind implements Enum {
/**
* A list of arguments for the method or function that is being invoked. For
* this suggestion kind, the completion field is a textual representation of
* the invocation and the parameterNames, parameterTypes, and
* requiredParameterCount attributes are defined.
*/
static const ARGUMENT_LIST = const CompletionSuggestionKind._("ARGUMENT_LIST");

static const IMPORT = const CompletionSuggestionKind._("IMPORT");
Expand Down

0 comments on commit 0f34f62

Please sign in to comment.