Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: frog/tests/leg/src/ResolverTest.dart

Issue 9027002: Support factory methods. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/leg/ssa/builder.dart ('k') | frog/tests/leg_only/src/FactoryTest.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 Expect.isTrue(aElement !== null); 391 Expect.isTrue(aElement !== null);
392 Expect.isTrue(fooElement !== null); 392 Expect.isTrue(fooElement !== null);
393 393
394 fooElement.parseNode(compiler, compiler); 394 fooElement.parseNode(compiler, compiler);
395 compiler.resolver.resolve(fooElement); 395 compiler.resolver.resolve(fooElement);
396 396
397 TreeElements elements = compiler.resolveStatement("new A();"); 397 TreeElements elements = compiler.resolveStatement("new A();");
398 NewExpression expression = 398 NewExpression expression =
399 compiler.parsedTree.asExpressionStatement().expression; 399 compiler.parsedTree.asExpressionStatement().expression;
400 Element element = elements[expression.send]; 400 Element element = elements[expression.send];
401 Expect.equals(ElementKind.CONSTRUCTOR, element.kind); 401 Expect.equals(ElementKind.GENERATIVE_CONSTRUCTOR, element.kind);
402 Expect.isTrue(element is SynthesizedConstructorElement); 402 Expect.isTrue(element is SynthesizedConstructorElement);
403 } 403 }
404 404
405 testTopLevelFields() { 405 testTopLevelFields() {
406 MockCompiler compiler = new MockCompiler(); 406 MockCompiler compiler = new MockCompiler();
407 compiler.parseScript("int a;"); 407 compiler.parseScript("int a;");
408 Element element = compiler.universe.find(buildSourceString("a")); 408 Element element = compiler.universe.find(buildSourceString("a"));
409 Expect.equals(ElementKind.FIELD, element.kind); 409 Expect.equals(ElementKind.FIELD, element.kind);
410 VariableDefinitions node = element.parseNode(compiler, compiler); 410 VariableDefinitions node = element.parseNode(compiler, compiler);
411 Expect.equals(node.type.typeName.source.stringValue, 'int'); 411 Expect.equals(node.type.typeName.source.stringValue, 'int');
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 int bar; 478 int bar;
479 A() : this.foo = bar; 479 A() : this.foo = bar;
480 }"""; 480 }""";
481 resolveConstructor(script, "A a = new A();", "A", "A", 2, 481 resolveConstructor(script, "A a = new A();", "A", "A", 2,
482 [], [MessageKind.NOT_STATIC]); 482 [], [MessageKind.NOT_STATIC]);
483 } 483 }
484 484
485 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; 485 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1;
486 486
487 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1); 487 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1);
OLDNEW
« no previous file with comments | « frog/leg/ssa/builder.dart ('k') | frog/tests/leg_only/src/FactoryTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698