Commit Graph

1278 Commits

Author SHA1 Message Date
hausner@google.com ee79bc031d Second try at additional nested block in functions.
The last change broke dartium tests because as a side effect, the generated
code size increased by 2 or 3 percent. Fixed this unintended side
effect.
Review URL: http://codereview.chromium.org//9109024

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3013 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-05 21:28:32 +00:00
vsm@google.com 981772b59e Reverting r2970 to fix Dartium break
This should get the Dartium bot green again.

TBR=hausner

TEST=language/HelloDartTest

Review URL: http://codereview.chromium.org//9116002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2980 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-05 06:31:17 +00:00
hausner@google.com 5796ad3e3a Fix potential problem with expression evaluation.
Review URL: http://codereview.chromium.org//9110001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2976 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-05 01:47:10 +00:00
hausner@google.com 0a3c9e6577 Put function parameters into their own scope.
Local function variables in the outermost scope can shadow function parameters.
Review URL: http://codereview.chromium.org//9088024

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2970 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-04 21:31:23 +00:00
hausner@google.com 3d3ed3720e Fix issues 968 and 998
968: don't crash if no class name given after 'default'
998: eliminate code generator diagnostic output on stdout
Review URL: http://codereview.chromium.org//9072012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2930 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-04 01:12:04 +00:00
hausner@google.com 503e2219b8 First part of inspecting local variables
This change introduces variable descriptors that describe the name, stack slot index, and source code stretch in which a variable is valid.

Activation frames in the stack trace now can enumerate the variables that are active in that frame.

Next step: fetch the value of variables from the stack.
Review URL: http://codereview.chromium.org//8992020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2671 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-20 21:40:28 +00:00
hausner@google.com 59e6694944 One small step towards sanity
Make 'class' a proper keyword, and 'extends' too. Adjusting the VM compiler to the language spec.
Review URL: http://codereview.chromium.org//8968021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2533 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-16 19:11:39 +00:00
asiva@google.com 77dba39e63 Add Double::NewCanonical and Mint::NewCanonical so that it is possible to
canonicalize double and mint constants without having to create an object first.
Review URL: http://codereview.chromium.org//8963001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2496 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-16 00:31:33 +00:00
regis@google.com 5db4de9756 Implement revised factories in the VM.
Emit warnings when obsolete syntax is used.
Review URL: http://codereview.chromium.org//8921033

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2394 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-13 19:35:07 +00:00
srdjan@google.com 46748dc6b1 Allocate double temporaries in old space, because they belong there. Canonicalize more double literals.
Review URL: http://codereview.chromium.org//8921012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2351 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-12 18:59:20 +00:00
regis@google.com 809cd5590a Helper ast node sequences must not wrongly grab ownership of the enclosing
scope (fix issue 736).
Add test.
Review URL: http://codereview.chromium.org//8893008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2324 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-09 21:32:14 +00:00
regis@google.com dd32effb72 Adjust index of type parameters at finalization time (fix issue 718).
Add test.
Review URL: http://codereview.chromium.org//8872037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2286 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-08 23:00:55 +00:00
regis@google.com 0ef32f52f4 Fix handling of unresolved upper bounds in factory declarations (issue 721).
Review URL: http://codereview.chromium.org//8862002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2208 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-08 00:16:55 +00:00
srdjan@google.com f98993384f Canonicalize TypeArguments.
Review URL: http://codereview.chromium.org//8773026

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2133 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-06 17:47:47 +00:00
regis@google.com 777625235f Support qualified factory names (fix issue 514).
Review URL: http://codereview.chromium.org//8804019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2085 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-05 19:22:27 +00:00
srdjan@google.com d07087ce77 Ongoing renaming of type classes:
TypeArguments -> AbstractTypeArguments
TypeArray -> TypeArguments
Review URL: http://codereview.chromium.org//8776020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2002 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-01 23:19:59 +00:00
srdjan@google.com 2ff4d8a207 Address Regis' comments, replace AbstractType with Type where possible.
Review URL: http://codereview.chromium.org//8772009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1992 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-01 21:14:48 +00:00
srdjan@google.com 17552e9a3c Renaming type classes as discussed:
Type -> AbstractType
ParameterizedType -> Type

TODO: 

