Commit Graph

1263 Commits

Author SHA1 Message Date
fschneider@google.com 77669aac3e Fix VM issue 1372: super constructor invocation with redirection.
A redirecting super constructor simply passes the phase parameter
on to the target which executes the corresponding phase.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29097 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-23 16:18:20 +00:00
fschneider@google.com a61e701da3 VM: Fix evaluation order when throwing an AbstractClassInstantiationError.
BUG=https://code.google.com/p/dart/issues/detail?id=13420
TEST=Language/12_Expressions/12_Instance_Creation/1_New_A06_t12
R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29088 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-23 15:29:02 +00:00
regis@google.com 3e8c130227 Fix language tests for redirecting factories (issue 14297).
Use target constructor name in redirecting factory errors.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29045 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-22 22:36:42 +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
hausner@google.com e7255e091a Do not generate a compile-time error if there is more than one catch-all clause
This includes catch clauses with malformed types, which are essentially
catch-all clauses.

The spec does not mandate such a compile-time error. (It probably did a long
time ago.)

Fixes issue 8601, 12159, 13019

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28999 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-22 15:44:28 +00:00
hausner@google.com dbe0e4c9b4 Allow string literal concatenation in import clauses
Added benefit: if there is no interpolation in any of the adjacent
string literals, the compiler concatenates the strings without
invoking Dart code.

Fixes issues 12521, 6877

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28964 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-21 22:13:42 +00:00
hausner@google.com 0e099ff048 Check that class member names do not conflict with type parameters
Implement check that member names do not conflict with type
parameters. Simplify name checks in class namespace.
Mark typevariable_mirror_metadata_test as failing now that we
report the proper compile time errors. (The test expects no errors.)
Some co19 tests expect a name conflict between a setter X= and type
parameter X. This is still in flux from a language perspective. This
change list does not introduce an compile error for this case.

Fix for issue 13701.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28808 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-17 17:39:08 +00:00
srdjan@google.com b83bda9e0e Add new style of string interpolation optimization: new nodes, working constant folding.
TODO: partial constant fold of incoming arguments.

R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28741 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-16 18:12:08 +00:00
fschneider@google.com ed801a1b2f VM: Fix bug with evaluation order of static setter invocation.
This fixes the case for an assignment of the form
v=e
where v is unknown. The right-hand side of the assignment
has to be evaluated before throwing a NoSuchMethodError.

I moved the generation of the NoSuchMethodError out of
the parser to the flow-graph builder, where the right-hand side
argument is evaluated before throwing.

BUG=https://code.google.com/p/dart/issues/detail?id=13494
TEST=co19/Language/12_Expressions/18_Assignment_A01_t07
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28723 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-16 13:07:58 +00:00
regis@google.com 2d59eb0cb1 Throw a dynamic type error instead of a CastError in a type cast with a
malbounded type (fix issue 14123).
Regression test is not checked in yet (see https://codereview.chromium.org/27378002/)

R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28698 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-16 00:38:55 +00:00
hausner@google.com c646aed258 Implement new mixin application syntax
Implment the class X = S with M syntax, add warning on deprecated
typedef syntax. Also convert a handful of tests. More tests to
be converted subsequently.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28652 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-15 16:13:02 +00:00
srdjan@google.com 2f0a906dbf Cleanups, refactoring in anticipation of new string interpolation nodes. Removed unnecessary code.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28619 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-14 23:21:52 +00:00
fschneider@google.com d69461ba62 VM: Fix performance regression introduced by r28408.
Change the AST for static consts so that they don't
end up translated as calls, and so that we don't rely
on the inliner to fold them away).

Instead I generate a LoadStatic AST node that will be
constant folded in the flow graph builder.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28521 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-11 15:44:36 +00:00
regis@google.com 15bc5b9a0a Disallow extending a malformed type (issue 13940).
Add language test and update dart2js status (issue 13994 filed).

R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28488 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-10 23:30:42 +00:00
regis@google.com 42ceee4cba Allow malbounded literal types (fix issue 13952).
R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28474 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-10 20:45:09 +00:00
hausner@google.com 5a5850d9d9 Optimize away empty string sections in string interpolation
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28423 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-09 22:05:27 +00:00
rmacnak@google.com 6ed9f2c17f Implement constructor kinds in the VM mirrors.
BUG=http://dartbug.com/13798
R=asiva@google.com, hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28416 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-09 20:40:11 +00:00
hausner@google.com b87ef6ab7f Final variables induce a setter that throws NSME
Clean up handling of const and final variables. They induce a
setter that throws a NSME, rather than a compile-time error.

