| 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 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // TODO(ahe): This is also too frigging complicated. | 52 // TODO(ahe): This is also too frigging complicated. |
| 53 Script originalScript = element.getCompilationUnit().script; | 53 Script originalScript = element.getCompilationUnit().script; |
| 54 String name = SourceSpan.withOffsets( | 54 String name = SourceSpan.withOffsets( |
| 55 originalFunction.beginToken, originalFunction.endToken, | 55 originalFunction.beginToken, originalFunction.endToken, |
| 56 (beginOffset, endOffset) => | 56 (beginOffset, endOffset) => |
| 57 'synthesized:${originalScript.name}#$beginOffset:$endOffset'); | 57 'synthesized:${originalScript.name}#$beginOffset:$endOffset'); |
| 58 SourceFile synthesizedSourceFile = new SourceFile(name, unparsed); | 58 SourceFile synthesizedSourceFile = new SourceFile(name, unparsed); |
| 59 Script synthesizedScript = | 59 Script synthesizedScript = |
| 60 new Script(originalScript.uri, synthesizedSourceFile); | 60 new Script(originalScript.uri, synthesizedSourceFile); |
| 61 LibraryElement lib = new LibraryElement(synthesizedScript); | 61 LibraryElement lib = new LibraryElement(synthesizedScript); |
| 62 lib.canUseNative = element.getLibrary().canUseNative; |
| 62 NodeListener listener = | 63 NodeListener listener = |
| 63 new NodeListener(new ValidatorListener(synthesizedSourceFile), lib); | 64 new NodeListener(new ValidatorListener(synthesizedSourceFile), lib); |
| 64 parser = new Parser(listener); | 65 parser = new Parser(listener); |
| 65 parser.parseFunction(newTokens, getOrSet); | 66 parser.parseFunction(newTokens, getOrSet); |
| 66 FunctionExpression newNode = listener.popNode(); | 67 FunctionExpression newNode = listener.popNode(); |
| 67 // TODO(antonm): add Node comparison. | 68 // TODO(antonm): add Node comparison. |
| 68 } | 69 } |
| 69 } | 70 } |
| OLD | NEW |