Commit Graph

49 Commits

Author SHA1 Message Date
srdjan@google.com 344aba1e75 Assign ids to incoming arguments (to be used in checked mode).
Review URL: https://chromiumcodereview.appspot.com//10115053

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6718 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-19 00:04:47 +00:00
hausner@google.com b8d3cc0929 Fix bug 918
Don't choke to top-level native function declarations.
Review URL: https://chromiumcodereview.appspot.com//10086015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6541 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-13 22:02:31 +00:00
regis@google.com ab0a25eb1d Add missing type checks for top level static initializers (issue 1980 and
duplicates 1957, 2070, 2224).
Review URL: https://chromiumcodereview.appspot.com//9958091

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6145 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-03 20:23:30 +00:00
regis@google.com bb20585e0f Use a local variable to save/restore the context on entry/exit, instead of
explicitly pushing/popping.
Review URL: https://chromiumcodereview.appspot.com//9721004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5649 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-19 17:02:40 +00:00
kmillikin@google.com b05d117185 Support allocating and calling closures in the new non-optimizing compiler.
As part of this change, variable allocation is split out from the backend
code generator.

R=srdjan@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9664062

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5392 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 12:31:45 +00:00
asiva@google.com e4d024664e Add a first class GrowableObjectArray type in the VM and use it internally in the VM at all spots were we use GrowableArray first and then copy the contents into an Array object.
Next step is to use this type in growable_array.dart
Review URL: https://chromiumcodereview.appspot.com//9594028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5109 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 19:14:02 +00:00
regis@google.com f4ddc43cdf Generate dynamic type errors according to spec.
Fix a few bad tests.
Turn a couple negative tests in multi-tests.
Triage a few co19 failing tests.

Still to do:
Check bounds of generic types at runtime in checked mode.
Stop reporting bounds error in new operator as a compile time error.
Review URL: https://chromiumcodereview.appspot.com//9615035

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5064 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 02:23:12 +00:00
hausner@google.com 5f72e92b4e Re-introduce string concatenation
This change re-introduces concatenation of adjacent
string literals, i.e. the compiler concatenates "abc" "123"
into the literal "abc123" at compile time. If the literals
contain interpolations, the concatenation happens at
runtime.

The change also re-introduces interpolated compile-time
string literal constants, but the feature is disabled because
several tests need to be changed.
Review URL: https://chromiumcodereview.appspot.com//9582040

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4991 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-05 23:47:34 +00:00
srdjan@google.com 1d7321e3f2 Fix Issue 1846: Improve error reporting in presence of imports. With this CL:
'/Users/srdjan/bdartall/dart/runtime/bug3.dart': Error: line 2 pos 1: unexpected token 'abstract'
abstract class A { }
^
'/Users/srdjan/bdartall/dart/runtime/bug2.dart': Error: line 2 pos 1: library handler failed
#import("bug3.dart");
^
'/Users/srdjan/bdartall/dart/runtime/bug1.dart': Error: line 2 pos 1: library handler failed
#import("bug2.dart");
^
Review URL: https://chromiumcodereview.appspot.com//9559001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4773 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-29 23:53:07 +00:00
asiva@google.com 33d2e2fe26 Changes to shrink the token stream representation from two words to one word.
On standalone dartium which has about 50000 tokens in the libraries (core, coreimpl, builtin, io etc.) this reduces the heap size by about 180kb. The size of the standalone snapshot buffer reduces by about 72kb.

Also moved the keyword symbol table to the object store so that it does not have to repopulated on every script compilation. Should benefit regular user script load times.
Review URL: https://chromiumcodereview.appspot.com//9462003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4734 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-29 02:46:29 +00:00
regis@google.com 47724a8491 Add support for malformed types and postpone some related errors from compile
time to execution time.

