Parser must continue to parse the rest of an expression that contains
a type test with a malformed type.
Before:
'file:XXX’: error: line 5 pos 12: ')' expected
if (3 is X && 2 == 2) print("foo");
After:
'file:XXX’: malformed type: line 5 pos 12: type 'X' is not loaded
if (3 is X && 2 == 2) print("foo");
^
type error.
#0 main (file:XXX:5:12)
#1 _startIsolate.isolateStartHandler (dart:isolate-patch/isolate_patch.dart:216)
#2 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:115)
R=regis@google.com
Review URL: https://codereview.chromium.org//183743015
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33253 260f80e4-7a28-3924-810f-c04153c831b5
A name that is not resolved in the local scope gets looked up
in the global scope of the library to which the code being compiled
belongs. The local name dictionary gets searched first, then the
dictionary of each imported library (and and their re-exported
libraries.) Each dictionary lookup includes the lookup of the
mangled getter and setter names, which means that we concatenate
the same name many times.
This change introduces a cache that stores the result of a previous
name lookup, including negative lookup results. The latter is important
to speed up the resolution of names that are not in the global name
space, e.g. class members like .length in lists.
Experiments running dart2js (with VM option --compile_all) show
that this reduces the number of name mangling calls by a factor of 10
and speeds up compiling dart2js by 15%.
R=asiva@google.com
Review URL: https://codereview.chromium.org//135123011
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32385 260f80e4-7a28-3924-810f-c04153c831b5
The bit has_finally was only used to skip the checking of the stack height
at return statements: There was an unused value floating on top of the
expression stack in unoptimized code if the finally block preceded a normal
return statement. Normallyi, that does not cause harm. Optimized code is not
affected since it has a fixed stack size for expression evaluation.
This CL fixes the stack height for functions with try-finally by introducing
a temporary local where the return value is saved before an inlined
finally-block.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//149603003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32157 260f80e4-7a28-3924-810f-c04153c831b5
No need to halt on single step if there is a breakpoint on the
same location. While looking at the resulting test failures, I
discovered that the step_in_equals test was not at all testing
what it was meant to test. It happened to pass because of a
related bug in the parser. Decided to abandon that test and
instead check that we can break at == even if one of the operands
is null.
Added ability to match line numbers in the debugger tests.
R=regis@google.com
Review URL: https://codereview.chromium.org//135843003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31898 260f80e4-7a28-3924-810f-c04153c831b5
Fix issues 15244, 15148, 14869, 14000, and 13688 (was closed, but fragile).
Note that the current solution is not final as it may not be correct in more
complex cases not yet covered by language tests.
The final solution will require a 'trail' instead of a simple mark bit to
prevent operations involving recursive types to diverge.
R=asiva@google.com
Review URL: https://codereview.chromium.org//103913005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31087 260f80e4-7a28-3924-810f-c04153c831b5
The AST cannot distinguish between (x) and x. Adding a check
to the VM compiler that detects syntactically illegal assignments
like (x) = 0. The existing checks only analyze the AST so we
didn’t detect some illegal cases.
Looking at the source to detect syntactically illegal left hand
expressions is a bit ugly because we can’t easily look at
previous tokens. This change rewinds the token iterator a few
positions and then moves forward to check whether the last token
of the expression is an identifier or a closing bracket ].
Added new test. We did not have a single test case for this :)
R=regis@google.com
Review URL: https://codereview.chromium.org//106843002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30904 260f80e4-7a28-3924-810f-c04153c831b5
Until now the parser marked native functions as native when parsing.
This may be too late for some functions. E.g. the native typed list
constructor may not be invoked because the intrinsic code is executed
instead (unless for example new-space allocation fails).
This causes missing type information when optimizing functions using
those recognized factory functions like Uint8List._new.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//99373002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30846 260f80e4-7a28-3924-810f-c04153c831b5
In a static- or top-level variable v
var v = expr
static v = expr
If the initializer expression expr throws, the VM throws a
CyclicInitializationError when loading v afterwards, even though
this has nothing to do with cyclic initialization.
I'm changing the way implicit static getters and static initializers are
compiled. Static initializers are invoked from static getters.
They look as follows:
get:v {
if (field.value === transition_sentinel) {
field.value = null;
throw new CyclicInitializationError();
}
if (field.value === sentinel) {
field.value = transition_sentinel;
init:v();
}
return field.value;
}
init:v {
try {
field.value = expr;
} catch {
if (field.value === transition_sentinel) {
field.value = null;
}
rethrow;
}
}
BUG=http://dartbug.com/5802
TEST=language/lazy_static3_test,
language/throwing_lazy_variable_test,
co19/Language/12_Expressions/30_Identifier_Reference_A08_t02
R=hausner@google.com
Review URL: https://codereview.chromium.org//54713003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29797 260f80e4-7a28-3924-810f-c04153c831b5