Commit Graph

57 Commits

Author SHA1 Message Date
Vyacheslav Egorov 4e7a31262e Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork."
This relands commit 2fed1c3905 with fixes to ensure that analyzer summaries are correctly created and XARM build does not try to use target binaries on the host.

R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2453773002 .
2016-10-26 16:48:28 +02:00
Vyacheslav Egorov cf7ff42e60 Revert "Merge more Kernel infrastructure from kernel_sdk SDK fork."
This reverts commit 2fed1c3905.

SDK builds are failing

TBR=zra@google.com

Review URL: https://codereview.chromium.org/2455593002 .
2016-10-26 13:06:27 +02:00
Vyacheslav Egorov 2fed1c3905 Merge more Kernel infrastructure from kernel_sdk SDK fork.
- bring patched SDK generation scripts and VM patch tweaks that allow VM patch files to be parsed by analyzer front-end;
  Patched SDK is an SDK with all VM patches spliced into it. Kernel compiler is based on the analyzer front-end which does
  not have any patch files support/model so for it to produce Kernel files that match VM we need to generate a such patched SDKs.

- bring test script modifications that allow to test Kernel pipeline

BUG=
R=asiva@google.com, kmillikin@google.com, whesse@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2434123003 .
2016-10-26 13:02:54 +02:00
John McCutchan 7fd9df4d91 Improvements to NoSuchMethodError.toString
This makes the following improvements:

* Always show the call that was made, with arguments.
* ...and show the actual arguments in more cases.
* Be less confusing in the case of a call on the null receiver.
* Be less redundant in the output.
* Report when a constructor is called with the wrong number of arguments.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2405353002 .
2016-10-12 09:52:51 -07:00
Matthias Hausner 3e0d13bc28 Make compile-time errors catchable
If an error happens during the compilation of a function body, an Error is thrown which can be intercepted, and ensures that finally blocks are executed before the isolate is terminated.

The language spec is vague about compilation errors. A doc describing the intentions behind this CL is at
https://docs.google.com/document/d/1_MWOgwJadLCQSBps0zD6Rj5dG4iP1UBuiDvTMH-WMzI/edit#

Example:
     1	void bad() {
     2	    return 5
     3	}
     4
     5	void main(args) {
     6	    bad();
     7	}

Before this CL:
$ dart ~/tmp/e.dart
'file:///Users/hausner/tmp/e.dart': error: line 2 pos 11: semicolon expected
  return 5
          ^
$

After this change:
$ dart ~/tmp/e.dart
Unhandled exception:
'file:///Users/hausner/tmp/e.dart': error: line 2 pos 11: semicolon expected
  return 5
          ^

#0      main (file:///Users/hausner/tmp/e.dart:6:3)
#1      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:259)
#2      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
$

Notice that the stack trace points to the call site of bad(), not the text location of the syntax error. That's not a bug. The location of the syntax error is given in the error message.

BUG= https://github.com/dart-lang/sdk/issues/23684
R=asiva@google.com, lrn@google.com

Review URL: https://codereview.chromium.org/2044753002 .
2016-09-16 10:10:38 -07:00
Lasse R.H. Nielsen 99439a336a See: https://docs.google.com/document/d/1iEuLbDMgbB657R5aFj9EfnT6B0obzQk93Of7CfWKc00/edit#heading=h.9ixvz54wwawi
Implement assert in initializer list in VM.

R=hausner@google.com

Review URL: https://codereview.chromium.org/2002923002 .
2016-08-24 12:43:26 +02:00
Matthias Hausner 1a6d1eca32 Implement @patch annotation for patch class members
Allow members of patch classes to be annotated with @patch. The VM
ignores the annotation. I simply replaces the original method
if the name matches, or reports an error if field names match.

Adding a bit is_patched to members to do more checking remains a
TODO. There are currently no unused bits available, and I don’t want
to increase the size of Function objects for this.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2230383003 .
2016-08-10 12:54:57 -07:00
Matthias Hausner e11ca24053 Use metadata annotation @patch for patch classes
Annotate patch classes and top-level patch functions with @patch
instead of the pseudo-keyword patch. This allows the analyzer
to read patch files, and matches the syntax that dart2js uses.

