Commit Graph

8489 Commits

Author SHA1 Message Date
scheglov@google.com 5b19f0a625 Add CacheEntry.setErrorState().
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//988883004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44309 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-07 17:01:26 +00:00
scheglov@google.com 60d4a29500 Fix for subscribing for notifications for files in packages.
Unfortunately this fix makes the server about 20% slower.

This is mostly because of the check in scheduleNotificationOperations(),
as required to fix dartbug.com/22210. I think it is much cheaper to send
duplicate notifications, like outline or navigation, than to check if
they should not be sent.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org//987663002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44305 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-06 22:55:20 +00:00
brianwilkerson@google.com fafa5d79c7 Convert content cache to use file paths
R=paulberry@google.com

Review URL: https://codereview.chromium.org//983183003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44300 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-06 19:22:44 +00:00
scheglov@google.com cf2f5bc3f5 Disable incremental resolution of comments outside function bodies.
It causes disappearing of semantic highlighting and navigation for the first
node after a just added comment.

Unfortunately there is no easy way to add/remove comment tokens.
We can replace tokens, but we need also to replace tokens in nodes.
Given that we are in a cherry picking season, let's implement the simplest correct solution.

R=brianwilkerson@google.com
BUG= https://code.google.com/p/dart/issues/detail?id=22644

Review URL: https://codereview.chromium.org//982243002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44295 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-06 16:53:24 +00:00
brianwilkerson@google.com ab1d3ad17c Better recovery (issue 22693)
R=scheglov@google.com

Review URL: https://codereview.chromium.org//987633002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44290 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-06 14:11:24 +00:00
brianwilkerson@google.com dc30f2b718 Fix location of error (issue 22383)
R=scheglov@google.com

Review URL: https://codereview.chromium.org//987553003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44273 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-05 23:00:48 +00:00
brianwilkerson@google.com 9004e91fec No errors in third-party packages (issue 22170)
R=paulberry@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org//983733002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44270 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-05 20:17:24 +00:00
scheglov@google.com 7d95442c32 Expose 'typeProvider' from AnalysisContext.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//965393004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44245 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 19:09:27 +00:00
scheglov@google.com 730390fb82 Overwrite local instrumentation file.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//977953002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44243 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 18:19:23 +00:00
scheglov@google.com 2ee5ca1091 Issue 22644. Fix for removing non-Dartdoc comments before a declaration.
R=brianwilkerson@google.com
BUG= https://code.google.com/p/dart/issues/detail?id=22644

Review URL: https://codereview.chromium.org//980513002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44237 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 14:42:23 +00:00
paulberry@google.com c867649e4a Don't define parameters when visiting a function-typed formal parameter.
BUG=dartbug.com/13179
R=scheglov@google.com

Review URL: https://codereview.chromium.org//978633003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44212 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 00:39:14 +00:00
scheglov@google.com cbfec08aa9 Replace using unconditional _recordPropagatedType() with a conditional _recordPropagatedTypeIfBetter().
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//974033002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44204 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 22:06:00 +00:00
brianwilkerson@google.com d1ac25879b First cut at analysis driver
R=paulberry@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org//913483002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44199 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 21:24:25 +00:00
paulberry@google.com 32d7905797 Fully parse SDK files when analyzing in batch mode.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//973683004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44196 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 19:47:08 +00:00
scheglov@google.com 2112b929ca Don't set a propagate type if the variable has already the same static type.
This fixes displaying both "Static type" and "Propagated type" sections in UI.

Maybe also some performance improvement because of avoiding resolving propagated elements.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org//971193003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44184 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 17:39:02 +00:00
brianwilkerson@google.com 98b7382071 Reformat
R=paulberry@google.com

Review URL: https://codereview.chromium.org//975453004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44149 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-02 21:34:46 +00:00
paulberry@google.com 7f13f31ab0 Avoid unnecessary parsing/resolution when running command line analyzer.
By default, the command-line analyzer doesn't show errors, warnings,
or hints for the SDK or for files imported via "package:" URI's.
Accordingly, it shouldn't be necessary to parse or resolve function
bodies in those files.

This can save a substantial amount of time when analyzing files that
are part of large applications.  For example, analysis time of
pkg/analyzer/bin/anaylzer.dart goes down from ~6.5 seconds to ~3.5
seconds.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//967703002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44143 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-02 19:38:44 +00:00
paulberry@google.com 45b7294eff Don't do folder existence checks when parsing pub list results.
It's just a waste of time since we already to folder existence checks
when resolving package URI's.  Besides, all the folders output by pub
list should always exist except in pathological situations.

Improves total analysis time by about 2%.

R=danrubel@google.com

Review URL: https://codereview.chromium.org//952333002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44137 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-02 18:28:22 +00:00
brianwilkerson@google.com 268cd8bab2 API clean-up
R=scheglov@google.com

