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

Side by Side Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1712583003: Serialize and resynthesize labels. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library analyzer.test.generated.resolver_test; 5 library analyzer.test.generated.resolver_test;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 expect(expression.propagatedElement, getMethod(numType, "+")); 1485 expect(expression.propagatedElement, getMethod(numType, "+"));
1486 _listener.assertNoErrors(); 1486 _listener.assertNoErrors();
1487 } 1487 }
1488 1488
1489 void test_visitBreakStatement_withLabel() { 1489 void test_visitBreakStatement_withLabel() {
1490 // loop: while (true) { 1490 // loop: while (true) {
1491 // break loop; 1491 // break loop;
1492 // } 1492 // }
1493 String label = "loop"; 1493 String label = "loop";
1494 LabelElementImpl labelElement = 1494 LabelElementImpl labelElement =
1495 new LabelElementImpl(AstFactory.identifier3(label), false, false); 1495 new LabelElementImpl.forNode(AstFactory.identifier3(label), false, false );
1496 BreakStatement breakStatement = AstFactory.breakStatement2(label); 1496 BreakStatement breakStatement = AstFactory.breakStatement2(label);
1497 Expression condition = AstFactory.booleanLiteral(true); 1497 Expression condition = AstFactory.booleanLiteral(true);
1498 WhileStatement whileStatement = 1498 WhileStatement whileStatement =
1499 AstFactory.whileStatement(condition, breakStatement); 1499 AstFactory.whileStatement(condition, breakStatement);
1500 expect(_resolveBreak(breakStatement, labelElement, whileStatement), 1500 expect(_resolveBreak(breakStatement, labelElement, whileStatement),
1501 same(labelElement)); 1501 same(labelElement));
1502 expect(breakStatement.target, same(whileStatement)); 1502 expect(breakStatement.target, same(whileStatement));
1503 _listener.assertNoErrors(); 1503 _listener.assertNoErrors();
1504 } 1504 }
1505 1505
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 expect(name.staticElement, same(constructor)); 1575 expect(name.staticElement, same(constructor));
1576 _listener.assertNoErrors(); 1576 _listener.assertNoErrors();
1577 } 1577 }
1578 1578
1579 void test_visitContinueStatement_withLabel() { 1579 void test_visitContinueStatement_withLabel() {
1580 // loop: while (true) { 1580 // loop: while (true) {
1581 // continue loop; 1581 // continue loop;
1582 // } 1582 // }
1583 String label = "loop"; 1583 String label = "loop";
1584 LabelElementImpl labelElement = 1584 LabelElementImpl labelElement =
1585 new LabelElementImpl(AstFactory.identifier3(label), false, false); 1585 new LabelElementImpl.forNode(AstFactory.identifier3(label), false, false );
1586 ContinueStatement continueStatement = AstFactory.continueStatement(label); 1586 ContinueStatement continueStatement = AstFactory.continueStatement(label);
1587 Expression condition = AstFactory.booleanLiteral(true); 1587 Expression condition = AstFactory.booleanLiteral(true);
1588 WhileStatement whileStatement = 1588 WhileStatement whileStatement =
1589 AstFactory.whileStatement(condition, continueStatement); 1589 AstFactory.whileStatement(condition, continueStatement);
1590 expect(_resolveContinue(continueStatement, labelElement, whileStatement), 1590 expect(_resolveContinue(continueStatement, labelElement, whileStatement),
1591 same(labelElement)); 1591 same(labelElement));
1592 expect(continueStatement.target, same(whileStatement)); 1592 expect(continueStatement.target, same(whileStatement));
1593 _listener.assertNoErrors(); 1593 _listener.assertNoErrors();
1594 } 1594 }
1595 1595
(...skipping 15446 matching lines...) Expand 10 before | Expand all | Expand 10 after
17042 17042
17043 void _resolveTestUnit(String code) { 17043 void _resolveTestUnit(String code) {
17044 testCode = code; 17044 testCode = code;
17045 testSource = addSource(testCode); 17045 testSource = addSource(testCode);
17046 LibraryElement library = resolve2(testSource); 17046 LibraryElement library = resolve2(testSource);
17047 assertNoErrors(testSource); 17047 assertNoErrors(testSource);
17048 verify([testSource]); 17048 verify([testSource]);
17049 testUnit = resolveCompilationUnit(testSource, library); 17049 testUnit = resolveCompilationUnit(testSource, library);
17050 } 17050 }
17051 } 17051 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698