Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t"; | 9 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t"; |
| 10 import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart"; | 10 import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart"; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 } | 33 } |
| 34 | 34 |
| 35 void internalErrorOnElement(element, String message) { | 35 void internalErrorOnElement(element, String message) { |
| 36 log(message); | 36 log(message); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void internalError(String message, {node, token, instruction, element}) { | 39 void internalError(String message, {node, token, instruction, element}) { |
| 40 log(message); | 40 log(message); |
| 41 } | 41 } |
| 42 | 42 |
| 43 SourceSpan spanFromSpannable(node, [uri]) { | 43 SourceSpan spanFromSpannable(node) { |
| 44 throw 'unsupported operation'; | 44 throw 'unsupported operation'; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void reportMessage(SourceSpan span, Diagnostic message, kind) { | 47 void reportMessage(SourceSpan span, Diagnostic message, kind) { |
| 48 log(message); | 48 log(message); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void reportError(Spannable node, MessageKind errorCode, [Map arguments]) { | 51 void reportError(Spannable node, MessageKind errorCode, [Map arguments]) { |
| 52 log(new Message(errorCode, arguments, false)); | 52 log(new Message(errorCode, arguments, false)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void reportWarningCode(Spannable node, MessageKind errorCode, [Map arguments]) { | |
|
floitsch
2014/02/19 14:57:40
long line.
Why do we need a reportWarningCode?
Sh
Johnni Winther
2014/02/20 09:35:40
Nice catch. Renamed.
| |
| 56 log(new Message(errorCode, arguments, false)); | |
| 57 } | |
| 58 | |
| 55 void reportInfo(Spannable node, MessageKind errorCode, [Map arguments]) { | 59 void reportInfo(Spannable node, MessageKind errorCode, [Map arguments]) { |
| 56 log(new Message(errorCode, arguments, false)); | 60 log(new Message(errorCode, arguments, false)); |
| 57 } | 61 } |
| 58 | 62 |
| 59 withCurrentElement(Element element, f()) => f(); | 63 withCurrentElement(Element element, f()) => f(); |
| 60 } | 64 } |
| 61 | 65 |
| 62 Token scan(String text) => new StringScanner.fromString(text).tokenize(); | 66 Token scan(String text) => new StringScanner.fromString(text).tokenize(); |
| 63 | 67 |
| 64 Node parseBodyCode(String text, Function parseMethod, | 68 Node parseBodyCode(String text, Function parseMethod, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 ElementListener listener = new ElementListener(compiler, unit, () => id++); | 122 ElementListener listener = new ElementListener(compiler, unit, () => id++); |
| 119 PartialParser parser = new PartialParser(listener); | 123 PartialParser parser = new PartialParser(listener); |
| 120 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens)); | 124 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens)); |
| 121 return unit.localMembers; | 125 return unit.localMembers; |
| 122 } | 126 } |
| 123 | 127 |
| 124 NodeList fullParseUnit(String source, {DiagnosticListener diagnosticHandler}) { | 128 NodeList fullParseUnit(String source, {DiagnosticListener diagnosticHandler}) { |
| 125 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens), | 129 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens), |
| 126 diagnosticHandler: diagnosticHandler); | 130 diagnosticHandler: diagnosticHandler); |
| 127 } | 131 } |
| OLD | NEW |