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

Side by Side Diff: tests/compiler/dart2js/parser_helper.dart

Issue 1153953002: Some minor fixes caught by the bots, suppress a test that needs more investigation (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 parser_helper; 5 library parser_helper;
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 8
9 import "package:compiler/src/elements/elements.dart"; 9 import "package:compiler/src/elements/elements.dart";
10 import "package:compiler/src/tree/tree.dart"; 10 import "package:compiler/src/tree/tree.dart";
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 log(new Message(errorCode, arguments, false)); 57 log(new Message(errorCode, arguments, false));
58 } 58 }
59 59
60 void reportHint(Spannable node, MessageKind errorCode, [Map arguments]) { 60 void reportHint(Spannable node, MessageKind errorCode, [Map arguments]) {
61 log(new Message(errorCode, arguments, false)); 61 log(new Message(errorCode, arguments, false));
62 } 62 }
63 63
64 withCurrentElement(Element element, f()) => f(); 64 withCurrentElement(Element element, f()) => f();
65 } 65 }
66 66
67 Token scan(String text) => new StringScanner.fromString(text).tokenize(); 67 Token scan(String text) =>
68 new StringScanner.fromString(text, enableNullAwareOperators: true)
69 .tokenize();
68 70
69 Node parseBodyCode(String text, Function parseMethod, 71 Node parseBodyCode(String text, Function parseMethod,
70 {DiagnosticListener diagnosticHandler}) { 72 {DiagnosticListener diagnosticHandler}) {
71 Token tokens = scan(text); 73 Token tokens = scan(text);
72 if (diagnosticHandler == null) diagnosticHandler = new LoggerCanceler(); 74 if (diagnosticHandler == null) diagnosticHandler = new LoggerCanceler();
73 Uri uri = new Uri(scheme: "source"); 75 Uri uri = new Uri(scheme: "source");
74 Script script = new Script(uri, uri,new MockFile(text)); 76 Script script = new Script(uri, uri,new MockFile(text));
75 LibraryElement library = new LibraryElementX(script); 77 LibraryElement library = new LibraryElementX(script);
76 library.canUseNative = true; 78 library.canUseNative = true;
77 NodeListener listener = 79 NodeListener listener =
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 ElementListener listener = new ElementListener(compiler, unit, () => id++); 123 ElementListener listener = new ElementListener(compiler, unit, () => id++);
122 PartialParser parser = new PartialParser(listener); 124 PartialParser parser = new PartialParser(listener);
123 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens)); 125 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens));
124 return unit.localMembers; 126 return unit.localMembers;
125 } 127 }
126 128
127 NodeList fullParseUnit(String source, {DiagnosticListener diagnosticHandler}) { 129 NodeList fullParseUnit(String source, {DiagnosticListener diagnosticHandler}) {
128 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens), 130 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens),
129 diagnosticHandler: diagnosticHandler); 131 diagnosticHandler: diagnosticHandler);
130 } 132 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/scanner/token.dart ('k') | tests/compiler/dart2js_extra/dart2js_extra.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698