1 16 package com.google.gwt.dev.js.ast; 17 18 22 public final class JsRootScope extends JsScope { 23 24 private final JsProgram program; 25 26 public JsRootScope(JsProgram program) { 27 super("Root"); 28 this.program = program; 29 ctorAddKnownGlobalSymbols(); 30 } 31 32 public JsProgram getProgram() { 33 return program; 34 } 35 36 protected JsName doCreateName(String ident, String shortIdent) { 37 JsName name = super.doCreateName(ident, shortIdent); 38 name.setObfuscatable(false); 39 return name; 40 } 41 42 private void ctorAddKnownGlobalSymbols() { 43 String [] commonBuiltins = new String [] { 45 "ActiveXObject", "Array", "Boolean", "Date", "Debug", "Enumerator", 46 "Error", "Function", "Global", "Image", "Math", "Number", "Object", 47 "RegExp", "String", "VBArray", "window", "document", "event", 48 "arguments", "call", "toString", "$wnd", "$doc", "$moduleName", 49 "$moduleBase", "debugger", "undefined"}; 50 51 for (int i = 0; i < commonBuiltins.length; i++) { 52 String ident = commonBuiltins[i]; 53 this.doCreateName(ident, ident); 54 } 55 } 56 57 } 58 | Popular Tags |