| OLD | NEW |
| 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 codegen.protocol; | 5 library codegen.protocol; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'api.dart'; | 9 import 'api.dart'; |
| 10 import 'codegen_tools.dart'; | 10 import 'codegen_tools.dart'; |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 writeln(' elementFromEngine(element);'); | 354 writeln(' elementFromEngine(element);'); |
| 355 return true; | 355 return true; |
| 356 case 'ElementKind': | 356 case 'ElementKind': |
| 357 docComment([new dom.Text( | 357 docComment([new dom.Text( |
| 358 'Construct based on a value from the analyzer engine.')]); | 358 'Construct based on a value from the analyzer engine.')]); |
| 359 writeln('factory ElementKind.fromEngine(engine.ElementKind kind) =>'); | 359 writeln('factory ElementKind.fromEngine(engine.ElementKind kind) =>'); |
| 360 writeln(' _elementKindFromEngine(kind);'); | 360 writeln(' _elementKindFromEngine(kind);'); |
| 361 return true; | 361 return true; |
| 362 case 'Location': | 362 case 'Location': |
| 363 docComment([new dom.Text( | 363 docComment([new dom.Text( |
| 364 'Construct based on an element from the analyzer engine.')]); | 364 'Create a Location based on an [engine.Element].')]); |
| 365 writeln('factory Location.fromElement(engine.Element element) =>'); | 365 writeln('factory Location.fromElement(engine.Element element) =>'); |
| 366 writeln(' _locationFromElement(element);'); | 366 writeln(' _locationFromElement(element);'); |
| 367 writeln(); | 367 writeln(); |
| 368 docComment([new dom.Text('Create a Location based on an element and offs
et from the analyzer engine.')]); | 368 docComment([new dom.Text('Create a Location based on an [engine.SearchMa
tch].')]); |
| 369 writeln('factory Location.fromOffset(engine.Element element, int offset,
int length) =>'); | 369 writeln('factory Location.fromMatch(engine.SearchMatch match) =>'); |
| 370 writeln(' _locationFromOffset(element, offset, length);'); | 370 writeln(' _locationFromMatch(match);'); |
| 371 writeln(); |
| 372 docComment([new dom.Text('Create a Location based on an [engine.AstNode]
.')]); |
| 373 writeln('factory Location.fromNode(engine.AstNode node) =>'); |
| 374 writeln(' _locationFromNode(node);'); |
| 375 writeln(); |
| 376 docComment([new dom.Text('Create a Location based on an [engine.Compilat
ionUnit].')]); |
| 377 writeln('factory Location.fromUnit(engine.CompilationUnit unit, engine.S
ourceRange range) =>'); |
| 378 writeln(' _locationFromUnit(unit, range);'); |
| 371 return true; | 379 return true; |
| 372 case 'OverriddenMember': | 380 case 'OverriddenMember': |
| 373 docComment([new dom.Text('Construct based on an element from the analyze
r engine.')]); | 381 docComment([new dom.Text('Construct based on an element from the analyze
r engine.')]); |
| 374 writeln('factory OverriddenMember.fromEngine(engine.Element member) =>')
; | 382 writeln('factory OverriddenMember.fromEngine(engine.Element member) =>')
; |
| 375 writeln(' _overriddenMemberFromEngine(member);'); | 383 writeln(' _overriddenMemberFromEngine(member);'); |
| 376 return true; | 384 return true; |
| 385 case 'RefactoringProblemSeverity': |
| 386 docComment([new dom.Text('Returns the [RefactoringProblemSeverity] with
the maximal severity.')]); |
| 387 writeln('static RefactoringProblemSeverity max(RefactoringProblemSeverit
y a, RefactoringProblemSeverity b) =>'); |
| 388 writeln(' _maxRefactoringProblemSeverity(a, b);'); |
| 389 return true; |
| 377 case 'SearchResult': | 390 case 'SearchResult': |
| 378 docComment([new dom.Text('Construct based on a value from the search eng
ine.')]); | 391 docComment([new dom.Text('Construct based on a value from the search eng
ine.')]); |
| 379 writeln('factory SearchResult.fromMatch(engine.SearchMatch match) =>'); | 392 writeln('factory SearchResult.fromMatch(engine.SearchMatch match) =>'); |
| 380 writeln(' searchResultFromMatch(match);'); | 393 writeln(' searchResultFromMatch(match);'); |
| 381 return true; | 394 return true; |
| 382 case 'SearchResultKind': | 395 case 'SearchResultKind': |
| 383 docComment([new dom.Text('Construct based on a value from the search eng
ine.')]); | 396 docComment([new dom.Text('Construct based on a value from the search eng
ine.')]); |
| 384 writeln('factory SearchResultKind.fromEngine(engine.MatchKind kind) =>')
; | 397 writeln('factory SearchResultKind.fromEngine(engine.MatchKind kind) =>')
; |
| 385 writeln(' _searchResultKindFromEngine(kind);'); | 398 writeln(' _searchResultKindFromEngine(kind);'); |
| 386 return true; | 399 return true; |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 CodegenProtocolVisitor visitor = new CodegenProtocolVisitor(readApi()); | 1046 CodegenProtocolVisitor visitor = new CodegenProtocolVisitor(readApi()); |
| 1034 return visitor.collectCode(visitor.visitApi); | 1047 return visitor.collectCode(visitor.visitApi); |
| 1035 }); | 1048 }); |
| 1036 | 1049 |
| 1037 /** | 1050 /** |
| 1038 * Translate spec_input.html into protocol_matchers.dart. | 1051 * Translate spec_input.html into protocol_matchers.dart. |
| 1039 */ | 1052 */ |
| 1040 main() { | 1053 main() { |
| 1041 target.generate(); | 1054 target.generate(); |
| 1042 } | 1055 } |
| OLD | NEW |