The deprecated syntax is still supported, but a warning is printed when detected.

BUG=

Review URL: https://codereview.chromium.org/2220883004 .
2016-08-09 09:48:03 -07:00
Matthias Hausner 98033d4132 Simplify generated code for assert()
Move the assert condition check and throwing the error into
the Dart library. This eliminates one call to library code.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2073623002 .
2016-06-16 10:44:30 -07:00
Lasse R.H. Nielsen c56411d576 Make VM accept function values in assert statements.
Fix for issue #18454.

BUG= http://dartbug.com/18454

Review URL: https://codereview.chromium.org/2064663002 .
2016-06-15 10:08:39 +02:00
Ivan Posva 3884fd4e4b - Allow for loading dart:html and friends into the standalone
dart_bootstrap binary to evaluate startup and compilation
  performance.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1916793003 .
2016-05-03 20:33:14 -07:00
Regis Crelier ba69c8a898 Enumerate URIs of all types in type errors in order to help the user diagnose
the error (it was previously only printed for types with identical names).
Cleanup and simplify construction of type errors.

R=hausner@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org/1778133002 .
2016-03-09 15:16:47 -08:00
Regis Crelier bb649318e4 Remove support for Javascript warnings in the VM.
This cl is a clone of cl https://codereview.chromium.org/1683363002/ deleted by
accident. Already LGTM'ed.

Review URL: https://codereview.chromium.org/1690903003 .
2016-02-11 09:16:06 -08:00
Srdjan Mitrovic d503d2f0ed Added full deferred loading semantic to precompiled/--noopt/eager-loading code (some corner cases, e.g., compile-time errors for constants, still missing)
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1211273011 .
2015-07-09 10:56:55 -07:00
rmacnak@google.com 327b85d956 Move symbol demangling to dart:_internal to remove dart:core dependency on dart:mirrors.
BUG=
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45405 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-24 17:49:58 +00:00
hausner@google.com 392db8d312 Implement correct semantics of Boolean Conversion
When converting null to a boolean value, throw an AssertionError
rather than a TypeError.

This is the same change as r42145, with added co19 status updates.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42170 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-08 18:51:48 +00:00
hausner@google.com 4cfdf02012 Revert r42145 to fix co19 tests
Review URL: https://codereview.chromium.org//772513003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42148 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-05 21:05:38 +00:00
hausner@google.com ad837a0d9f Implement correct semantics of Boolean Conversion
When converting null to a boolean value, throw an AssertionError
rather than a TypeError.

Fixes issue 21279.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42145 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-05 20:36:37 +00:00
lrn@google.com e8ca26953e Reduce foot-print of Error.safeToString on strings.
Use existing JSON encoding instead of a custom encoding.
This allows dart2js to use the system JSON stringifier directly.

R=sra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41704 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-13 06:47:17 +00:00
iposva@google.com c7c9d5d12f Fix http://dartbug.com/21335
- Make the VM internal AssertionError, TypeError and CastError implement
  the public classes instead of patching them.

R=asiva@google.com, lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41231 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-21 17:00:16 +00:00
rmacnak@google.com da3b61d764 Add missing demangling to the VM's NoSuchMethodError. Ensure the VM's NoSuchMethorErrors for reflective invocation match those for non-reflective invocation.
Fix bug in VM demangling of setters.
Fix bug where test was not covering invocation on classes as intended.

BUG=http://dartbug.com/18042
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37294 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-12 22:53:00 +00:00
regis@google.com dec11d8b7b Add support for javascript incompatibility warnings (work in progress).
For now, warnings are only issued when applicable for type tests, type casts,
and toString.
Fix newly reported lint errors.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36001 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-09 22:42:10 +00:00
hausner@google.com ad3fb79210 Better error message for assignment to final local variables
“No top-level getter found” becomes “cannot assign to final variable xxx”.

