Commit Graph

1367 Commits

Author SHA1 Message Date
John Messerly bc4e0f2a38 fixes #6, refactor to use AnalysisError/Listener throughout dev_compiler
Main goal here was to get rid of the enter/exit compilation unit tracking, to allow further Compiler/Server refactoring. We can get the Uri/LineInfo/contents off Source, which AnalysisError already has
SummaryReporter is now fairly generic.

TODOs for the future:
* figure out what to do about ErrorCodes, in particular dev_compiler prefix feels off.
* skip the intermediate StaticInfo types? They're really just builders now for AnalysisError.
* don't classify all existing messages as "AnalyzerError" ... just print them ...
* skip logger. For our command line program, stdout is part of its "API", IMO it shouldn't use logging for those messages. Consider Pub, which uses stdout/err for its messages, and uses logging for more detailed troubleshooting.

R=pquitslund@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/1230903002.
2015-07-10 10:15:08 -07:00
John Messerly f17187f3aa fix for 1.12.0-dev SDK and 0.25.1 analyzer breaking changes
unfortunately we can't run on stable anymore

R=vsm@google.com

Review URL: https://codereview.chromium.org/1228063003.
2015-07-09 10:11:32 -07:00
Vijay Menon a68fa599f3 Option to disable message widget
R=leafp@google.com

Review URL: https://codereview.chromium.org/1213233006.
2015-06-30 16:40:20 -07:00
John Messerly 98d14b14da initial sync*, part of #221
Right now it maps straight to ES6 generators. This should handle some basic cases, but there's more work to get all of the corners working. For example: it doesn't implement Iterable yet.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1207313002.
2015-06-26 16:02:30 -07:00
Vijay Menon 7837d31936 Fixes #246
Type checks await

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1209413002.
2015-06-26 09:59:43 -07:00
John Messerly c2e65df22c fixes #168, dart:js implementation with a test
R=vsm@google.com

Review URL: https://codereview.chromium.org/1200233004.
2015-06-25 13:18:52 -07:00
John Messerly b9e48a6616 fixes #232, handling of arguments
our renamer wasn't trusting the JS builtin to use arguments correctly :)
incidentally, this does the final step in making the renamer precise: it tracks all renames per-scope now. In practice this was almost never hit except for "arguments" though.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1200243002.
2015-06-23 13:35:39 -07:00
Vijay Menon 4bb9fdce71 Fixes #151
Type check async-return, async*-yield, and sync*-yield.

R=leafp@google.com

Review URL: https://codereview.chromium.org/1190413005.
2015-06-22 10:22:23 -07:00
John Messerly 9b1ad9cf1a fixes #231, mixin application (aka ClassTypeAlias) implicit ctors
R=vsm@google.com

Review URL: https://codereview.chromium.org/1193083002.
2015-06-22 08:55:56 -07:00
Leaf Petersen 4e7920c487 Handle dynamic as bottom inside of function type reps.
This changes the way we handle dynamic at runtime to be more correct and cleaner.  We now simply emit dynamic as dynamic instead of as core.Object.  There are now two ways to construct a function type: one can construct a fuzzy function type (the default), or a definite function type.  The constructor for a fuzzy function type replaces all uses of dynamic with bottom.  This function type is used for all type annotations.  Definite function types do not replace dynamic with bottom.  These only occur as the runtime type of actual functions, for which we really know the type. Because we now eagerly sort this out when we create the function type, the subtyping code doesn't need to deal with this.

This allows some additional subtyping: closures which actually are typed to take dynamic would previously not have been allowed to be cast to something with a concrete argument type.  Now this is allowed (see the change in runtime_tests.js for an example of this).

This fixes #107.

BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1195523002
2015-06-17 16:46:38 -07:00
John Messerly de6df99db0 fixes #226 super == and fixes #227 escape \r \f
R=vsm@google.com