Delay the AST conversion of loading a const field into loading
the literal value. The conversion is now done when we know
that the load in on the right hand side of an expression.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28408 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-09 17:33:10 +00:00
rmacnak@google.com 41f0d0e0f1 Correctly report the type of initializing formals declared without an explicit type to be the type of the corresponding field.
BUG=http://dartbug.com/11281
R=gbracha@google.com, hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28349 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-08 01:08:59 +00:00
regis@google.com 5e817c182b It is not an error anymore to leave an instance final field uninitialized.
Fix issues 11054 and 12157.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28289 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-04 22:56:53 +00:00
iposva@google.com 3423572926 - Harden coverage generation, by not attempting to compile
un-compilable functions.
- Only register closure functions in the class when they
  have been properly setup.
- Make sure to compile closure functions when calling CompileAll.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28282 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-04 20:50:16 +00:00
hausner@google.com 8fa41d5d55 Compile error on const instance variables
Another little step towards full spec compliance.

Issue 11051

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28234 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-03 18:17:16 +00:00
hausner@google.com 3f238a01a5 Add type check to const conditional expression evaluation
issue 13746

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28182 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-02 21:08:24 +00:00
hausner@google.com 1ea4547a96 Disallow double in case clauses and const map literal keys
Implements the latest Spec decisions and clarifications.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28104 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-01 17:22:39 +00:00
fschneider@google.com a329b0e6bc Dart VM: Simplify code generation for equality operators.
By inserting the necessary checks for null inside the callee
at the AST level, the code generation of == operations can be
greatly simplified.

This is a performance-neutral change and a step for allowing
generic inlining of arbitrary == methods. So far we could only
inline them for a common set of types in the flow graph
optimizer.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28084 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-01 10:10:50 +00:00
hausner@google.com fcb84c8dc9 Fix expression evaluation in library context
- Use correct source for patch functions when class
  finalizer reports error
- Reinstate support for class in Dart_EvaluateExpr

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28064 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-30 18:49:32 +00:00
hausner@google.com b7dbaaa46c Slight optimization of case clause type checks
Address review comment.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28015 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-27 16:40:33 +00:00
regis@google.com 6531272706 Support forwarding constructors for mixin typedefs (issue 11888).
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27979 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-27 00:26:22 +00:00
hausner@google.com b0780d316b Check types of case expressions
Implement checks to make sure all case expressions are of the same type and other restrictions.

This change assumes that it's ok to use double values in switch expressions. Will verify with those who are in the know.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27968 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-26 18:54:15 +00:00
hausner@google.com 1c5c3d55c4 Eliminate legacy support for throw without expression.
Issue 13533.

R=mlippautz@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27856 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-24 22:16: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
regis@google.com 3b5628fd1b Support mixin application typedef as mixin in the VM (issues 9383, 12773).
Disallow Object as mixin (issue 10952).
Detect illegal cycles in mixins.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27791 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-24 00:25:01 +00:00
hausner@google.com 257535165e Properly parse symbol literals in top-level expression
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27682 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-20 00:12:55 +00:00
hausner@google.com aeb3386956 Fix function type parameter parsing
Corner case of final variables was wrong. In most cases, this went undetected because of the permissive type system of dart.

Fixes issue 13367.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27678 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-19 22:02:45 +00:00
mlippautz@google.com 4fa46b7148 Introduce newline tokens into the token stream.
CL only introduces the tokens into the compressed token stream. We do not
use the newline tokens (yet).

Overhead:
snapshot: 6.4% (860k/808k)
compressed token stream (gen_snapshot): 21% (314312/259907)

BUG=
R=asiva@google.com, hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27677 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-19 21:46:50 +00:00
hausner@google.com f3baeeb6a5 Implement symbol literals in the VM compiler
Issue 12171

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27668 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-19 17:39:16 +00:00
hausner@google.com cda093e7e0 Fix redirecting constructors
Field initializer expressions must not be executed in redirecting
constructors.