Still to do (once spec is clarified):
- properly handle generic type bounds errors
- properly handle 'instance of' type checks involving malformed types
- fix bad tests
Review URL: https://chromiumcodereview.appspot.com//9515011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4732 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-29 02:14:18 +00:00
hausner@google.com 1ecc0a9e97 Fix handling of unresolved names
Fixes issue 1805 (http://code.google.com/p/dart/issues/detail?id=1805)

The VM didn't turn unresolved identifiers into instance getter calls in all cases. Refactored the code that handles primary expressions.
Review URL: https://chromiumcodereview.appspot.com//9453020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4550 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 19:55:57 +00:00
iposva@google.com f0c1954e9b Fix issue 732:
- Add handling for #resource library tags: Ignore at runtime, they are only used
  by the Dart Editor at the moment.
Review URL: https://chromiumcodereview.appspot.com//9431038

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4493 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 21:40:07 +00:00
srdjan@google.com acb395f713 Fix issue 979: operator arity must be verified.
Review URL: https://chromiumcodereview.appspot.com//9414005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4401 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-21 17:34:00 +00:00
asiva@google.com 3983c61041 Implement capability to use the same library prefix for multiple library imports (currently this is flagged as an error).
e.g:

#import("mylib101.dart", prefix:"mylib");
#import("mylib102.dart", prefix:"mylib");
#import("mylib103.dart", prefix:"mylib");
Review URL: https://chromiumcodereview.appspot.com//9363048

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4289 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-15 20:53:28 +00:00
regis@google.com 83e063f330 Simplify type resolution in parser.
Review URL: https://chromiumcodereview.appspot.com//9395017

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4240 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-15 00:44:16 +00:00
asiva@google.com d50bbba277 Implement support for specifying string interopolation style variable substitution in the import and source statements.
e.g:
sivamach[runtime]>more /workspace/asiva/expr/test1.dart
#library('test1.dart');
#import('${GOOGLE}$SRC/test2.dart');
#import('$DART/test3.dart');
test1() {
  print("test1");
}
main() {
  test1();
  test2();
  test3();
}
sivamach[runtime]>more /workspace/asiva/expr/src/test2.dart
#library('test2.dart');
#source('$GOOGLE$SRC/test2a.dart');
test2() {
  print("test2");
  test2a();
}
sivamach[runtime]>more /workspace/asiva/expr/src/test2a.dart
test2a() {
  print("test2a");
}
sivamach[runtime]>more /workspace/asiva/expr/src/test3.dart
#library('test3.dart');
#source('test3a.dart');
test3() {
  print("test3");
  test3a();
}
sivamach[runtime]>more /workspace/asiva/expr/src/test3a.dart
test3a() {
  print("test3a");
}

sivamach[runtime]>out/Debug_ia32/dart --import_map=GOOGLE,/workspace/asiva/expr --import_map=SRC,src --import_map=DART,/workspace/asiva/expr/src /workspace/asiva/expr/test1.dart
test1
test2
test2a
test3
test3a
Review URL: https://chromiumcodereview.appspot.com//9359009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4199 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-13 22:50:19 +00:00
iposva@google.com 242a784291 - Revert r4135: va_copy is not available everywhere.
Review URL: https://chromiumcodereview.appspot.com//9381009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4136 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-10 17:08:22 +00:00
iposva@google.com 431e8329bb Fix http://dartbug.com/1133:
- Incrementally concat error messages to avoid hitting
  a maximum error message size.
Review URL: https://chromiumcodereview.appspot.com//9334007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4135 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-10 16:59:41 +00:00
regis@google.com 2edb4ae9c7 Add token index position to classes and types for more accurate error reporting.
Review URL: https://chromiumcodereview.appspot.com//9325047

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3965 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-06 19:52:02 +00:00
turnidge@google.com 0ddd4c04e9 Dart_PropagateError, take 2.
This change hopefully takes care of the non-mac build issues.  The
checked mode failures are fixed in a separate cl.
Review URL: https://chromiumcodereview.appspot.com//9316071

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3863 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-02 19:05:06 +00:00
turnidge@google.com ae88492093 Revert Dart_PropagateError until I can track down the problems in
checked mode tests.

Sorry for the hubbub.
Review URL: https://chromiumcodereview.appspot.com//9314053

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3823 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-01 23:39:28 +00:00
turnidge@google.com 9da62c5fea Add Dart_PropagateError.
This function can be used in native functions to properly pass all
errors up the stack.

Set the long jump base in the Compiler instead of outside of the
compiler.  A bunch of errors that used to be propagated through the
sticky_error are now propagated through return values.  This includes
all of the DartEntry and DartLibraryCall functions.

In particular, we no longer use the long jump to cross dart frames.
Instead errors are propagated across dart frames using the same
mechanism that we use for unhandled exceptions.  I've added assertions
to make sure that we only use the long jump when it is "safe".
Review URL: https://chromiumcodereview.appspot.com//9169102

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3815 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-01 22:34:16 +00:00
regis@google.com 76a765b72f Simplify parsing of 'new' operator.
Fix checking of default factory type parameters (add new tests).
Start cleanup of class resolution code in parser and finalizer.
Review URL: https://chromiumcodereview.appspot.com//9290065

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3632 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-26 23:50:29 +00:00
regis@google.com ed9d7a399f Optimize parsing of qualified identifiers.
Review URL: https://chromiumcodereview.appspot.com//9271023

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3509 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-23 19:56:35 +00:00
regis@google.com 5b1da9fc27 Skip qualified identifiers that are part of ignored types.
Review URL: https://chromiumcodereview.appspot.com//9150036

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3441 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-19 18:31:55 +00:00
regis@google.com 366695d347 Ignore parsed types of local variables in unchecked mode and replace them with
the Dynamic type.
Review URL: https://chromiumcodereview.appspot.com//9232016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3404 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-18 18:08:04 +00:00
turnidge@google.com 53ba5c402e Make the "sticky error" an Error instead of a String.
I do this in preparation for using the sticky error to implement
isolate unwinding.
Review URL: https://chromiumcodereview.appspot.com//9186058

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3367 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-17 19:54:02 +00:00
hausner@google.com 343dff6255 Proper handling of built-in identifiers
Allow pseudo-keywords (built-in identifiers) as regular identifiers for anything but class names, interface names, typedef names.

Still todo: Update blacklist of class/interface names, disallow pseudo-keywords as type parameter names.
Review URL: http://codereview.chromium.org//9107070

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3303 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-13 19:24:50 +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
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
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
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 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
hausner@google.com 87ba9c00b5 Nix obsolete function prototype
Review URL: http://codereview.chromium.org//8536038

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1488 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-12 00:10:28 +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
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 7651034e9e Two-phase constructors
This CL fixes the initializer evaluation order and brings the VM fully up to spec.

Constructors are executed in two phases: the initializer phase and the constructor body phase. An additional implicit parameter tells the constructor code whether to execute the initializer list or the body (or both).

If the super initializer call is not at the end of the initializer list, the super constructor has to be called twice. The arguments to the super initializer have to be evaluated and stored in temporary local variables. At the beginning of the constructor block, a second implicit super call is inserted.

If the super initializer call happens to be at the end of the list, none of this madness has to happen, except for the extra implicit parameter to the constructor.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1102 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-02 17:19:15 +00:00
turnidge@google.com e756497a78 Refactor the dart api a bit:
- Dart_Result is gone.  Dart_Handle mostly replaces it.
- Name/signature changes
  - IsValidResult -> IsValid
  - GetErrorCString -> GetError
  - many more...
- Make details of persistent handle freelist private.
- Add persistent "True" handle to api state.

Things I am not doing in this changelist:

- Documentation updates
Review URL: http://codereview.chromium.org//8380020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@778 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-26 20:38:41 +00:00
srdjan@google.com 584a6f81b4 Some performance improvements to make raytracer faster (e.g, support intensified operation in mixed double/smi, constant folding).
Review URL: http://codereview.chromium.org//8355041

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@596 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-21 07:03:17 +00:00
hausner@google.com ab37c41e1d Interpolated strings are never considered compile time const
Review URL: http://codereview.chromium.org//8318031

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@500 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-17 23:51:28 +00:00
hausner@google.com 13da6d834f Create implicit super constructor call if necessary
Create an implicit call to the super constructor if no explicit
call is present, and also if the constructor does not have an
initializer list at all.

The evaluation order is still not conforming to the spec. Thus,
a couple of tests that happened to pass before now fail.

Fix issue 85
https://code.google.com/p/dart/issues/detail?id=85
Review URL: http://codereview.chromium.org//8286003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@412 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-13 20:16:38 +00:00
hausner@google.com 08a5cffb3b Implement index operator super call
Last portion of super operator calls.
Review URL: http://codereview.chromium.org//8234022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@359 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-11 23:50:19 +00:00
hausner@google.com a487770657 Implement super operator calls
Review URL: http://codereview.chromium.org//8222015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@335 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-11 16:49:35 +00:00
hausner@google.com b8a55bf3d7 Initializer expressions must not access 'this'
Catch explicit and implicit accesses to 'this' in initializer list of constructors.
Review URL: https://chromereviews.googleplex.com/3517020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@81 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 22:39:25 +00:00
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00