Review URL: https://codereview.chromium.org/1183453005.
2015-06-16 16:52:32 -07:00
John Messerly 7d8b38a236 js_ast: implement rest/spread parsing
R=vsm@google.com

Review URL: https://codereview.chromium.org/1183033004.
2015-06-16 16:10:05 -07:00
Vijay Menon 4c9fb31e35 Fix multipackage resolver paths
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1187163003
2015-06-16 13:15:22 -07:00
Vijay Menon d48b153193 dart:mirrors
This is a very bare bones version - just enough to get angular running.

See #199

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1186683005.
2015-06-15 16:22:54 -07:00
John Messerly b769aa5fbc fixes #25, most analyzer errors were not computed
It helps to call computeErrors ;)

R=vsm@google.com

Review URL: https://codereview.chromium.org/1183733004.
2015-06-15 08:55:59 -07:00
John Messerly d1a4c5dc94 first step for #168, adds dart:js impl to the build
the code most likely does not work yet. But this gets it in so we can iterate more easily, from a clean baseline.

R=jacobr@google.com

Review URL: https://codereview.chromium.org/1179643005.
2015-06-12 15:17:38 -07:00
John Messerly 86c5ee932d fixes #192, encode dynamic info in checker
fixes a checker bug too: it wasn't working properly for cascade targets. Previously this caught #202 and #206 as well.

R=leafp@google.com

Review URL: https://codereview.chromium.org/1184843002.
2015-06-12 13:39:41 -07:00
Leaf Petersen b9c83e0013 Most of this CL just re-organizes the runtime code into multiple sub-libraries. js_utils and loader remain as top level symbols (the former so that it has no dependencies, the latter since it defines the module system that the rest use).
The dart runtime files are roughly split around functional boundaries.  Comments at the top of each file describe the function of the library.  I'm not sure that these are 100% right yet, but they're closer.  We may want to iterate on the organization.

The main dart runtime file just re-exports various symbols from the sub-libraries.  It has hard dependencies on the other runtime files, some of which have soft (lazy) dependencies on SDK files.  The generated code now depends on dart and dartx as a imported libraries, rather than as top level symbols.

This CL also includes some new code to make type representations a bit better.  This is mostly in the new types.js file, which makes all of the non-instance types (dynamic, bottom, void, function types) subtypes of a common representation type.  Among other things, they now have the correct runtime type (core.Type).  Some of the type code has been rationalized around this a bit, but there is more left to do here.  The setSignature code in classes.js now also places the correct runtime type on nominal (instance) types.  There are new tests in the runtime_tests.js file to test for this.

The static object method code that implements the Object methods has not yet been updated to dispatch on type representations.  I will do that in a separate CL.

BUG=
R=jmesserly@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/1182653002
2015-06-12 13:34:39 -07:00
Vijay Menon 4be334a923 Fix runtime ordering and other minor fixes
Other than mirrors (coming next :-)), this gets angular todo running.

R=leafp@google.com

Review URL: https://codereview.chromium.org/1177253002.
2015-06-11 11:06:49 -07:00
Vijay Menon 9c77254a27 Clean up runtime type code
R=leafp@google.com

Review URL: https://codereview.chromium.org/1177233004.
2015-06-11 09:41:18 -07:00
John Messerly 8f4db8f514 expose strong checker API, for use by analyzer_cli
most of the changes here are around making options sane(r), which fixes #204

R=vsm@google.com

Review URL: https://codereview.chromium.org/1174643003.
2015-06-11 07:47:12 -07:00
John Messerly b62fdb577d fixes #217, Object members on extension types
R=vsm@google.com

Review URL: https://codereview.chromium.org/1173023004.
2015-06-10 13:52:18 -07:00
John Messerly e7a5cc36ef fixes #216, JSNumber members
R=vsm@google.com

