js: cleanup 'public', property access syntax
This commit is contained in:
@@ -21,7 +21,7 @@ import com.google.dart.compiler.backend.js.ast.*
|
||||
import java.util.Stack
|
||||
|
||||
class ScopeContext(scope: JsScope) {
|
||||
private val rootScope = sequence(scope) { it.getParent() }.first { it is JsRootScope }
|
||||
private val rootScope = sequence(scope) { it.parent }.first { it is JsRootScope }
|
||||
private val scopes = Stack<JsScope>();
|
||||
|
||||
init {
|
||||
@@ -30,7 +30,7 @@ class ScopeContext(scope: JsScope) {
|
||||
|
||||
fun enterFunction(): JsFunction {
|
||||
val fn = JsFunction(currentScope, "<js function>")
|
||||
enterScope(fn.getScope())
|
||||
enterScope(fn.scope)
|
||||
return fn
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class ScopeContext(scope: JsScope) {
|
||||
|
||||
fun enterCatch(ident: String): JsCatch {
|
||||
val jsCatch = JsCatch(currentScope, ident)
|
||||
enterScope(jsCatch.getScope())
|
||||
enterScope(jsCatch.scope)
|
||||
return jsCatch
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.google.gwt.dev.js
|
||||
import com.google.gwt.dev.js.rhino.*
|
||||
import com.google.gwt.dev.js.parserExceptions.*
|
||||
|
||||
public object ThrowExceptionOnErrorReporter : ErrorReporter {
|
||||
object ThrowExceptionOnErrorReporter : ErrorReporter {
|
||||
override fun warning(message: String, startPosition: CodePosition, endPosition: CodePosition) {}
|
||||
|
||||
override fun error(message: String, startPosition: CodePosition, endPosition: CodePosition) =
|
||||
|
||||
@@ -20,9 +20,9 @@ import com.google.gwt.dev.js.rhino.CodePosition
|
||||
/**
|
||||
* Can be used in Error reporter to exit parser
|
||||
*/
|
||||
public class AbortParsingException : RuntimeException()
|
||||
class AbortParsingException : RuntimeException()
|
||||
|
||||
public class JsParserException(
|
||||
class JsParserException(
|
||||
message: String,
|
||||
val position: CodePosition
|
||||
) : RuntimeException("$message at $position")
|
||||
@@ -18,9 +18,9 @@ package org.jetbrains.kotlin.js.parser
|
||||
|
||||
import com.google.gwt.dev.js.rhino.*
|
||||
|
||||
public object ParserEvents {
|
||||
object ParserEvents {
|
||||
|
||||
public class OnFunctionParsingStart
|
||||
class OnFunctionParsingStart
|
||||
|
||||
public class OnFunctionParsingEnd(public val tokenStream: TokenStream)
|
||||
class OnFunctionParsingEnd(val tokenStream: TokenStream)
|
||||
}
|
||||
@@ -27,13 +27,13 @@ import java.util.*
|
||||
|
||||
private val FAKE_SOURCE_INFO = SourceInfoImpl(null, 0, 0, 0, 0)
|
||||
|
||||
public fun parse(code: String, reporter: ErrorReporter, scope: JsScope): List<JsStatement> {
|
||||
fun parse(code: String, reporter: ErrorReporter, scope: JsScope): List<JsStatement> {
|
||||
val insideFunction = scope is JsFunctionScope
|
||||
val node = parse(code, 0, reporter, insideFunction, Parser::parse)
|
||||
return node.toJsAst(scope, JsAstMapper::mapStatements)
|
||||
}
|
||||
|
||||
public fun parseFunction(code: String, offset: Int, reporter: ErrorReporter, scope: JsScope): JsFunction =
|
||||
fun parseFunction(code: String, offset: Int, reporter: ErrorReporter, scope: JsScope): JsFunction =
|
||||
parse(code, offset, reporter, insideFunction = false) {
|
||||
addObserver(FunctionParsingObserver())
|
||||
primaryExpr(it)
|
||||
@@ -69,7 +69,7 @@ private fun parse(
|
||||
Context.enter().setErrorReporter(reporter)
|
||||
|
||||
try {
|
||||
val ts = TokenStream(StringReader(code, offset), "<parser>", FAKE_SOURCE_INFO.getLine())
|
||||
val ts = TokenStream(StringReader(code, offset), "<parser>", FAKE_SOURCE_INFO.line)
|
||||
val parser = Parser(IRFactory(ts), insideFunction)
|
||||
return parser.parseAction(ts) as Node
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user