TypeArguments -> AbstractTypeArguments
TypeArray -> TypeArguments
Review URL: http://codereview.chromium.org//8761011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1987 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-01 16:54:52 +00:00
srdjan@google.com 0063555050 Use ParametrizedType instead of Type where appropriate. Expand ToCString of type related classes. Do not instantiate abtract classes Type and TypeArguments (e.g., through Type::null());
Review URL: http://codereview.chromium.org//8742028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1941 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-30 21:14:22 +00:00
hausner@google.com 51bb1d4e4c Properly detect name collisions at library level
Fixing issue 592
Review URL: http://codereview.chromium.org//8724015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1934 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-30 18:55:37 +00:00
regis@google.com 5382e56f05 Optimize type checks of list and map literals.
Introduce an ast node for explicit 'assignable to' type checks.
Remove Instance::Is() helper.
Review URL: http://codereview.chromium.org//8678031

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1827 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-24 00:26:18 +00:00
hausner@google.com ac4b099912 Fix even more builds
My code is apparently breaking everywhere except on the Mac...
Review URL: http://codereview.chromium.org//8680031

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1822 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-23 22:39:22 +00:00
hausner@google.com 0b3cc43b89 Fix Windows build
Write once, fix everywhere...
Review URL: http://codereview.chromium.org//8680029

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1820 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-23 22:34:14 +00:00
hausner@google.com 0ef3609ec0 Allow optional initializing formals again
After removing optional initializing formal parameters from the VM
yesterday, the language team decided that they should be allowed
and made usable.

- The name of an optional initializing formal is the name of
  the field it initializes.
- The parameter is only visible at the call site of the constructor,
  to name the parameter.
- The parameter is NOT visible in the constructor's initializer list
  and body.

class A {
  A([this.x = 10]);
  A.bad([this.x = 10]) : y = x;  // Error: parameter x not in scope
  A.ok([this.x = 10]) { print(x); } // Refers to field x, not parameter x.
  var x, y; 
}

o = new A(x: 50);  // o.x == 50.
o = new A();       // o.x == 10.
Review URL: http://codereview.chromium.org//8682025

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1819 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-23 22:31:09 +00:00
regis@google.com 6191ea8088 Fix build breakage.
Check type of list and map literals in checked mode only, and with an
"assignable to" test rather than a "instance of" test.
Review URL: http://codereview.chromium.org//8677019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1814 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-23 20:14:27 +00:00
srdjan@google.com 4c267997cd Fix bug 557: Disallow user side allocation of ImmutableArray. Also added "instantiation-checks" for some other VM-internal classes.
Review URL: http://codereview.chromium.org//8648003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1811 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-23 19:48:25 +00:00
regis@google.com 9f230a34c6 Implement type checking of list literals (issue 220).
Remove expose_core_impl flag.
Add tests.
Fix tests.
Cleanup type checking of map literals.
Review URL: http://codereview.chromium.org//8676001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1809 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-23 19:34:23 +00:00
regis@google.com a2bb53c7af Implement type checking of map literals (issue 221).
Support proper syntax for map literals (at most one type argument is allowed)
and give a warning when legacy syntax is used.
Add tests.
Fix tests.
Review URL: http://codereview.chromium.org//8637018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1764 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-22 21:42:07 +00:00
hausner@google.com b9cf297c15 Initializing formals can't be optional parameters
Add new error message to VM compiler.
Remove all optional initializing formals from library
and tests.
Review URL: http://codereview.chromium.org//8619008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1755 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-22 19:09:54 +00:00
asiva@google.com ce606eda7b Library prefix should be an identifier
(we don't yet check that it is not a reserved keyword, that can be done only
after we are able to store the keyword table as a singleton in the vm isolate)
Review URL: http://codereview.chromium.org//8500006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1720 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-21 22:17:41 +00:00
regis@google.com 314a89e16c Update comments in core lib showing proper factory syntax.
Improve error messages reported from class finalizer.
Fix parser error reporting to be thread safe.
Reformat type error and failed assertion messages to be consistent.
Add one more new factory syntax test.
Review URL: http://codereview.chromium.org//8549033

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1708 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-21 17:06:52 +00:00
srdjan@google.com 8b6dbe1b76 Do not allow allocation of FallThroughError and AssertionError by the user.
Review URL: http://codereview.chromium.org//8569013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1671 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-18 20:36:42 +00:00
regis@google.com a5dc8b60d1 Fix code generation issue with new factory syntax.
Convert VM core library to new factory syntax.
Review URL: http://codereview.chromium.org//8602004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1662 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-18 17:47:12 +00:00
regis@google.com 80d89cc93b Fix parsing of factory calls (issue 500).
Add test.
Fix test.
Adjust co19 status file.
Review URL: http://codereview.chromium.org//8591025

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1633 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-17 21:42:55 +00:00
asiva@google.com 9f49e2bf74 Implement automatic loading of dart:core_native_fields library
with predefined classes having native fields.
Classes that need native fields in them can import this library and
extend these predefined classes.
Review URL: http://codereview.chromium.org//8537023

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1629 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-17 21:04:43 +00:00
regis@google.com 3c64ffe9a3 Support correct factory syntax in the VM as decribed in the spec.
Change the default value of --silent_warnings from true to false, so that
warnings are visible when legacy factory syntax is used.

In order to facilitate transition of libraries and user programs, legacy factory
syntax is still supported by 2 workarounds, but warnings are printed.

The first workaround allows the factory clause to omit the type
parameter list, which otherwise has to match exactly with the list of
type parameters in the factory class declaration.