Fixes issue 16782.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33028 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-25 18:01:35 +00:00
lrn@google.com 3b3e87cabc Revert "Rename internal library dart:_collection-dev to dart:_internal."
Dartium needs updating too.

Committed: https://code.google.com/p/dart/source/detail?r=31827

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31877 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-16 12:06:38 +00:00
lrn@google.com ead87f47e9 Revert "Rename internal library dart:_collection-dev to dart:_internal."
Dartium needs updating too.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31827 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-15 12:27:44 +00:00
lrn@google.com 0098710559 Rename internal library dart:_collection-dev to dart:_internal.
BUG= http://dartbug.com/14140
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31823 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-15 09:24:46 +00:00
regis@google.com e3da5e16e4 Check type bounds of redirecting factories (issue 14699).
Add tests for malbounded redirecting factories.
Clean up bound checking code and type error reporting code.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30177 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-11 22:59:48 +00:00
regis@google.com 3fa7a61efc Implement latest spec changes regarding malformed types (see issue 14006):
- a malformed type used in a is, as, or catch type test results in a dynamic
  type error being thrown.
- a malformed type is not mapped to dynamic anymore.

For now, this applies to type tests in checked mode as well, but discussion is
still on-going.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29608 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-30 23:30:32 +00:00
hausner@google.com e02652a123 Throw CyclicInitializationError instead of string
For some reason, I had to regenerate the snapshot for test standalone/issue14236_source.dart. The checked-in snapshot crashed with my change. We don't know yet why. Siva is looking at this separately.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29397 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-28 21:38:57 +00:00
iposva@google.com d369b7a0c9 - Ensure that the token stream from generated source matches the
original token stream in the presence of combinations of
  multiline string and string interpolation. If not this will
  cause mismatches when accessing code snippets, e.g when
  reporting parser errors or assertions.
- Ensure that ScanAll and ScanTo are in sync when adding or
  counting tokens.
- Added unit test for multiline strings and interpolation.
- Expanded GenerateSource unit test to iterate through all
  loaded libraries.
- Do not report columns for compilation errors in snapshotted
  code.
- Do not report columns from exceptions and errors when dealing
  with snapshotted code.
- Remove length field from TokenDescriptor. It was unused.
- Remove TokenStream::ComputeTokenPosition. It was unused.

R=fschneider@google.com, hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29110 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-23 19:08:36 +00:00
regis@google.com 9ec07853c5 Report correct error message in case of super invocation (fix issue 8208).
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29042 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-22 22:12:07 +00:00
regis@google.com 5a5edb7f0c Report use of malbounded interface in type test.
Fix language tests related to malbounded types (issues 14123, 14131, 14132).

R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28943 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-21 19:49:19 +00:00
hausner@google.com 3c360399ee Improve NoSuchMethodError error messages
- Don't say there is no constructor with name X if there is one
  that has incompatible parameter list.
- Better error message when mismatched optional parameters are passed.
  (Prviously only the number of parameters was considered, but not
  names of named parameters for example.)

Fixes issue 6189.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27826 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-24 16:14:28 +00:00
lrn@google.com 8d66e5d8de Fix error message for NoSuchMethodError to not contain "Symbol".
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27004 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-02 09:33:37 +00:00
lrn@google.com 53dc9ba034 Change the field and constructor parameter types of NoSuchMethodError to Symbol.
The NSME uses strings for names. It should use symbols.

This change modifies the VM libraries only enough to make the signature change
not crash. It will probably need cleanup to ensure that symbols are passed
to the internal constructor directly, instead of strings that have to be
converted.

(Also fixes a type error in Map.fromIterable that was hit by the code).

BUG= http://dartbug.com/11190
R=ahe@google.com, regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26985 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-02 05:57:49 +00:00
regis@google.com 09bcdc6d6d Fix VM implementation of CastError not to extend TypeError (issue 5280).
Remove non-compliant fields in various Error classes (issue 10144).
Remove implicit constructor when patching in a constructor (issue 12217).
Patch corelib Error classes instead of declaring subclasses.
Update tests and status files.

