Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #import("../../../leg/leg.dart"); | 5 #import("../../../leg/leg.dart"); |
| 6 #import("../../../leg/elements/elements.dart"); | 6 #import("../../../leg/elements/elements.dart"); |
| 7 #import("../../../leg/tree/tree.dart"); | 7 #import("../../../leg/tree/tree.dart"); |
| 8 #import("../../../leg/util/util.dart"); | 8 #import("../../../leg/util/util.dart"); |
| 9 #import("mock_compiler.dart"); | 9 #import("mock_compiler.dart"); |
| 10 #import("parser_helper.dart"); | 10 #import("parser_helper.dart"); |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 A() : foo(); | 510 A() : foo(); |
| 511 }"""; | 511 }"""; |
| 512 resolveConstructor(script, "A a = new A();", "A", "A", 0, | 512 resolveConstructor(script, "A a = new A();", "A", "A", 0, |
| 513 [], [MessageKind.CONSTRUCTOR_CALL_EXPECTED]); | 513 [], [MessageKind.CONSTRUCTOR_CALL_EXPECTED]); |
| 514 | 514 |
| 515 script = """class A { | 515 script = """class A { |
| 516 int i; | 516 int i; |
| 517 A.a() : this.b(0); | 517 A.a() : this.b(0); |
| 518 A.b(int i); | 518 A.b(int i); |
| 519 }"""; | 519 }"""; |
| 520 resolveConstructor(script, "A a = new A.a();", "A", "A.a", 1, | 520 resolveConstructor(script, "A a = new A.a();", "A", "A\$a", 1, |
|
Lasse Reichstein Nielsen
2012/01/27 09:42:34
Consider using raw strings.
ngeoffray
2012/01/27 10:50:04
Done.
| |
| 521 [], []); | 521 [], []); |
| 522 | 522 |
| 523 script = """class A { | 523 script = """class A { |
| 524 int i; | 524 int i; |
| 525 A.a() : i = 42, this(0); | 525 A.a() : i = 42, this(0); |
| 526 A(int i); | 526 A(int i); |
| 527 }"""; | 527 }"""; |
| 528 resolveConstructor(script, "A a = new A.a();", "A", "A.a", 2, | 528 resolveConstructor(script, "A a = new A.a();", "A", "A\$a", 2, |
| 529 [], [MessageKind.REDIRECTING_CTOR_HAS_INITIALIZER]); | 529 [], [MessageKind.REDIRECTING_CTOR_HAS_INITIALIZER]); |
| 530 | 530 |
| 531 script = """class A { | 531 script = """class A { |
| 532 int i; | 532 int i; |
| 533 A(i); | 533 A(i); |
| 534 } | 534 } |
| 535 class B extends A { | 535 class B extends A { |
| 536 B() : super(0); | 536 B() : super(0); |
| 537 }"""; | 537 }"""; |
| 538 resolveConstructor(script, "B a = new B();", "B", "B", 1, | 538 resolveConstructor(script, "B a = new B();", "B", "B", 1, |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 555 } | 555 } |
| 556 | 556 |
| 557 map(FullResolverVisitor visitor) { | 557 map(FullResolverVisitor visitor) { |
| 558 TreeElementMapping elements = visitor.mapping; | 558 TreeElementMapping elements = visitor.mapping; |
| 559 return elements.map; | 559 return elements.map; |
| 560 } | 560 } |
| 561 | 561 |
| 562 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; | 562 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; |
| 563 | 563 |
| 564 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1); | 564 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1); |
| OLD | NEW |