Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
41458dc
Sync to origin master
mk13 Nov 30, 2016
6395e37
Merge with origin master
mk13 Dec 1, 2016
8eedfce
Merge branch 'master' of https://github.com/dart-lang/angular2-dart-a…
mk13 Dec 9, 2016
1eba56f
Merge branch 'master' of https://github.com/dart-lang/angular2-dart-a…
mk13 Dec 9, 2016
2e0f1a4
Merge branch 'master' of https://github.com/dart-lang/angular2-dart-a…
mk13 Dec 10, 2016
9881a95
Merge branch 'master' of https://github.com/dart-lang/angular2-dart-a…
mk13 Dec 13, 2016
d46b2de
Merge branch 'master' of https://github.com/dart-lang/angular2-dart-a…
mk13 Dec 16, 2016
6489912
Merge branch 'master' of https://github.com/dart-lang/angular2-dart-a…
mk13 Dec 24, 2016
c453117
Merge branch 'master' of https://github.com/dart-lang/angular2-dart-a…
mk13 Dec 28, 2016
dd5fee4
Merge branch 'master' of https://github.com/dart-lang/angular2-dart-a…
mk13 Jan 5, 2017
ca77fc4
Merge branch 'master' of https://github.com/dart-lang/angular2-dart-a…
mk13 Jan 9, 2017
b0e3635
Merge branch 'master' of https://github.com/dart-lang/angular2-dart-a…
mk13 Jan 10, 2017
cdcc5ff
Merge branch 'master' of https://github.com/dart-lang/angular2-dart-a…
mk13 Jan 10, 2017
1c04147
Merge branch 'master' of https://github.com/dart-lang/angular2-dart-a…
mk13 Jan 23, 2017
11de100
Merge branch 'master' of https://github.com/dart-lang/angular2-dart-a…
mk13 Mar 2, 2017
d39f620
checkpoint
mk13 Mar 3, 2017
bea4a90
Initial ast integration - ranges not behaving properly
mk13 Mar 4, 2017
f8494d1
Minor bug fix
mk13 Mar 4, 2017
4911ffe
checkpoint
mk13 Mar 6, 2017
f1f19a0
Tasks tests all passing
mk13 Mar 12, 2017
df8ddc0
Checkpoint before error code fix
mk13 Mar 12, 2017
ff0be32
Tasks tests set back to 100% after introducing error codes
mk13 Mar 18, 2017
390c09d
resolver_test midway checkpoint
mk13 Mar 19, 2017
9319791
Checkpoint
mk13 Mar 20, 2017
11a613a
Full test coverage in analyzer. Server still left
mk13 Mar 20, 2017
743b41b
All tests passing
mk13 Mar 22, 2017
1e71856
Make paths explicit
mk13 Mar 23, 2017
ef23f0e
Remove comments
mk13 Mar 23, 2017
c0ac16e
Attributes now sorted by offset. Improves performance in auto completion
mk13 Mar 24, 2017
5decb80
DOCTYPE now acceptable
mk13 Mar 26, 2017
bd6987c
Created separate Ast for top level document container
mk13 Mar 27, 2017
c7fa463
Refactored primary function in completion.dart
mk13 Mar 29, 2017
b9a9cc9
Minor code clean up
mk13 Mar 29, 2017
77a9189
Fuzz tester bug fix
mk13 Mar 29, 2017
51de2f2
Revert try catch block
mk13 Mar 29, 2017
5153308
Rename exception codes after changes in angular_ast
mk13 Mar 30, 2017
17457a0
Bug fix on [class. [style. [attr. bindings; range error
mk13 Apr 4, 2017
6aa9f23
Allow spaces in msutaches
mk13 Apr 5, 2017
ab79a07
Autocompletion in text attribute value is now empty
mk13 Apr 6, 2017
8ab8c3f
Allow for plain [class] binding
mk13 Apr 7, 2017
86901ea
Fixed update_deps.sh to work with angular_ast
mk13 Apr 9, 2017
c2835f7
Clean up deps and remove some unnecessary comments
mk13 Apr 9, 2017
5536e42
Angular_ast integration with new summaries based analysis
mk13 Apr 9, 2017
6d051f6
Changed pubspec to pull from master
mk13 Apr 10, 2017
5774643
Merge branch 'angular_ast_integration' into summary_integration
mk13 Apr 10, 2017
6ac8a80
Defend against files hidden by generated files (#271)
MichaelRFairhurst Apr 11, 2017
c489fcf
Merge branch 'master' of https://github.com/dart-lang/angular2-dart-a…
mk13 Apr 11, 2017
0be177b
Fix travis build. Fix sdk related errors (ContextRoot and IdeOptions)…
mk13 Apr 11, 2017
8d51fd7
Travis sdk fix (#272)
mk13 Apr 11, 2017
35f0e9c
Merge branch 'master' of https://github.com/dart-lang/angular2-dart-a…
mk13 Apr 11, 2017
de779c7
Merge with master
mk13 Apr 11, 2017
bf5b69f
First round of quick fixes based on feedback
mk13 Apr 12, 2017
390d63a
remove comment
mk13 Apr 13, 2017
4998c16
Error codes no longer use hard offsets; uses string instead
mk13 Apr 13, 2017
c81ef23
Merged attribute generating logic to be agnostic of Element or templa…
mk13 Apr 15, 2017
f930897
Assert for indexOf added into test. Moved comments for clarity
mk13 Apr 15, 2017
12d6d6a
Remove comment-blocked chunk
mk13 Apr 15, 2017
e1c2949
Changes based on feedback
mk13 Apr 17, 2017
989b3b9
Error codes added to hashmap so now show up. Fixed issue with <div te…
mk13 Apr 18, 2017
6be99fb
Changed pubspec to pull from master in angular_ast
mk13 Apr 19, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion analyzer_plugin/lib/ast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ abstract class AngularAstNode {
}

abstract class AngularAstVisitor {
void visitDocumentInfo(DocumentInfo document) {
for (AngularAstNode child in document.childNodes) {
child.accept(this);
}
}

void visitMustache(Mustache mustache) {}

void visitTextAttr(TextAttribute textAttr) => _visitAllChildren(textAttr);
Expand Down Expand Up @@ -185,13 +191,21 @@ class Mustache extends AngularAstNode {
Expression expression;
final int offset;
final int length;
final int exprBegin;
final int exprEnd;

Map<String, LocalVariable> localVariables =
new HashMap<String, LocalVariable>();

List<AngularAstNode> get children => const <AngularAstNode>[];

Mustache(this.offset, this.length, this.expression);
Mustache(
this.offset,
this.length,
this.expression,
this.exprBegin,
this.exprEnd,
);

void accept(AngularAstVisitor visitor) => visitor.visitMustache(this);
}
Expand Down Expand Up @@ -287,6 +301,36 @@ class TextInfo extends NodeInfo {
void accept(AngularAstVisitor visitor) => visitor.visitTextInfo(this);
}

/**
* A wrapper for a given HTML document or
* dart-angular inline HTML template.
*/
class DocumentInfo extends ElementInfo {
factory DocumentInfo() = DocumentInfo._;

DocumentInfo._()
: super(
'',
new SourceRange(0, 0),
new SourceRange(0, 0),
new SourceRange(0, 0),
new SourceRange(0, 0),
false,
[],
null,
null,
);

@override
bool get isSynthetic => false;

@override
List<AngularAstNode> get children => childNodes;

@override
void accept(AngularAstVisitor visitor) => visitor.visitDocumentInfo(this);
}

/**
* An element in an HTML tree.
*/
Expand Down
28 changes: 20 additions & 8 deletions analyzer_plugin/lib/src/angular_driver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:convert';
import 'dart:async';
import 'dart:collection';
import 'package:analysis_server/src/analysis_server.dart';
import 'package:analyzer/context/context_root.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/generated/sdk.dart';
Expand Down Expand Up @@ -58,6 +59,8 @@ class AngularDriver
_fileTracker = new FileTracker(this);
}

ContextRoot get contextRoot => dartDriver.contextRoot;

ApiSignature getUnitElementHash(String path) {
return dartDriver.getUnitKeyByPath(path);
}
Expand Down Expand Up @@ -277,13 +280,13 @@ class AngularDriver
final tplParser = new TemplateParser();

tplParser.parse(htmlContent, htmlSource);
final document = tplParser.document;
final document = tplParser.rawAst;
final EmbeddedDartParser parser = new EmbeddedDartParser(
htmlSource, tplErrorListener, errorReporter);

template.ast =
new HtmlTreeConverter(parser, htmlSource, tplErrorListener)
.convert(firstElement(tplParser.document));
.convertFromAstList(tplParser.rawAst);
template.ast.accept(new NgContentRecorder(directive, errorReporter));
setIgnoredErrors(template, document);
final resolver = new TemplateResolver(
Expand Down Expand Up @@ -349,7 +352,7 @@ class AngularDriver
new EmbeddedDartParser(source, tplErrorListener, errorReporter);

final ast = new HtmlTreeConverter(parser, source, tplErrorListener)
.convert(firstElement(tplParser.document));
.convertFromAstList(tplParser.rawAst);
final contents = <NgContent>[];
ast.accept(new NgContentRecorder.forFile(contents, source, errorReporter));

Expand Down Expand Up @@ -387,8 +390,17 @@ class AngularDriver

Future<DirectivesResult> resolveDart(String path,
{bool withDirectives: false}) async {
final key =
(await dartDriver.getUnitElementSignature(path)) + '.ngresolved';
final baseKey = await dartDriver.getUnitElementSignature(path);

// This happens when the path is..."hidden by a generated file"..whch I
// don't understand, but, can protect against. Should not be analyzed.
// TODO detect this on file add rather than on file analyze.
if (baseKey == null) {
_dartFiles.remove(path);
return null;
}

final key = baseKey + '.ngresolved';

if (lastSignatures[path] == key) {
return null;
Expand Down Expand Up @@ -448,12 +460,12 @@ class AngularDriver

tplParser.parse(view.templateText, source,
offset: view.templateOffset);
final document = tplParser.document;
final document = tplParser.rawAst;
final EmbeddedDartParser parser =
new EmbeddedDartParser(source, tplErrorListener, errorReporter);

template.ast = new HtmlTreeConverter(parser, source, tplErrorListener)
.convert(firstElement(tplParser.document));
.convertFromAstList(tplParser.rawAst);
template.ast.accept(new NgContentRecorder(directive, errorReporter));
setIgnoredErrors(template, document);
final resolver = new TemplateResolver(
Expand Down Expand Up @@ -565,7 +577,7 @@ class AngularDriver
new EmbeddedDartParser(source, tplErrorListener, errorReporter);

template.ast = new HtmlTreeConverter(parser, source, tplErrorListener)
.convert(firstElement(tplParser.document));
.convertFromAstList(tplParser.rawAst);
template.ast.accept(new NgContentRecorder(directive, errorReporter));
}
}
Expand Down
Loading