Fixes issue 13347

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27628 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-18 16:02:30 +00:00
fschneider@google.com 67057623e5 Fix assertion in the parser about operator precedence.
R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27625 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-18 15:17:00 +00:00
mlippautz@google.com b09bbf706b Add metadata to type parameters. Reflective access is provided by TypeVariableMirror.
Addresses issue 10906.

BUG=https://code.google.com/p/dart/issues/detail?id=10906
R=asiva@google.com, rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27523 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-16 16:53:24 +00:00
hausner@google.com f3ed73c8da Make hidden initializing formal parameters invisible to the debugger
Fixes issue 13143.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27505 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-13 21:37:16 +00:00
hausner@google.com bbcf74a569 Make "as" a built-in identifier aka pseudo keyword
Fixes issues 12551, 13021

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27461 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-12 23:45:41 +00:00
hausner@google.com 417e20b15f Detect illegal class member names
Make it a compile time error if a class member has the same name
as the class.

Fixes issue 13236.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27446 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-12 20:44:34 +00:00
mlippautz@google.com cd958c8ca4 Fix reparsing of function parameters that include type parameters.
The parser is now properly initializing parsed_function/current_function to make
internal lookups work (instead of crashing).

BUG=
R=hausner@google.com, rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27418 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-12 01:06:43 +00:00
hausner@google.com 43d319c105 Update unresolved name handling with library prefixes
Fixes issue 12913

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27393 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-11 16:21:25 +00:00
regis@google.com 6c92ec5439 Simplify VM internal representation of a mixin application clause (MixinAppType
object) by removing some redundant field and type arguments.
Tolerate mixins with wrong number of type arguments and update tests.
Note: this is a first cleanup step in preparation of more mixin bug fixes.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27363 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-11 00:41:07 +00:00
hausner@google.com fd57843900 Update handling of ambiguous name references
Update VM to latest spec. Referencing a name that is imported
from more than one library is no longer a compile-time error.
If one of the sources of an ambiguous reference is a dart library,
the dart library declaration is automatically hidden.

Also fixes a bug where looking up a getter name in a library
found the getter even though the name is filtered out in the
'hide' combinator.

Long-term we should fix the need for repeatedly convert between
the mangled getter and setter names and the untangled name.

Fixes 12915, 12913, 12724.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27312 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-09 21:52:40 +00:00
fschneider@google.com dff262d761 Remove inlining restriction of calls to the == operator.
This CL is the first step in enabling full inlining of == calls.
Previously, calls to any function with the name "==" were not considered
for inlining because super-calls were not handled correctly. Instead
  of implementing == semantics for super calls in the back-end, the parser
now expands super calls to == into 

let t1 = left, t2 = right {
  (t1 === null  || t2 === null) ? t1 === t2
                                : static_call(super.==, t1, t2)
}

This change removes a bit of platform-specific assembly. Normal instance calls
to == are still translated as before. Expanding those at the AST level would
incur a too high cost in terms of (unoptimized) code size, and also would be
an obstruction for optimizations of equality. The plan is to expand those
only at optimization time if there is an inlineable instance call to ==.

R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27248 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-06 13:55:24 +00:00
kmillikin@google.com 2b19ed632d Disentangle AstNode::Name and AstNode::ShortName.
The Name function is used for pretty printing except that for a few
node types we rely on a specific name for implementation correctness.
Overriding the pretty printing function to get out a type name, or a
variable name, or an operator symbol name, is risky.

1. Code that relies on the semantics of the name will break if the
   pretty name is changed.

2. Pretty printing is less useful.  For instance, LoadLocalNode just
   prints the variable name (twice, once as the AST constructor and
   once in quotes as the variable name).  This is confusing if the
   variable happens to have the same name as one of the other pretty
   names, e.g., args or seq.

Now, there is a virtual function to get the pretty name but classes do
not change it to communicate other information (type names, variable
names, operator names).

BUG=
R=regis@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27244 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-06 11:54:26 +00:00
regis@google.com 765aac1496 Keep track of the application of a mixin type to a mixin application class,
which includes setting up its type parameters (fix issue 12871).

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27157 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-04 22:21:36 +00:00
rmacnak@google.com 865ef54309 Implement ParameterMirror.metadata.
BUG=http://dartbug.com/10906
BUG=http://dartbug.com/11418
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27082 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-03 22:50:15 +00:00