Review URL: https://codereview.chromium.org/1173903003.
2015-06-10 13:46:44 -07:00
John Messerly 86a8ac2b0c fix #214, check type of inferred initializing formal with default value
Analyzer does this inference (probably from spec?) very early in the compilation.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1180513002.
2015-06-10 12:59:55 -07:00
John Messerly d52346c201 fixes #215, removes special case for length
R=vsm@google.com

Review URL: https://codereview.chromium.org/1178523004.
2015-06-10 12:21:49 -07:00
John Messerly c7b3846d8e fixes detection of SDK libraries
R=vsm@google.com

Review URL: https://codereview.chromium.org/1170813008.
2015-06-10 09:59:18 -07:00
Olivier Chafik d159b6ee79 Fix dart.equals("10", 10) (issue #210)
See doc on == vs. === : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators
Note that the `== null` tests in the same function are probably preferable to `=== null` if both undefined and null values can be encountered.
2015-06-10 15:31:59 +01:00
Vijay Menon 321be0a426 Generate metadata
Fixes #198

BUG=https://github.com/dart-lang/dev_compiler/issues/198
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1177563003.
2015-06-10 06:28:33 -07:00
Vijay Menon 5ff3864a18 Load on demand
This fixes ordering issues.

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1171843002
2015-06-09 08:05:26 -07:00
John Messerly 023bfc087d remove ignoreTypes flag, it doesn't work, see #134
If we wanted to bring this back, we should implement it differently, IMO
Instead simply replace all type annotations with `dynamic`

R=vsm@google.com

Review URL: https://codereview.chromium.org/1163393002
2015-06-08 16:57:24 -07:00
John Messerly 20d14a610c fixes #209, remove tree mutation from CodeChecker
R=vsm@google.com

Review URL: https://codereview.chromium.org/1172453002
2015-06-08 16:52:01 -07:00
John Messerly a5132e6436 remove covariant generics option
Thoughts? Seems unlikely we'll go with invariant at this point.
I'd like to see covariant generics go, but it seems we need variance annotations of some sort before that becomes realistic. (e.g. Iterable is used all over the place)

R=leafp@google.com

Review URL: https://codereview.chromium.org/1165303002
2015-06-08 14:35:56 -07:00
John Messerly 73be4cab48 remove ClosureWrap option and related implementation
Vijay thought that we don't need this anymore, as we decided not to wrap.

R=leafp@google.com

Review URL: https://codereview.chromium.org/1171713002
2015-06-08 14:32:42 -07:00
John Messerly d88c36af77 remove unused allowConstCast option
this was for the Dart backend?

R=vsm@google.com

Review URL: https://codereview.chromium.org/1166163002
2015-06-08 13:19:06 -07:00
John Messerly cce21a4991 dead code elimination in reify_coercions
with the removal of dart backend, we don't need support for _runtime

R=leafp@google.com

Review URL: https://codereview.chromium.org/1169873002
2015-06-08 13:17:00 -07:00
Vijay Menon c139653fcb Check for duplicate library names
This bites us on Angular - dart:collection and angular's collection
(facade) lib smash on top of each other, silently causing issues.

We'll need a better naming convention - perhaps we should use the lib
name and require uniqueness.

Fixes #208

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1145243013
2015-06-05 16:34:10 -07:00
John Messerly a7adab29fa fixes browser/runtime_test, and a few of extension member fixes
* fixes generic List. Because generic arrays have the proto of JSArray, which itself extends Array, we need to make sure we don't override members from Array.

* fixes tear offs, they were not preserving type signatures in some cases. This doesn't change how we store signatures, but perhaps something we could consider, to make this bug less likely.

* the defineExtensionMembers call was not getting emitted unless the type implemented at least one interface.

R=leafp@google.com

Review URL: https://codereview.chromium.org/1156273010
2015-06-05 16:22:37 -07:00
John Messerly cac786f671 fixes #173, ability to use native JS indexers
dom_experimental could opt-in to use this

R=jacobr@google.com

Review URL: https://codereview.chromium.org/1145833004
2015-06-05 12:14:09 -07:00
John Messerly 89b3d920d6 fixes #206, add checking for unary ops
fixes #207, checking for boolean conversions

R=leafp@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/1147143007
2015-06-05 12:12:27 -07:00
Leaf Petersen 695ae10131 Delete dart2js specific private library code.
This trims out a large chunk of the more obviously dart2js specific stuff from js_helper.dart and its dependencies.

BUG=
R=jmesserly@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/1152333009
2015-06-05 09:52:18 -07:00
John Messerly 6c3cdd707d fixes #40, extension methods for primitive types
fixes #138, extension methods for Iterable/List injected as needed, regardless of how the methods started

fixes #142, extension methods and dynamic dispatch

small change that fixes #139, recognize that '.length' doesn't need an extension method

Also restores JSArray, moved the methods out of List, which is back to just being an interface.

NOTE: this removes the capability of types that mix native JS members and some Dart extension members, instead it now *hides* all JS members for these native types. We'll want to bring that feature back to support dart:html, so it's just a simplification for now. Should be easy to add that capability when we pull in dart:html for reals.

R=leafp@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/1153003003
2015-06-04 14:58:18 -07:00
Vijay Menon 4aaeaf6125 Remove dart backend
Fixes #205

R=jmesserly@google.com, leafp@google.com

Review URL: https://codereview.chromium.org/1148283010
2015-06-03 14:01:28 -07:00
John Messerly 2722aed77e fixes #201, add support for custom URL mapping
R=vsm@google.com

Review URL: https://codereview.chromium.org/1150143006
2015-06-03 09:40:48 -07:00
John Messerly 85242175d4 fixes #202, check IndexExpression
R=leafp@google.com

Review URL: https://codereview.chromium.org/1160673003
2015-06-02 17:10:43 -07:00
John Messerly 8865229d8d fixes #200, library prefixes for unknown imports
Take 2. The first version passed checker_test but not inferred_type_test. The library prefix staticElement check needs to come first.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1161603009
2015-06-02 17:06:04 -07:00
John Messerly 33eee25590 fixes #43, remove => workaround
R=leafp@google.com

Review URL: https://codereview.chromium.org/1169473003
2015-06-02 16:30:23 -07:00
John Messerly 145656318a Revert "fixes #200, library prefixes for unknown imports"
This reverts commit 026a4921957ee08f011eabf1c3deea6c5e8aa715.

BUG=

Review URL: https://codereview.chromium.org/1159013009
2015-06-02 13:23:26 -07:00
John Messerly f6a2ec274a fixes #200, library prefixes for unknown imports
R=vsm@google.com

Review URL: https://codereview.chromium.org/1165823002
2015-06-02 13:21:24 -07:00
Vijay Menon c6ecb1df15 Fix DDC errors on DDC
Eating our own dogfood...

Some errors still in upstream packages, but this doesn't count Paul's recent CL.

> dart -c bin/devc.dart -i bin/devc.dart

package         AE   IMO  IRCE   STE     LOC
analyzer         0    10     0    12  111627
shelf            0     0     1     0    1415
http_parser      0     1     1     0    1473
source_span      2     0     0     0     708
yaml             7     5     0     1    3850
dart_style       2     0     0     0    4577
html             0    14     1   108   12307
csslib           3     0     0     6   10227
utf              0     0     0     2    1516
------------ ----- ----- ----- ----- -------
package         AE   IMO  IRCE   STE     LOC
total           14    30     3   129  175897
%             0.01  0.02  0.00  0.07     100

Where:
  AE:   AnalyzerError
  IMO:  InvalidMethodOverride
  IRCE: InvalidRuntimeCheckError
  STE:  StaticTypeError
  LOC:  LinesOfCode

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1160223006
2015-06-01 17:02:18 -07:00
John Messerly 9a95d18c13 fixes #182, avoid injecting a duplicate link rel=stylesheet
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1145893008
2015-06-01 16:54:01 -07:00