Commit Graph

160 Commits

Author SHA1 Message Date
regis@google.com f955de9bc0 Throw a type error in production mode when the type of the type test is not
declared (issue 2571).
Add test.
Delete bad negative test now covered by new test.
Update status files of different compilers.
Review URL: https://chromiumcodereview.appspot.com//10035058

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6754 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-19 17:01:28 +00:00
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 e74cd5fc3a Static members are not visible in subclasses
Fix for issue 1598.

Lexical scope comes before inherited names. Also, Static members
are not inherited and are not visible in subclasses.
Code in the subclass (or any other code for that matter) has to
qualify the names of these members with the class name.

We had a few tests that were wrong and only passed in the VM because
this was not implemented correctly.

Also had to fix code in frog and dartdoc.

I hope I ran enough tests. I built an all.deps tree using tools/build.py from the root directory, which brought up the frog and dartdoc issues.

Tested:
tools/test.py --compiler=dart2js --runtime=drt
tools/test.py -c none -r drt
tools/test.py -c frog -r drt
tools/test.py -r vm

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6698 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-18 16:09:22 +00:00
hausner@google.com 69d33b8d8d Fix bug 1991, variable resolution in string interpolation
Check to make sure string interpolation expressions cannot
contain type parameter names.
Review URL: https://chromiumcodereview.appspot.com//10108020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6645 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-17 16:10:35 +00:00
hausner@google.com 02661e6905 Accept keyword abstract in front of a class declaration
We can just ignore it. The VM has nothing to do for abstract
classes.
Review URL: https://chromiumcodereview.appspot.com//10103014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6612 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-16 23:46:55 +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 fce1a7e45e Fix lazy initialization of static fields (issue 2472).
Review URL: https://chromiumcodereview.appspot.com//10050022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6438 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 21:24:17 +00:00
hausner@google.com 2fc3bb679d Introduce a flag to disable string operator +
If allow_string_plus is set to false, the compiler will report an error
when it finds a string literal followed by +. Invoking the + operator on a
string value throws a noSuchMethod exception.

This is temporary code that we'll eliminate once the + operator on
strings is completely removed.
Review URL: https://chromiumcodereview.appspot.com//9960084

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6423 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 18:23:22 +00:00
regis@google.com 3c063c8d4f Eliminate type checks that can successfully be performed at compile time.
Review URL: https://chromiumcodereview.appspot.com//10051011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6420 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 17:42:39 +00:00
srdjan@google.com b3452e74fb Add a test to check correct references to a global variable that initially throws
a type error.
Review URL: https://chromiumcodereview.appspot.com//10006040

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6294 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-06 20:25:21 +00:00
turnidge@google.com 9731c1c254 Rename Api::NewLocalHandle -> Api::NewHandle.
Api::NewHandle now takes a RawObject* intead of an Object&.
- This makes the code shorter and easier to read.
- This allows us to drop the DARTSCOPE from Dart_GetNativeArgument.
  (6% speedup on Benchmark_UseDartApi)
Review URL: https://chromiumcodereview.appspot.com//10014002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6283 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-06 17:05:50 +00:00
regis@google.com 9ff0afa50e Do not require upper bounds to be resolved and finalized before comparing them
between the expected and actual factory class (issue 2431).
Add test.
Review URL: https://chromiumcodereview.appspot.com//10008017

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6236 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-05 18:11:42 +00:00
turnidge@google.com c0d7f96409 Remove many calls to Isolate::Current() in the dart embedding api by
passing the isolate explicitly.
Review URL: https://chromiumcodereview.appspot.com//9956133

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6193 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-04 20:31:49 +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
hausner@google.com 55a9a4831e Fix issue 1569
Report proper error on illegal getter and setter syntax, and bad field declarations.
Review URL: https://chromiumcodereview.appspot.com//9958041

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6112 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-02 21:18:02 +00:00
regis@google.com 5282e44fb2 Use null type argument vector instead of vector of Dynamic for a generic raw
type when possible.
Fix type finalization of type parameters (always finalize in the context of the
class being parameterized and not in the enclosing class where the type
parameter is used).
Fix wrong generic optimization and added a test (a generic type instantiated
from a raw instantiator is not always raw).
Added printing of type argument vectors.
Review URL: https://chromiumcodereview.appspot.com//9939003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6068 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-30 22:16:52 +00:00
hausner@google.com 50433eb7a9 Report error on missing factory class
Fixes issue 974. If an interface declares a constructor, it must
declare a factory class. Report compile-time error if the factory
class is missing.
Review URL: https://chromiumcodereview.appspot.com//9958018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6046 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-30 16:53:55 +00:00
hausner@google.com c91cbd26a7 Fix capturing of for-loop variables
It was broken when there were captured variables in inner blocks.
LocalFunctionTest had a test case that was expecting the wrong result.
Add a few more test cases to For2Test.dart