The second workaround allows a factory method to omit the type
parameter list. In that case, the type parameter list of the enclosing
class is used instead.

Workarounds will be removed to enforce correct factory syntax at a later time.
Review URL: http://codereview.chromium.org//8585004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1595 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-16 23:49:04 +00:00
srdjan@google.com 1ea6e2e0de Stop building blind: report errors with factories and parametrized types.
Enable test. This CL expects the frog/leg changes to be submitted first.
Review URL: http://codereview.chromium.org//8511070

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1479 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-11 22:23:45 +00:00
regis@google.com 8b9ebb3528 Second attempt at finalizing all classes in the VM (fix issue 364).
Review URL: http://codereview.chromium.org//8491055

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1475 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-11 21:38:49 +00:00
turnidge@google.com 8c64adf13e Deal with unhandled exceptions the same way in all Dart api functions.
--

Terminology change: invalid handles are now called error handles.

Unhandled exceptions used to be a kind of valid handle.  Now they are
a kind of error handle.

For the Dart_Invoke* functions, this means that the standard
error-checking blob drops from two tests to one test and is
harder to mess up.

Many other Dart api functions (Dart_ToString, for example) previously
dealt with unhandled exceptions by turning them into terse error
messages.  Now these functions preserve information about the
exceptions and generate better error messages.

Changed Dart_HandleMessage to return success/failure.  It seemed to fit.

--

Details:

Dart_IsValid becomes Dart_IsError (negated sense).

Dart_GetError now knows how to print a stack trace semi-nicely.

Dart_ExceptionOccurred -> Dart_IsUnhandledException.

Renamed ApiFailure class to ApiError to fit better.

ApiError now has a "data" pointer that points to either an error
message string or to an unhandled exception object.

Documentation changes aplenty.
Review URL: http://codereview.chromium.org//8501034

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1470 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-11 19:31:04 +00:00
srdjan@google.com 81be68ae18 Giving up on the change to report errors with factories and generic types.
This means that you will continue to have crashes in Debug mode, but you will be able to "run" in Release mode. Best solution is to get rid of generic types in Link until factories and generic types have been fully implemented. Until then we do not know what can happen when running in release mode.

Still trying to figure out how to test frog and leg correctly.
Review URL: http://codereview.chromium.org//8540013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1469 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-11 18:52:53 +00:00
srdjan@google.com 6ff41ed334 Require legacy form of type parameters in factories and report errors if a factory class does not have a required parametrized type (fixes crashes in VM). Fix frog code, however, there are frogs problem with --compileall:
leg/util/link_implementation.dart:38:12: error: wrong number of arguments, expected 0 but found 2
    return new Link<T>(element, this);
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
Review URL: http://codereview.chromium.org//8515024

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1464 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-11 17:04:00 +00:00
srdjan@google.com da9092146b Implement %= and assign a couple of tests.
Review URL: http://codereview.chromium.org//8509032

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1411 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-10 18:04:42 +00:00
regis@google.com a6282231eb Revert r1380 that is breaking frog.
Review URL: http://codereview.chromium.org//8509031

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1382 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-10 01:39:06 +00:00
regis@google.com 8dd26ba9f6 Finalize all classes (fix issue 364).
Review URL: http://codereview.chromium.org//8506001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1380 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-09 23:33:48 +00:00
hausner@google.com f59e679860 Capturing for loop variables correctly
Re-introduce a "fresh copy" of the for loop variable(s) in each iteration. Adding a minimal test to check that closures capture the value of the particular loop iteration. 
Review URL: http://codereview.chromium.org//8490019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1273 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-07 22:36:28 +00:00
hausner@google.com b121e837d4 Address Regis' review feedback
TBR
Review URL: http://codereview.chromium.org//8475005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1208 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-04 17:04:40 +00:00
hausner@google.com 504eea10ff Experimental version without native constructor support
The semantics of native constructors are not really clear. Instead of a native constructor, write a regular Dart constructor that calls a native function in the constructor body instead.
Review URL: http://codereview.chromium.org//8450016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1201 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-04 15:58:55 +00:00
hausner@google.com 35cc976b4b Separating constructor parsing from function parsing
Make parsing functions and constructors more readable by separating
the two into disjoint functions.
Review URL: http://codereview.chromium.org//8417056

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1172 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-03 22:29:57 +00:00
hausner@google.com a6b3f4f19c No returns allowed in constructors
Add compiler error message when a constructor explicitly returns a
value. Fixes bug/issue 224.
Review URL: http://codereview.chromium.org//8450009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1161 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-03 20:07:35 +00:00
hausner@google.com f401476d02 Fix problem with named arguments in constructors
When generating the implicit super call to the body, the argument
names have to be duplicated from the implicit initializer call.
Review URL: http://codereview.chromium.org//8386065

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1130 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-03 00:36:27 +00:00