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

Side by Side Diff: lib/compiler/implementation/unparse_validator.dart

Issue 10703188: Allow patch files to add top-level declarations to the patched library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix errors caught by editor. Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class ValidatorListener implements DiagnosticListener { 5 class ValidatorListener implements DiagnosticListener {
6 final SourceFile sourceFile; 6 final SourceFile sourceFile;
7 7
8 ValidatorListener(this.sourceFile); 8 ValidatorListener(this.sourceFile);
9 9
10 void cancel([String reason, node, token, instruction, element]) { 10 void cancel([String reason, node, token, instruction, element]) {
(...skipping 26 matching lines...) Expand all
37 37
38 Token newTokens = new StringScanner(unparsed).tokenize(); 38 Token newTokens = new StringScanner(unparsed).tokenize();
39 39
40 // Find the getOrSet token. 40 // Find the getOrSet token.
41 // TODO(ahe): This is to frigging complicated. Simplify it. 41 // TODO(ahe): This is to frigging complicated. Simplify it.
42 Parser parser = new Parser(new Listener()); 42 Parser parser = new Parser(new Listener());
43 Token getOrSet = 43 Token getOrSet =
44 parser.findGetOrSet(parser.parseModifiers(newTokens)); 44 parser.findGetOrSet(parser.parseModifiers(newTokens));
45 45
46 // TODO(ahe): This is also too frigging complicated. 46 // TODO(ahe): This is also too frigging complicated.
47 Script originalScript = originalFunction.getCompilationUnit().script; 47 Script originalScript = originalFunction.getScript();
48 String name = SourceSpan.withCharacterOffsets( 48 String name = SourceSpan.withCharacterOffsets(
49 originalFunction.beginToken, originalFunction.endToken, 49 originalFunction.beginToken, originalFunction.endToken,
50 (beginOffset, endOffset) => 50 (beginOffset, endOffset) =>
51 'synthesized:${originalScript.name}#$beginOffset:$endOffset'); 51 'synthesized:${originalScript.name}#$beginOffset:$endOffset');
52 SourceFile synthesizedSourceFile = new SourceFile(name, unparsed); 52 SourceFile synthesizedSourceFile = new SourceFile(name, unparsed);
53 Script synthesizedScript = 53 Script synthesizedScript =
54 new Script(originalScript.uri, synthesizedSourceFile); 54 new Script(originalScript.uri, synthesizedSourceFile);
55 LibraryElement lib = new LibraryElement(synthesizedScript); 55 LibraryElement lib = new LibraryElement(synthesizedScript);
56 lib.canUseNative = originalFunction.getLibrary().canUseNative; 56 lib.canUseNative = originalFunction.getLibrary().canUseNative;
57 NodeListener listener = 57 NodeListener listener =
(...skipping 17 matching lines...) Expand all
75 assert(element is VariableElement || element is AbstractFieldElement); 75 assert(element is VariableElement || element is AbstractFieldElement);
76 // Fields are just names with possible initialization expressions. 76 // Fields are just names with possible initialization expressions.
77 // Nothing to care about for now. 77 // Nothing to care about for now.
78 } else if (element is VoidElement) { 78 } else if (element is VoidElement) {
79 // Nothing to do here. 79 // Nothing to do here.
80 } else { 80 } else {
81 compiler.cancel('Cannot handle $element'); 81 compiler.cancel('Cannot handle $element');
82 } 82 }
83 } 83 }
84 } 84 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698