Use correct compilation unit for inlined field initializers.

BUG=http://dartbug.com/9602

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20851 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
johnniwinther@google.com 2013-04-03 12:17:00 +00:00
parent 33c565ac1b
commit d41baf225c
3 changed files with 47 additions and 0 deletions

View file

@ -1335,7 +1335,9 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
// closure to class mapper.
compiler.closureToClassMapper.computeClosureToClassMapping(
member, node, elements);
sourceElementStack.add(member);
right.accept(this);
sourceElementStack.removeLast();
elements = savedElements;
value = pop();
}

View file

@ -0,0 +1,25 @@
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library inline_super_field_lib;
// The comment is inserted to ensure that the offset of [bar] is not within
// the length of the [:inline_super_field_test.dart] script.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
var i = 0;
class M1 {
final bar = ++i;
}

View file

@ -0,0 +1,20 @@
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Test that source maps use the correct compilation unit when super class
// fields from another compilation unit are inlined.
library inline_super_field_test;
import "inline_super_field_lib.dart";
class S {
}
class C extends S with M1 { }
void main() {
var c = new C();
Expect.equals(1, c.bar);
}