Fixes issue 2338  (http://code.google.com/p/dart/issues/detail?id=2338)
Review URL: https://chromiumcodereview.appspot.com//9921030

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6006 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-29 22:44:47 +00:00
regis@google.com 8ba77ffb83 Do not share local function between closurized and non-closurized enclosing
function.
Add test (thanks to Florian for reporting the issue).
Review URL: https://chromiumcodereview.appspot.com//9835070

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5843 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-26 16:59:37 +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
hausner@google.com feafdf0e06 Properly recognize closures when setting breakpoints
Local functions and function literals are unknown to the VM
until the enclosing function is compiled. This change introduces
a list of known closures per class, and a function to look up
the innermost closure at a given token index.

The debugger now checks whether there are newly discovered
closures when a function containing a pending breakpoint is
compiled. If necessary, the breakpoint is set to the inner
function.
Review URL: https://chromiumcodereview.appspot.com//9716004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5599 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-16 22:28:57 +00:00
hausner@google.com ad939b2035 Remove warning for illegal parameter names
Review URL: https://chromiumcodereview.appspot.com//9704094

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5573 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-16 16:17:23 +00:00
hausner@google.com 6ac08888fe Compiler warning on named optional params that start with '_'
Temporary change so Dartium can can fix their source. Then convert
the warning to an error message as in change 5444.

TBR=vsm
Review URL: https://chromiumcodereview.appspot.com//9702010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5450 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-14 00:41:40 +00:00
hausner@google.com 63b525bb0e Revert change 5444
Review URL: https://chromiumcodereview.appspot.com//9703004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5448 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-14 00:35:16 +00:00
hausner@google.com a995d60106 named optional parameters must not be private
Named optional parameters may not start with an underscore '_'.

Fix issue 434 (http://code.google.com/p/dart/issues/detail?id=434)
Review URL: https://chromiumcodereview.appspot.com//9701001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5444 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 23:24:37 +00:00
regis@google.com d74c2008be Fix type check to perform a subtype test at top level instead of an
assignability test. This only makes a difference when assigning an instance of
a function type.
Fix a bad language test.
Disable a bad co19 test (issue 99 filed).
Change error message for dynamic type error.
Review URL: https://chromiumcodereview.appspot.com//9664029

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5413 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 16:16:12 +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
iposva@google.com 9e93428d9e - Allow string interpolation in constant strings.
- Add test for constant adjacent strings with and without interpolation.
- Update status files.
Review URL: https://chromiumcodereview.appspot.com//9694024

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5377 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 00:59:17 +00:00
iposva@google.com 8e5b5a02e2 Fix issue 1950:
- enable-checked-mode forces --enable_type_checks and --enable_asserts.
Review URL: https://chromiumcodereview.appspot.com//9668034

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5269 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 23:21:09 +00:00
regis@google.com 33bd965e2a Generate a dynamic type error when creating an instance with a bound error.
Review URL: https://chromiumcodereview.appspot.com//9665013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5250 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 21:15:11 +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
srdjan@google.com d6abdfb6b8 Eliminate IncrOpStaticFieldNode, replace a set of nodes.
Review URL: https://chromiumcodereview.appspot.com//9592031

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5063 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 00:40:48 +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 eff1a31d6f Fixing bugs: 1612, 1843, 1847
- Fix error location when referring to types in object allocation.
- Handle CR/LF correctly at beginning of source.
- Detect duplicate identifier in typedef declaration.
Review URL: https://chromiumcodereview.appspot.com//9466030

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4584 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-25 00:47:06 +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
regis@google.com 25fcaf5044 Generic bound errors are static type errors not to be reported by the VM.
Review URL: https://chromiumcodereview.appspot.com//9428015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4476 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 17:48:05 +00:00
srdjan@google.com 87089f37f1 Fix cacthing exception object: a null exception is always caught.
Review URL: https://chromiumcodereview.appspot.com//9416067

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4411 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-21 22:07:59 +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
srdjan@google.com 1d7d76a43b Optimizing code generator expects that every AST node is traversed once, i.e., the nodes are not reused. Unfortunately this is not the case in assignment operations with arrays (e.g. a[i] += 3).
The proper solution would be to clone array and index nodes but that would require too many changes. Long term we can't / won't use AST nodes for optimization purposes.
Short term fix is here: load array and index and release their CodeGenInfo before value is traversed so that the value computation can set its own CodeGenInfo on the same node.
Review URL: https://chromiumcodereview.appspot.com//9373025

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4121 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-10 08:30:53 +00:00
regis@google.com 851682f104 Represent declared type parameters of a class as an array of TypeParameter
rather than an array of String and simplify code accordingly.
Rename the field holding type parameter bounds of a class.

Note: I retract my earlier suggestion to Srdjan to represent interfaces of a
class (as well as its canonical types) as a TypeArguments. This would require
more code to check for an empty array and for growing the array. Besides, these
are really arrays and have nothing to do with type arguments. I removed the
corresponding TODO(srdjan).
Review URL: https://chromiumcodereview.appspot.com//9368032

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4096 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-09 21:28:53 +00:00