R=asiva@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25782 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-05 18:35:04 +00:00
zra@google.com 42add423d2 Fixes javascript integer overflow check.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25675 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-31 17:51:23 +00:00
asiva@google.com dcb6850f87 Fix for issue 11680
- implicitly store a full stack trace in Error objects when they are thrown.
- the shlFromInt on Mints and Bigints was trying to allocate a new OutOfMemory
  exception objects instead of using the pre-allocated exception object.
  Made the implementation of these methods native so that they can use the
  pre-allocated object.
- Ensure that it is not possible to allocate new OutOfMemory or StackOverflow
  exception objects.

R=ahe@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25492 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-25 19:28:53 +00:00
rmacnak@google.com 1a0b3c7871 Make reflective invocations raise NoSuchMethodErrors in the cases where non-reflective invocations do so. Resolves issues 11187 and 11957.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25387 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-24 00:29:17 +00:00
floitsch@google.com 06493c3460 Revert "Introduce StackTraceOnThrowMixin."
This reverts commit r24951.

R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25142 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-18 10:39:56 +00:00
floitsch@google.com e5cade9e88 Introduce StackTraceOnThrowMixin.
R=ahe@google.com, lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24951 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-12 15:30:53 +00:00
floitsch@google.com 438767ca3a Add stackTrace to Error object.
BUG=
R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24726 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-03 14:51:30 +00:00
lrn@google.com 64553c2774 Fix expectation for 53-bit-overflow.
Make variable in error private.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24274 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-21 09:11:14 +00:00
lrn@google.com 0c90061029 Move FiftythreeBitOverflowError to VM-only patch file.
The class is not meaningful in the core library, and should go away once
dart2js has integers.

R=floitsch@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24265 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-21 07:31:48 +00:00
srdjan@google.com 706e79d074 Fix error reporting when calling static methods and closures withh mismatched arguments.
Closures BEFORE:
----
Unhandled exception:
Class '(dynamic, dynamic, dynamic) => dynamic' has no instance method 'call'.

NoSuchMethodError : method not found: 'call'
Receiver: Closure: (dynamic, dynamic, dynamic, dynamic) => dynamic from Function 'foo':.
Arguments: [2]

Closures NOW:
----
Closure call with mismatched arguments: function 'A.foo'

NoSuchMethodError: incorrect number of arguments passed to method named 'A.foo'
Receiver: Closure: (dynamic, dynamic, dynamic, dynamic) => dynamic from Function 'foo':.
Tried calling: A.foo(2)
Found: A.foo(a, b, c)


Statics BEFORE:
----
Unhandled exception:
No top-level method 'foo' declared.

NoSuchMethodError : method not found: 'foo'
Receiver: Type: class '::'
Arguments: []

Statics NOW:
----
Unhandled exception:
No top-level method 'foo' with matching arguments declared.

NoSuchMethodError: incorrect number of arguments passed to method named 'foo'
Receiver: top-level
Tried calling: foo(...)
Found: foo(a, b, c)

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22209 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-30 22:05:14 +00:00
iposva@google.com 2fb7cf7220 - Print "top-level" instead of "class '::'" in
NoSuchMethodErrors.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22005 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-25 07:29:06 +00:00
lrn@google.com 844cd39fad Change getRange to sublist. Make getRange deprecated.
This changes the exception behavior of getRange. It used to accept
a length of zero, no matter what start value. Now the start value
must be a valid list index.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20064 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-15 09:15:39 +00:00
floitsch@google.com dd48256fe5 Remove deprecated StringBuffer.add, addAll and addCharCode.
Review URL: https://codereview.chromium.org//12473003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19690 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-08 13:07:18 +00:00
iposva@google.com c900112af7 - Improve the message for NoSuchMethodErrors that are
determined statically at compile time.
Review URL: https://codereview.chromium.org//12328019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18848 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 18:53:27 +00:00
iposva@google.com f6c5bcec42 - Split the implementation of NoSuchMethodError in preparation for
better error messages from the VM.
Review URL: https://codereview.chromium.org//12297010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18614 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-18 07:00:53 +00:00