OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 part of analyzer.parser; | 5 part of analyzer.parser; |
6 | 6 |
7 class _Builder implements Builder { | 7 class _Builder implements Builder { |
8 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 8 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
9 } | 9 } |
10 | 10 |
11 class _ElementStore implements ElementStore { | |
12 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | |
13 } | |
14 | |
15 class _KernelLibraryBuilder implements KernelLibraryBuilder { | 11 class _KernelLibraryBuilder implements KernelLibraryBuilder { |
16 @override | 12 @override |
17 final uri; | 13 final uri; |
18 | 14 |
19 _KernelLibraryBuilder(this.uri); | 15 _KernelLibraryBuilder(this.uri); |
20 | 16 |
21 @override | 17 @override |
22 Uri get fileUri => uri; | 18 Uri get fileUri => uri; |
23 | 19 |
24 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 20 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
(...skipping 19 matching lines...) Expand all Loading... |
44 | 40 |
45 /** | 41 /** |
46 * The source being parsed. | 42 * The source being parsed. |
47 */ | 43 */ |
48 final Source _source; | 44 final Source _source; |
49 | 45 |
50 factory _Parser2(Source source, AnalysisErrorListener errorListener) { | 46 factory _Parser2(Source source, AnalysisErrorListener errorListener) { |
51 var errorReporter = new ErrorReporter(errorListener, source); | 47 var errorReporter = new ErrorReporter(errorListener, source); |
52 var library = new _KernelLibraryBuilder(source.uri); | 48 var library = new _KernelLibraryBuilder(source.uri); |
53 var member = new _Builder(); | 49 var member = new _Builder(); |
54 var elementStore = new _ElementStore(); | |
55 var scope = new Scope.top(isModifiable: true); | 50 var scope = new Scope.top(isModifiable: true); |
56 | 51 |
57 AstBuilder astBuilder = new AstBuilder( | 52 AstBuilder astBuilder = |
58 errorReporter, library, member, elementStore, scope, true, false); | 53 new AstBuilder(errorReporter, library, member, scope, true); |
59 fasta.Parser fastaParser = new fasta.Parser(astBuilder); | 54 fasta.Parser fastaParser = new fasta.Parser(astBuilder); |
60 astBuilder.parser = fastaParser; | 55 astBuilder.parser = fastaParser; |
61 return new _Parser2._(source, fastaParser, astBuilder); | 56 return new _Parser2._(source, fastaParser, astBuilder); |
62 } | 57 } |
63 | 58 |
64 _Parser2._(this._source, this._fastaParser, this._astBuilder); | 59 _Parser2._(this._source, this._fastaParser, this._astBuilder); |
65 | 60 |
66 @override | 61 @override |
67 bool get parseGenericMethodComments => _astBuilder.parseGenericMethodComments; | 62 bool get parseGenericMethodComments => _astBuilder.parseGenericMethodComments; |
68 | 63 |
69 @override | 64 @override |
70 set parseGenericMethodComments(bool value) { | 65 set parseGenericMethodComments(bool value) { |
71 _astBuilder.parseGenericMethodComments = value; | 66 _astBuilder.parseGenericMethodComments = value; |
72 } | 67 } |
73 | 68 |
74 @override | 69 @override |
75 CompilationUnit parseCompilationUnit(Token token) { | 70 CompilationUnit parseCompilationUnit(Token token) { |
76 currentToken = token; | 71 currentToken = token; |
77 return parseCompilationUnit2(); | 72 return parseCompilationUnit2(); |
78 } | 73 } |
79 | 74 |
80 @override | 75 @override |
81 CompilationUnit parseCompilationUnit2() { | 76 CompilationUnit parseCompilationUnit2() { |
82 currentToken = _fastaParser.parseUnit(currentToken); | 77 currentToken = _fastaParser.parseUnit(currentToken); |
83 return _astBuilder.pop(); | 78 return _astBuilder.pop(); |
84 } | 79 } |
85 | 80 |
86 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 81 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
87 } | 82 } |
OLD | NEW |