Review URL: https://codereview.chromium.org//970913002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44134 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-02 17:28:37 +00:00
scheglov@google.com 420a079f3e Discard previous overlay content on _sourceChanged() notification.
This fixes the following scenario:

1. Edit a file.
   Server adds overlay.

2. Save a file.
   Editor save the file buffer to disk.
   Editor asks to remove the overlay.
   Server remove the overlay.
   Engine checks that the previous overlay content is the same as the file content and remembers this content in the LRU cache.

3. Server receives a file system modification event.
   Engine starts processing the change and ignores it in _sourceChanged() because the previous overlay content is the save.
   But it keeps this content in the cache!

4. User switches to another branche, so the file is change.
   Server receives a file system modification event.
   Engine sees that the content of the file is not the same as the content in the previous overlay and performs full analysis.

5. User switches back to the original branch.
   Server receives a file system modification event.
   Engine in _sourceChanged() ignore the change, because it is the same as it was before!

  So, we need to clear the previous overlay cache once we use it.
  Therefore we can just put it into the SourceEntry itself.
  This also simplifies the cache management - we don't need another way to remove elements on change, or a file removal.

  The only situation when we might keep content longer than required is in the following scenario:
1. User makes a change, adds an overlay.
2. User makes a change that restores initial content.
3. Editor asks the server to remove the overlay.
  Practially however Editor keep the file dirty in this case.
  So, user will save the file eventully and we will remove the cached previous content from the entry.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//968533003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44116 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-01 18:47:25 +00:00
scheglov@google.com 90d58d1b50 Use node accessors to check for const/final/etc.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org//960093004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44114 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-28 06:28:19 +00:00
brianwilkerson@google.com 05b314197e Fix for issue 22594
R=scheglov@google.com

Review URL: https://codereview.chromium.org//965093003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44113 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-28 04:31:48 +00:00
scheglov@google.com 1a7ac64ae2 Don't remove indexing operations on potential source changes.
This covers the following scenario:

1. User performs an undo operation in a save editor.

2. Editor updates the file buffer, so sends 'add overlay'.
   Server performs an incremental analysis and schedules an 'analyze' operation.

3. The 'analyze' operation runs and schedules 'index' operation.

4. Editor saves the file buffer.
   Editor sends 'remove overlay command'.
   Server removes all the scheduled notification and index operations for the file.
   Server notices that there is no real change for the file, so the is nothing to do.
   But it still reschedules notifications, because the client might have lost some information.

5. Notifications are resent, but indexing is not performed.

  So, the solution is to reschedule indexing operation.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org//958373003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44111 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-28 01:34:56 +00:00
danrubel@google.com a2baa0f2ba remove unused imports
BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org//962323002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44104 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-27 21:09:29 +00:00
scheglov@google.com 8655d606da Fix for the change/save/undo race condition.
As we found out, it is not safe to compare file modification times.
On some OSs, such as OSX with its HFS+ file modification time accuracy is just 1 second,
and it is quite possible that a file is modified more than once in 1 second.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org//961823004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44080 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-26 22:32:49 +00:00
danrubel@google.com 10be2665af (TBR) fix PubPackageMapProvider to use resourceProvider context for path
BUG=

Review URL: https://codereview.chromium.org//966453002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44072 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-26 20:18:15 +00:00
brianwilkerson@google.com 5a4919c270 Add instrumentation (issue 22572)
R=paulberry@google.com

Review URL: https://codereview.chromium.org//956103002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44071 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-26 19:54:36 +00:00
danrubel@google.com 6a90488fc8 cache pub list results
BUG=
R=paulberry@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org//941883002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44062 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-26 17:24:08 +00:00
paulberry@google.com 1af1d868bd Use an interning table to compare and hash FileBasedSource objects.
Speeds up analysis by about 8%.

Note: the interning table uses both the file path and the URI to
distinguish FileBasedSource objects.  This should eliminate the
strange behaviors we would see in the rare case where a single URI
would get associated with multiple file paths (see dartbug.com/22555).

The interning table is never flushed over the lifetime of the
application.  In practice this should not be a problem, because it
only contains one entry per filename/URI, and the total number of
filenames/URIs analyzed during the course of execution should always
be small.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//954063002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44026 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-25 18:10:59 +00:00
paulberry@google.com 88e19fcb6e When converting files to package URI's, favor longer directory matches.
Longer directory matches in mean that the relative path part of
the package URI will be shorter, making it more likely to match
user intent.

R=scheglov@google.com

Review URL: https://codereview.chromium.org//953863004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44025 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-25 18:04:09 +00:00
brianwilkerson@google.com bb2b7ee9bb Fix for issue 22560
R=scheglov@google.com

