Commit Graph

1931 Commits

Author SHA1 Message Date
John Messerly 395e5c5b5e fix sdk dir detection on mac
the homebrew version of Dart symlinks the SDK, now it can follow links like the dartanalyzer shell script can

R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/126007014
2014-12-03 13:21:09 -08:00
Sigmund Cherem 21b9d6e6b3 fix analyzer warnings
R=jmesserly@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/119477013
2014-12-02 15:23:16 -08:00
Vijay Menon e6b1853c40 Flesh out more codegen
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/126787013
2014-12-02 09:02:17 -08:00
Vijay Menon a8897199fe Cleanly separate static errors and conversions
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/126757013
2014-12-01 13:21:50 -08:00
Sigmund Cherem 89d3081aef Add unitttest for the program checker
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/122177013
2014-12-01 12:27:54 -08:00
Vijay Menon 4223070e23 Fix subtyping bug on Function
This fixes a bug on when the checker is run on itself.

R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/124057013
2014-11-26 11:21:03 -08:00
Vijay Menon 75530c08c9 Fix for return type handling
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/119237013
2014-11-26 08:12:10 -08:00
Vijay Menon 436c1f5448 Allow checks against dynamic
This allows "x as dynamic".  Seems to be no reason to disallow this.

R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/126607013
2014-11-25 20:55:59 -08:00
Sigmund Cherem a8a7297e19 Another fix: resolve on every compilation unit.
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/116577014
2014-11-25 14:23:11 -08:00
Sigmund Cherem d2a729cd68 Run resolver on every library, as we walk through them
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/115197015
2014-11-25 12:54:37 -08:00
Vijay Menon 2875cce4b3 Add support for ground type checks
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/121057013
2014-11-25 09:01:06 -08:00
Vijay Menon 08c74219d4 A couple fixes
- Handle expression returns (=>) in method declarations.
- Handle library prefixes.

R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/117557013
2014-11-25 08:47:35 -08:00
Vijay Menon f5cbd804dd Check return types
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/118587013
2014-11-21 16:24:47 -08:00
Vijay Menon fb69de4769 Fix analyzer error
Caught by run.sh.

R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/123877013
2014-11-21 14:34:23 -08:00
Sigmund Cherem 971e551b6d Use analyzer as a library, enable mock sdks, refactor to start testing
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/118577013
2014-11-21 14:24:06 -08:00
Vijay Menon 9da00a7add Add reporting of unimplemented conversions in generated code
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/122037013
2014-11-21 13:52:10 -08:00
Vijay Menon 2116aa559b transitive inference test
We're currently getting the first var, but somehow not transitively.  If d1 is explicit typed, we don't see these dynamic invokes:

> dart ./bin/checker.dart -l info -o out tests/transitiveinfertest.dart
No issues found
#1: line 21, column 9 of tests/transitiveinfertest.dart: d1.c.b.a.x requires dynamic invoke
  print(d1.c.b.a.x);
        ^^^^^^^^^^
#2: line 21, column 9 of tests/transitiveinfertest.dart: d1.c.b.a requires dynamic invoke
  print(d1.c.b.a.x);
        ^^^^^^^^
#3: line 21, column 9 of tests/transitiveinfertest.dart: d1.c.b requires dynamic invoke
  print(d1.c.b.a.x);
        ^^^^^^

R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/120937013
2014-11-21 13:48:40 -08:00
Sigmund Cherem 61b6c38f54 Infer type of local variables
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/121947014
2014-11-20 20:01:36 -08:00
Sigmund Cherem 688e45550f Fixing analyzer warnings 2014-11-20 18:09:17 -08:00
Sigmund Cherem 210b2246b8 Add missing import in codegenerator 2014-11-20 18:04:07 -08:00
Sigmund Cherem fa21bb85fa Add missing imports - fixes the checker in checked mode
Review URL: https://chromereviews.googleplex.com/119987013
2014-11-20 17:58:33 -08:00
Sigmund Cherem 4c67c961ff All minor nits: split some files up, fix comments in walker to remove references
to spec, make them more darty, run formatter on the rest of the files

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/117397013
2014-11-20 15:36:20 -08:00
Sigmund Cherem 560aa1f632 Fix span location to skip comments
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/120837013
2014-11-20 13:00:08 -08:00
Vijay Menon 8522221df4 Initial codegen skeleton
Invoke with:
> dart bin/checker.dart -o out tests/fieldtest.dart

Run with (node.js installed):
> node runtime/run.js runtime/dart_runtime.js runtime/dart_core.js out/fieldtest/fieldtest.dart.js fieldtest

Here's the output of fieldtest.dart.js:

var fieldtest;
(function (fieldtest) {
  // Class A
  var A = (function () {
    var _initializer = (function (_this) {
      _this.x = 42;
    });
    function A() {
      _initializer(this);
    }
    return A;
  })();
  fieldtest.A = A;

  // Function foo: (A) → void
  function foo(a) {
    dart_core.print(a.x);
  }
  fieldtest.foo = foo;

  // Function bar: (dynamic) → void
  function bar(a) {
    dart_core.print(dart_runtime.dload(a, "x"));
  }
  fieldtest.bar = bar;

  // Function main: () → void
  function main() {
    var a = new A();
    fieldtest.foo(a);
    fieldtest.bar(a);
  }
  fieldtest.main = main;

})(fieldtest || (fieldtest = {}));

R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/119897013
2014-11-20 12:15:55 -08:00
Vijay Menon d56614566e Fix style
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/118277014
2014-11-18 15:10:04 -08:00
Vijay Menon c298d19d4b Add flag to check sdk code
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/119797013
2014-11-18 09:20:32 -08:00
Sigmund Cherem e1bb7d5807 Minor code-style tweaks in lib/typechecker.dart using the formatter. I mainly
run the tool, but I added a couple extra things either to comply with our style
or to help the formatter. I filed bugs for the cases were the formatter didn't
do what I expected.

BUG=
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/117277013
2014-11-17 18:18:48 -08:00
Sigmund Cherem 411efe695c Use source spans for error messages. This will print error messages in red and
highlight the area of the original source that had the error.

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/122637013
2014-11-17 17:58:13 -08:00
Vijay Menon f4466d9b8b Add codereview.settings
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/118827013
2014-11-17 15:31:06 -08:00
Vijay Menon 3f27060ad6 Initial checker 2014-11-17 08:50:19 -08:00
vsmenon d513d77eff Initial commit 2014-11-17 08:02:35 -08:00