Review URL: https://codereview.chromium.org//950303004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44014 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-25 01:46:25 +00:00
scheglov@google.com 209fcdf1d7 Merge notifications computing into the 'notices' tag.
Also cover incremental analysis with its own tag.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org//956623006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44013 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-25 01:42:26 +00:00
paulberry@google.com ba818ae5e1 Add more user tags to help trackdown analysis server perf bottlenecks.
R=danrubel@google.com

Review URL: https://codereview.chromium.org//928073003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44008 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-24 22:59:34 +00:00
scheglov@google.com 9581e77f58 Replace try/finally with PerformanceTag.makeCurrentWhile().
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//954013002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44004 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-24 22:33:55 +00:00
paulberry@google.com 2b6e5b5f68 When translating from file to URI, make sure translation is reversible.
BUG=dartbug.com/22555
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//935453007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44003 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-24 22:15:39 +00:00
scheglov@google.com 12ccb77c10 Add more performance tags.
This reduces amount of "unknown" time to less than 1%.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//951423002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44000 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-24 21:47:09 +00:00
brianwilkerson@google.com eeb22c5ec2 Improved doc comments
R=scheglov@google.com

Review URL: https://codereview.chromium.org//955683003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43999 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-24 21:45:10 +00:00
brianwilkerson@google.com 12d8bfb8e3 Use direct lookup rather than iteration
R=scheglov@google.com

Review URL: https://codereview.chromium.org//952913003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43996 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-24 20:10:00 +00:00
brianwilkerson@google.com 66ec79e750 Fix exception handling
R=scheglov@google.com

Review URL: https://codereview.chromium.org//952013003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43995 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-24 20:01:51 +00:00
paulberry@google.com d63cdb0c78 Fix a hint in resolver.dart.
R=scheglov@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org//951543003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43970 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-23 18:44:52 +00:00
scheglov@google.com 279bdb7ec0 Add File.modificationStamp accessor.
Dan, I noticed that you're using createSource().modification stamp to access this information.
So, we need a more direct way to get it.

R=brianwilkerson@google.com, danrubel@google.com
BUG=

Review URL: https://codereview.chromium.org//940313003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43968 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-23 18:40:09 +00:00
brianwilkerson@google.com 54bf758021 Fix issue 22525
R=scheglov@google.com

Review URL: https://codereview.chromium.org//950613003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43960 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-23 16:16:49 +00:00
sigmund@google.com f2ccdbd73d Minor changes in analyzer to make it easier to extend
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//924943010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43934 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-20 22:23:27 +00:00
scheglov@google.com 4da5931086 Fix for filtering unknown options.
R=brianwilkerson@google.com, jwren@google.com
BUG=

Review URL: https://codereview.chromium.org//944073003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43933 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-20 22:12:03 +00:00
scheglov@google.com 946d56198e Fix for searching constructor references.
Currently we record constructor declarations and SearchEngine returns them as "references".
But it is not quite a reference, and it is used only as a way to get name range.

With this change to ConstructorElement we don't need to have these artificial references.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//946023003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43932 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-20 22:10:30 +00:00
jwren@google.com bbc11c6640 Add ignore-unrecognized-flags as an option to the command line options of analysis server
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//940093003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43920 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-20 17:19:53 +00:00
paulberry@google.com c845e7cd9a Change equality comparison for FileBasedSource to use URI.
Previously, we considered two FileBasedSources to be equal if they
referred to the same file.  As a result, if a given file was
accessible via multiple URI's, only one cache entry would be created
for the file and we would only resolve it once; the elements created
by resolution would be nondeterministic, they would refer to the file
via whatever source happened to be used to analyze it first.  Worse
yet, incremental analysis might cause some of the elements in the file
to later be replaced by elements that would refer to the file via a
different source, resulting in confusing errors.

BUG=dartbug.com/22030
R=scheglov@google.com

Review URL: https://codereview.chromium.org//944493002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43888 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-19 19:15:50 +00:00
scheglov@google.com 4e7ecb1103 Issue 22409. Restore recognizing string concatenation in const expressions.
R=brianwilkerson@google.com
BUG= https://code.google.com/p/dart/issues/detail?id=22409
     https://code.google.com/p/dart/issues/detail?id=21000

Review URL: https://codereview.chromium.org//940853002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43879 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-19 15:35:54 +00:00
scheglov@google.com eb3c24c089 Mask ResolvableLibrary hashCode.
We create these objects often, so in theory we may overflowing the smi limit.
I wonder if extracting a mixin would be as effective and help to share code.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//936823002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43852 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-18 19:43:36 +00:00
scheglov@google.com 4e34c0d247 Generate artificial hashCode for often used classes.
By avoiding calling Object.hashCode we analyze about 1% faster.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org//934113002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43832 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-18 01:12:43 +00:00